xinjiang/SGGL/BLL/ZHGL/Information/WorkSummaryReportService.cs

114 lines
5.9 KiB
C#

using System.Linq;
namespace BLL
{
/// <summary>
/// 安全管理工作总结报告
/// </summary>
public static class WorkSummaryReportService
{
/// <summary>
/// 根据主键获取安全管理工作总结报告
/// </summary>
/// <param name="workSummaryReportId"></param>
/// <returns></returns>
public static Model.Information_WorkSummaryReport GetWorkSummaryReportById(string workSummaryReportId)
{
return Funs.DB.Information_WorkSummaryReport.FirstOrDefault(e => e.WorkSummaryReportId == workSummaryReportId);
}
/// <summary>
/// 安全管理工作总结报告
/// </summary>
/// <param name="unitId">单位Id</param>
/// <param name="year">年度</param>
/// <returns>安全管理工作总结报告</returns>
public static Model.Information_WorkSummaryReport GetWorkSummaryReportByUnitIdAndYear(string unitId, int year)
{
return Funs.DB.Information_WorkSummaryReport.FirstOrDefault(e => e.UnitId == unitId && e.YearId == year);
}
/// <summary>
/// 添加安全管理工作总结报告
/// </summary>
/// <param name="workSummaryReport"></param>
public static void AddWorkSummaryReport(Model.Information_WorkSummaryReport workSummaryReport)
{
Model.Information_WorkSummaryReport newWorkSummaryReport = new Model.Information_WorkSummaryReport
{
WorkSummaryReportId = workSummaryReport.WorkSummaryReportId,
YearId = workSummaryReport.YearId,
UnitId = workSummaryReport.UnitId,
ResponsiblePerson = workSummaryReport.ResponsiblePerson,
ResponsiblePersonTel = workSummaryReport.ResponsiblePersonTel,
ContactPerson = workSummaryReport.ContactPerson,
ContactPersonTel = workSummaryReport.ContactPersonTel,
ReportDate = workSummaryReport.ReportDate,
SafeLaborTime = workSummaryReport.SafeLaborTime,
SafetyObjectives = workSummaryReport.SafetyObjectives,
AccidentSituation = workSummaryReport.AccidentSituation,
Awards = workSummaryReport.Awards,
WorkDevelopment = workSummaryReport.WorkDevelopment,
PersonnelTraining = workSummaryReport.PersonnelTraining,
GovernanceSituation = workSummaryReport.GovernanceSituation,
ManagementActivity = workSummaryReport.ManagementActivity,
WorkExperience = workSummaryReport.WorkExperience,
Countermeasures = workSummaryReport.Countermeasures,
NextYearWorkPlan = workSummaryReport.NextYearWorkPlan,
JobSuggestion = workSummaryReport.JobSuggestion,
UpState = workSummaryReport.UpState
};
Funs.DB.Information_WorkSummaryReport.InsertOnSubmit(newWorkSummaryReport);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改安全管理工作总结报告
/// </summary>
/// <param name="workSummaryReport"></param>
public static void UpdateWorkSummaryReport(Model.Information_WorkSummaryReport workSummaryReport)
{
Model.Information_WorkSummaryReport newWorkSummaryReport = Funs.DB.Information_WorkSummaryReport.FirstOrDefault(e => e.WorkSummaryReportId == workSummaryReport.WorkSummaryReportId);
if (newWorkSummaryReport != null)
{
newWorkSummaryReport.UnitId = workSummaryReport.UnitId;
newWorkSummaryReport.YearId = workSummaryReport.YearId;
newWorkSummaryReport.ResponsiblePerson = workSummaryReport.ResponsiblePerson;
newWorkSummaryReport.ResponsiblePersonTel = workSummaryReport.ResponsiblePersonTel;
newWorkSummaryReport.ContactPerson = workSummaryReport.ContactPerson;
newWorkSummaryReport.ContactPersonTel = workSummaryReport.ContactPersonTel;
newWorkSummaryReport.ReportDate = workSummaryReport.ReportDate;
newWorkSummaryReport.SafeLaborTime = workSummaryReport.SafeLaborTime;
newWorkSummaryReport.SafetyObjectives = workSummaryReport.SafetyObjectives;
newWorkSummaryReport.AccidentSituation = workSummaryReport.AccidentSituation;
newWorkSummaryReport.Awards = workSummaryReport.Awards;
newWorkSummaryReport.WorkDevelopment = workSummaryReport.WorkDevelopment;
newWorkSummaryReport.PersonnelTraining = workSummaryReport.PersonnelTraining;
newWorkSummaryReport.GovernanceSituation = workSummaryReport.GovernanceSituation;
newWorkSummaryReport.ManagementActivity = workSummaryReport.ManagementActivity;
newWorkSummaryReport.WorkExperience = workSummaryReport.WorkExperience;
newWorkSummaryReport.Countermeasures = workSummaryReport.Countermeasures;
newWorkSummaryReport.NextYearWorkPlan = workSummaryReport.NextYearWorkPlan;
newWorkSummaryReport.JobSuggestion = workSummaryReport.JobSuggestion;
newWorkSummaryReport.UpState = workSummaryReport.UpState;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除安全管理工作总结报告
/// </summary>
/// <param name="workSummaryReportId"></param>
public static void DeleteWorkSummaryReportById(string workSummaryReportId)
{
Model.Information_WorkSummaryReport workSummaryReport = Funs.DB.Information_WorkSummaryReport.FirstOrDefault(e => e.WorkSummaryReportId == workSummaryReportId);
if (workSummaryReport != null)
{
Funs.DB.Information_WorkSummaryReport.DeleteOnSubmit(workSummaryReport);
Funs.DB.SubmitChanges();
}
}
}
}