using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public static class AccidentCauseReportService { /// /// 职工伤亡事故原因分析报表 /// /// 职工伤亡事故原因分析报表Id /// 职工伤亡事故原因分析报表 public static Model.Information_AccidentCauseReport GetAccidentCauseReportByAccidentCauseReportId(string AccidentCauseReportId) { return Funs.DB.Information_AccidentCauseReport.FirstOrDefault(e => e.AccidentCauseReportId == AccidentCauseReportId); } /// /// 职工伤亡事故原因分析报表 /// /// 单位Id /// 年度 /// 月份 /// 职工伤亡事故原因分析报表 public static Model.Information_AccidentCauseReport GetAccidentCauseReportByUnitIdAndYearAndMonth(string unitId, int year, int month) { return Funs.DB.Information_AccidentCauseReport.FirstOrDefault(e => e.UnitId == unitId && e.Month == month && e.Year == year); } /// /// 根据单位Id获取职工伤亡事故原因分析报表集合 /// /// 单位Id /// 职工伤亡事故原因分析报表集合 public static List GetAccidentCauseReportsByUnitId(string UnitId) { return (from x in Funs.DB.View_Information_AccidentCauseReport where x.UnitId == UnitId orderby x.FillingDate descending select x).ToList(); } /// /// 增加职工伤亡事故原因分析报表 /// /// 职工伤亡事故原因分析报表实体 public static void AddAccidentCauseReport(Model.Information_AccidentCauseReport AccidentCauseReport) { Model.Information_AccidentCauseReport newAccidentCauseReport = new Model.Information_AccidentCauseReport { AccidentCauseReportId = AccidentCauseReport.AccidentCauseReportId, AccidentCauseReportCode = AccidentCauseReport.AccidentCauseReportCode, Year = AccidentCauseReport.Year, Month = AccidentCauseReport.Month, UnitId = AccidentCauseReport.UnitId, DeathAccident = AccidentCauseReport.DeathAccident, DeathToll = AccidentCauseReport.DeathToll, InjuredAccident = AccidentCauseReport.InjuredAccident, InjuredToll = AccidentCauseReport.InjuredToll, MinorWoundAccident = AccidentCauseReport.MinorWoundAccident, MinorWoundToll = AccidentCauseReport.MinorWoundToll, AverageTotalHours = AccidentCauseReport.AverageTotalHours, AverageManHours = AccidentCauseReport.AverageManHours, TotalLossMan = AccidentCauseReport.TotalLossMan, LastMonthLossHoursTotal = AccidentCauseReport.LastMonthLossHoursTotal, KnockOffTotal = AccidentCauseReport.KnockOffTotal, DirectLoss = AccidentCauseReport.DirectLoss, IndirectLosses = AccidentCauseReport.IndirectLosses, TotalLoss = AccidentCauseReport.TotalLoss, TotalLossTime = AccidentCauseReport.TotalLossTime, FillCompanyPersonCharge = AccidentCauseReport.FillCompanyPersonCharge, TabPeople = AccidentCauseReport.TabPeople, FillingDate = AccidentCauseReport.FillingDate, AuditPerson = AccidentCauseReport.AuditPerson, UpState = AccidentCauseReport.UpState, HandleState = AccidentCauseReport.HandleState, HandleMan = AccidentCauseReport.HandleMan }; Funs.DB.Information_AccidentCauseReport.InsertOnSubmit(newAccidentCauseReport); Funs.DB.SubmitChanges(); } /// /// 修改职工伤亡事故原因分析报表 /// /// 职工伤亡事故原因分析报表实体 public static void UpdateAccidentCauseReport(Model.Information_AccidentCauseReport AccidentCauseReport) { Model.Information_AccidentCauseReport newAccidentCauseReport = Funs.DB.Information_AccidentCauseReport.FirstOrDefault(e => e.AccidentCauseReportId == AccidentCauseReport.AccidentCauseReportId); if (newAccidentCauseReport != null) { newAccidentCauseReport.AccidentCauseReportCode = AccidentCauseReport.AccidentCauseReportCode; newAccidentCauseReport.Year = AccidentCauseReport.Year; newAccidentCauseReport.Month = AccidentCauseReport.Month; newAccidentCauseReport.UnitId = AccidentCauseReport.UnitId; newAccidentCauseReport.DeathAccident = AccidentCauseReport.DeathAccident; newAccidentCauseReport.DeathToll = AccidentCauseReport.DeathToll; newAccidentCauseReport.InjuredAccident = AccidentCauseReport.InjuredAccident; newAccidentCauseReport.InjuredToll = AccidentCauseReport.InjuredToll; newAccidentCauseReport.MinorWoundAccident = AccidentCauseReport.MinorWoundAccident; newAccidentCauseReport.MinorWoundToll = AccidentCauseReport.MinorWoundToll; newAccidentCauseReport.AverageTotalHours = AccidentCauseReport.AverageTotalHours; newAccidentCauseReport.AverageManHours = AccidentCauseReport.AverageManHours; newAccidentCauseReport.TotalLossMan = AccidentCauseReport.TotalLossMan; newAccidentCauseReport.LastMonthLossHoursTotal = AccidentCauseReport.LastMonthLossHoursTotal; newAccidentCauseReport.KnockOffTotal = AccidentCauseReport.KnockOffTotal; newAccidentCauseReport.DirectLoss = AccidentCauseReport.DirectLoss; newAccidentCauseReport.IndirectLosses = AccidentCauseReport.IndirectLosses; newAccidentCauseReport.TotalLoss = AccidentCauseReport.TotalLoss; newAccidentCauseReport.TotalLossTime = AccidentCauseReport.TotalLossTime; newAccidentCauseReport.FillCompanyPersonCharge = AccidentCauseReport.FillCompanyPersonCharge; newAccidentCauseReport.TabPeople = AccidentCauseReport.TabPeople; newAccidentCauseReport.AuditPerson = AccidentCauseReport.AuditPerson; newAccidentCauseReport.FillCompanyPersonCharge = AccidentCauseReport.FillCompanyPersonCharge; newAccidentCauseReport.TabPeople = AccidentCauseReport.TabPeople; newAccidentCauseReport.AuditPerson = AccidentCauseReport.AuditPerson; newAccidentCauseReport.FillingDate = AccidentCauseReport.FillingDate; newAccidentCauseReport.UpState = AccidentCauseReport.UpState; newAccidentCauseReport.HandleState = AccidentCauseReport.HandleState; newAccidentCauseReport.HandleMan = AccidentCauseReport.HandleMan; Funs.DB.SubmitChanges(); } } /// /// 根据Id获取数据 /// /// public static void DeleteAccidentCauseReportByAccidentCauseReportId(string AccidentCauseReportId) { Model.Information_AccidentCauseReport newAccidentCauseReport = Funs.DB.Information_AccidentCauseReport.FirstOrDefault(e => e.AccidentCauseReportId == AccidentCauseReportId); if (newAccidentCauseReport != null) { ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(AccidentCauseReportId); Funs.DB.Information_AccidentCauseReport.DeleteOnSubmit(newAccidentCauseReport); Funs.DB.SubmitChanges(); } } /// /// 根据报表单位,报表时间判断是否存在 /// /// Id /// public static Model.Information_AccidentCauseReport GetAccidentCauseReportByUnitIdDate(string unitId, int year, int Month) { return Funs.DB.Information_AccidentCauseReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Month == Month); } } }