using FastReport; using Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// HSE月报 /// public class HSEMonthReportService { /// /// 根据主键获取HSE月报 /// /// /// public static Model.Report_HSEMonthReport GetHSEMonthReportById(string reportId) { return Funs.DB.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == reportId); } /// /// 添加HSE月报 /// /// public static void AddHSEMonthReport(Model.Report_HSEMonthReport report) { CNPCDB db = Funs.DB; Model.Report_HSEMonthReport newReport = new Report_HSEMonthReport(); newReport.ReportId = report.ReportId; newReport.UnitId = report.UnitId; newReport.ReportDate = report.ReportDate; newReport.TotalEmployees = report.TotalEmployees; newReport.TotalHours = report.TotalHours; newReport.ContractorEmployees = report.ContractorEmployees; newReport.ContractorHours = report.ContractorHours; newReport.MonthHours = report.MonthHours; newReport.MonthHoursAvg = report.MonthHoursAvg; newReport.YearHours = report.YearHours; newReport.Remark = report.Remark; newReport.BranchTraining = report.BranchTraining; newReport.ProjectTraining = report.ProjectTraining; newReport.TeamGroupTraining = report.TeamGroupTraining; newReport.SelfTraining = report.SelfTraining; newReport.ContractorOrganizeTraining = report.ContractorOrganizeTraining; newReport.ContractorTraining = report.ContractorTraining; newReport.CompileMan = report.CompileMan; newReport.CompileDate = report.CompileDate; db.Report_HSEMonthReport.InsertOnSubmit(newReport); db.SubmitChanges(); } /// /// 修改HSE月报 /// /// public static void UpdateHSEMonthReport(Model.Report_HSEMonthReport report) { CNPCDB db = Funs.DB; Model.Report_HSEMonthReport newReport = db.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == report.ReportId); if (newReport != null) { newReport.UnitId = report.UnitId; newReport.ReportDate = report.ReportDate; newReport.TotalEmployees = report.TotalEmployees; newReport.TotalHours = report.TotalHours; newReport.ContractorEmployees = report.ContractorEmployees; newReport.ContractorHours = report.ContractorHours; newReport.MonthHours = report.MonthHours; newReport.MonthHoursAvg = report.MonthHoursAvg; newReport.YearHours = report.YearHours; newReport.Remark = report.Remark; newReport.BranchTraining = report.BranchTraining; newReport.ProjectTraining = report.ProjectTraining; newReport.TeamGroupTraining = report.TeamGroupTraining; newReport.SelfTraining = report.SelfTraining; newReport.ContractorOrganizeTraining = report.ContractorOrganizeTraining; newReport.ContractorTraining = report.ContractorTraining; db.SubmitChanges(); } } /// /// 根据主键删除HSE月报 /// /// public static void DeleteHSEMonthReportByReportId(string reportId) { CNPCDB db = Funs.DB; Model.Report_HSEMonthReport report = db.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == reportId); if (report != null) { db.Report_HSEMonthReport.DeleteOnSubmit(report); db.SubmitChanges(); } } /// /// 根据月报日期获取HSE月报信息 /// /// /// /// public static Model.Report_HSEMonthReport GetHSEMonthReportByReportDate(string unitId, DateTime? reportDate) { return Funs.DB.Report_HSEMonthReport.FirstOrDefault(e => e.UnitId == unitId && e.ReportDate == reportDate); } } }