SGGL_JT/SUBQHSE/BLL/Customization/CNCEC4/PersonnelAllocationInfoServ...

112 lines
4.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 专职安全管理人员配备信息统计表
/// </summary>
public class PersonnelAllocationInfoService
{
/// <summary>
/// 根据主键获取专职安全管理人员配备信息统计表
/// </summary>
/// <param name="reportId"></param>
/// <returns></returns>
public static Model.Report_PersonnelAllocationInfo GetReportById(string reportId)
{
return Funs.DB.Report_PersonnelAllocationInfo.FirstOrDefault(e => e.ReportId == reportId);
}
/// <summary>
/// 根据项目Id、月份获取月报信息
/// </summary>
/// <param name="projectId"></param>
/// <param name="month"></param>
/// <returns></returns>
public static Model.Report_PersonnelAllocationInfo GetReportByMonth(string projectId, string month)
{
return Funs.DB.Report_PersonnelAllocationInfo.FirstOrDefault(e => e.ProjectId == projectId && e.Months == Convert.ToDateTime(month));
}
/// <summary>
/// 添加专职安全管理人员配备信息统计表
/// </summary>
/// <param name="report"></param>
public static void AddReport(Model.Report_PersonnelAllocationInfo report)
{
Model.Report_PersonnelAllocationInfo newReport = new Model.Report_PersonnelAllocationInfo
{
ReportId = report.ReportId,
Months = report.Months,
ProjectId = report.ProjectId,
UnitId = report.UnitId,
Duties = report.Duties,
PersonName = report.PersonName,
Telephone = report.Telephone,
EmergentTel = report.EmergentTel,
IdentityCard = report.IdentityCard,
Sex = report.Sex,
Education = report.Education,
Major = report.Major,
YearsOfService = report.YearsOfService,
Qualification = report.Qualification,
PersonStates = report.PersonStates,
Remark = report.Remark,
PersonnelAdjustment = report.PersonnelAdjustment,
CompileMan = report.CompileMan,
CompileDate = report.CompileDate,
States = report.States
};
Funs.DB.Report_PersonnelAllocationInfo.InsertOnSubmit(newReport);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改专职安全管理人员配备信息统计表
/// </summary>
/// <param name="report"></param>
public static void UpdateReport(Model.Report_PersonnelAllocationInfo report)
{
Model.Report_PersonnelAllocationInfo newReport = Funs.DB.Report_PersonnelAllocationInfo.FirstOrDefault(e => e.ReportId == report.ReportId);
if (newReport != null)
{
newReport.Months = report.Months;
newReport.Duties = report.Duties;
newReport.PersonName = report.PersonName;
newReport.Telephone = report.Telephone;
newReport.EmergentTel = report.EmergentTel;
newReport.IdentityCard = report.IdentityCard;
newReport.Sex = report.Sex;
newReport.Education = report.Education;
newReport.Major = report.Major;
newReport.YearsOfService = report.YearsOfService;
newReport.Qualification = report.Qualification;
newReport.PersonStates = report.PersonStates;
newReport.Remark = report.Remark;
newReport.PersonnelAdjustment = report.PersonnelAdjustment;
newReport.CompileMan = report.CompileMan;
newReport.CompileDate = report.CompileDate;
newReport.States = report.States;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除专职安全管理人员配备信息统计表
/// </summary>
/// <param name="reportId"></param>
public static void DeleteReportById(string reportId)
{
Model.Report_PersonnelAllocationInfo newReport = Funs.DB.Report_PersonnelAllocationInfo.FirstOrDefault(e => e.ReportId == reportId);
if (newReport != null)
{
Funs.DB.Report_PersonnelAllocationInfo.DeleteOnSubmit(newReport);
Funs.DB.SubmitChanges();
}
}
}
}