using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class PersonSortCService
{
public static Model.SGGLDB db = Funs.DB;
///
/// 根据月报告主键获取所有月报告HSE人力投入信息
///
/// 月报告主键
///
public static List GetPersonSortsByMonthReportId(string monthReportId, string projectId)
{
var q = (from x in Funs.DB.Manager_PersonSortC
join y in Funs.DB.Project_ProjectUnit
on x.UnitId equals y.UnitId
where x.MonthReportId == monthReportId && y.ProjectId == projectId
orderby y.UnitType
select x).Distinct().ToList();
return q;
}
///
/// 增加月报告HSE人力投入信息
///
/// 月报告HSE人力投入实体
public static void AddPersonSort(Model.Manager_PersonSortC checkSort)
{
Model.SGGLDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_PersonSortC));
Model.Manager_PersonSortC newPersonSort = new Model.Manager_PersonSortC
{
PersonSortId = newKeyID,
MonthReportId = checkSort.MonthReportId,
UnitId = checkSort.UnitId,
SumPersonNum = checkSort.SumPersonNum,
HSEPersonNum = checkSort.HSEPersonNum,
ContractRange = checkSort.ContractRange,
Remark = checkSort.Remark
};
db.Manager_PersonSortC.InsertOnSubmit(newPersonSort);
db.SubmitChanges();
}
///
/// 根据月报告主键删除对应的所有月报告HSE人力投入信息
///
/// 月报告主键
public static void DeletePersonSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_PersonSortC where x.MonthReportId == monthReportId select x).ToList();
db.Manager_PersonSortC.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}