using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 集团在建项目信息月报 /// public class ZHGL_ProjectInfoMonthReportService { /// /// 根据主键获取在建项目信息月报 /// /// /// public static Model.ZHGL_Report_ProjectInfoMonthReport GetProjectInfoMonthReportById(string monthReportId) { return Funs.DB.ZHGL_Report_ProjectInfoMonthReport.FirstOrDefault(e => e.MonthReportId == monthReportId); } /// /// 根据单位Id和月份获取列表信息 /// /// /// /// public static List GetReportList(string unitId, string month) { return (from x in Funs.DB.ZHGL_Report_ProjectInfoMonthReport where x.UnitId == unitId && x.Months == Convert.ToDateTime(month) select x).ToList(); } /// /// 根据单位Id、月份获取月报信息 /// /// /// /// public static Model.ZHGL_Report_ProjectInfoMonthReport GetProjectInfoMonthReportByMonth(string unitId, string month) { return Funs.DB.ZHGL_Report_ProjectInfoMonthReport.FirstOrDefault(e => e.UnitId == unitId && e.Months == Convert.ToDateTime(month)); } /// /// 添加在建项目信息月报 /// /// public static void AddProjectInfoMonthReport(Model.ZHGL_Report_ProjectInfoMonthReport report) { Model.ZHGL_Report_ProjectInfoMonthReport newReport = new Model.ZHGL_Report_ProjectInfoMonthReport { MonthReportId = report.MonthReportId, Months = report.Months, UnitId = report.UnitId, UnitProject = report.UnitProject, ProjectCount = report.ProjectCount, SafeManagePersonCount = report.SafeManagePersonCount, PersonCount = report.PersonCount, SafeTotalWorkHours = report.SafeTotalWorkHours, YearSafeWorkHours = report.YearSafeWorkHours, TrainingCount = report.TrainingCount, SafetyInput = report.SafetyInput, DangerousProject = report.DangerousProject, EmergencyDrill = report.EmergencyDrill, AwardHonor = report.AwardHonor, HiddenTroubleSameAS = report.HiddenTroubleSameAS, HiddenTroubleGreat = report.HiddenTroubleGreat, HighRiskCount = report.HighRiskCount, AccidentCount = report.AccidentCount, EconomicLoss = report.EconomicLoss, LostTime = report.LostTime, States = report.States, }; Funs.DB.ZHGL_Report_ProjectInfoMonthReport.InsertOnSubmit(newReport); Funs.DB.SubmitChanges(); } /// /// 修改 /// /// public static void UpdateProjectInfoMonthReport(Model.ZHGL_Report_ProjectInfoMonthReport report) { Model.ZHGL_Report_ProjectInfoMonthReport newReport = Funs.DB.ZHGL_Report_ProjectInfoMonthReport.FirstOrDefault(e => e.MonthReportId == report.MonthReportId); if (newReport != null) { newReport.UnitProject = report.UnitProject; newReport.ProjectCount = report.ProjectCount; newReport.SafeManagePersonCount = report.SafeManagePersonCount; newReport.PersonCount = report.PersonCount; newReport.SafeTotalWorkHours = report.SafeTotalWorkHours; newReport.YearSafeWorkHours = report.YearSafeWorkHours; newReport.TrainingCount = report.TrainingCount; newReport.SafetyInput = report.SafetyInput; newReport.DangerousProject = report.DangerousProject; newReport.EmergencyDrill = report.EmergencyDrill; newReport.AwardHonor = report.AwardHonor; newReport.HiddenTroubleSameAS = report.HiddenTroubleSameAS; newReport.HiddenTroubleGreat = report.HiddenTroubleGreat; newReport.HighRiskCount = report.HighRiskCount; newReport.AccidentCount = report.AccidentCount; newReport.EconomicLoss = report.EconomicLoss; newReport.LostTime = report.LostTime; newReport.States = report.States; Funs.DB.SubmitChanges(); } } /// /// 根据所属单位id和月份删除月报信息 /// /// /// public static void DeleteReprotById(string unitId, string months) { var q = from x in Funs.DB.ZHGL_Report_ProjectInfoMonthReport where x.UnitId == unitId && x.Months == Convert.ToDateTime(months) select x; if (q != null) { Funs.DB.ZHGL_Report_ProjectInfoMonthReport.DeleteAllOnSubmit(q); Funs.DB.SubmitChanges(); } } } }