using System.Collections.Generic; using System.Linq; namespace BLL { public static class MillionsMonthlyReportService { /// /// 百万工时安全统计月报表 /// /// 百万工时安全统计月报表Id /// 百万工时安全统计月报表 public static Model.Information_MillionsMonthlyReport GetMillionsMonthlyReportByMillionsMonthlyReportId(string MillionsMonthlyReportId) { return Funs.DB.Information_MillionsMonthlyReport.FirstOrDefault(e => e.MillionsMonthlyReportId == MillionsMonthlyReportId); } /// /// 百万工时安全统计月报表 /// /// 单位Id /// 年度 /// 月份 /// 百万工时安全统计月报表 public static Model.Information_MillionsMonthlyReport GetMillionsMonthlyReportByUnitIdAndYearAndMonth(string unitId, int year, int month) { return Funs.DB.Information_MillionsMonthlyReport.FirstOrDefault(e => e.UnitId == unitId && e.Month == month && e.Year == year); } /// /// 根据单位Id获取百万工时安全统计月报表集合 /// /// 单位Id /// 百万工时安全统计月报表集合 public static List GetMillionsMonthlyReportsByUnitId(string UnitId) { return (from x in Funs.DB.View_Information_MillionsMonthlyReport where x.UnitId == UnitId orderby x.FillingDate descending select x).ToList(); } /// /// 增加百万工时安全统计月报表 /// /// 百万工时安全统计月报表实体 public static void AddMillionsMonthlyReport(Model.Information_MillionsMonthlyReport MillionsMonthlyReport) { Model.Information_MillionsMonthlyReport newMillionsMonthlyReport = new Model.Information_MillionsMonthlyReport { MillionsMonthlyReportId = MillionsMonthlyReport.MillionsMonthlyReportId, Year = MillionsMonthlyReport.Year, Month = MillionsMonthlyReport.Month, UnitId = MillionsMonthlyReport.UnitId, FillingDate = MillionsMonthlyReport.FillingDate, DutyPerson = MillionsMonthlyReport.DutyPerson, RecordableIncidentRate = MillionsMonthlyReport.RecordableIncidentRate, LostTimeRate = MillionsMonthlyReport.LostTimeRate, LostTimeInjuryRate = MillionsMonthlyReport.LostTimeInjuryRate, DeathAccidentFrequency = MillionsMonthlyReport.DeathAccidentFrequency, AccidentMortality = MillionsMonthlyReport.AccidentMortality, FillingMan = MillionsMonthlyReport.FillingMan, UpState = MillionsMonthlyReport.UpState, HandleState = MillionsMonthlyReport.HandleState, HandleMan = MillionsMonthlyReport.HandleMan }; Funs.DB.Information_MillionsMonthlyReport.InsertOnSubmit(newMillionsMonthlyReport); Funs.DB.SubmitChanges(); } /// /// 修改百万工时安全统计月报表 /// /// 百万工时安全统计月报表实体 public static void UpdateMillionsMonthlyReport(Model.Information_MillionsMonthlyReport MillionsMonthlyReport) { Model.Information_MillionsMonthlyReport newMillionsMonthlyReport = Funs.DB.Information_MillionsMonthlyReport.FirstOrDefault(e => e.MillionsMonthlyReportId == MillionsMonthlyReport.MillionsMonthlyReportId); if (newMillionsMonthlyReport != null) { newMillionsMonthlyReport.Year = MillionsMonthlyReport.Year; newMillionsMonthlyReport.Month = MillionsMonthlyReport.Month; newMillionsMonthlyReport.UnitId = MillionsMonthlyReport.UnitId; newMillionsMonthlyReport.FillingDate = MillionsMonthlyReport.FillingDate; newMillionsMonthlyReport.DutyPerson = MillionsMonthlyReport.DutyPerson; newMillionsMonthlyReport.RecordableIncidentRate = MillionsMonthlyReport.RecordableIncidentRate; newMillionsMonthlyReport.LostTimeRate = MillionsMonthlyReport.LostTimeRate; newMillionsMonthlyReport.LostTimeInjuryRate = MillionsMonthlyReport.LostTimeInjuryRate; newMillionsMonthlyReport.DeathAccidentFrequency = MillionsMonthlyReport.DeathAccidentFrequency; newMillionsMonthlyReport.AccidentMortality = MillionsMonthlyReport.AccidentMortality; newMillionsMonthlyReport.UpState = MillionsMonthlyReport.UpState; newMillionsMonthlyReport.HandleState = MillionsMonthlyReport.HandleState; newMillionsMonthlyReport.HandleMan = MillionsMonthlyReport.HandleMan; Funs.DB.SubmitChanges(); } } /// /// 根据Id获取数据 /// /// public static void DeleteMillionsMonthlyReportByMillionsMonthlyReportId(string MillionsMonthlyReportId) { Model.Information_MillionsMonthlyReport newMillionsMonthlyReport = Funs.DB.Information_MillionsMonthlyReport.FirstOrDefault(e => e.MillionsMonthlyReportId == MillionsMonthlyReportId); if (newMillionsMonthlyReport != null) { Funs.DB.Information_MillionsMonthlyReport.DeleteOnSubmit(newMillionsMonthlyReport); Funs.DB.SubmitChanges(); } } /// /// 根据报表单位,报表时间判断是否存在 /// /// Id /// public static Model.Information_MillionsMonthlyReport GetMillionsMonthlyReportByUnitIdDate(string unitId, int year, int Month) { return Funs.DB.Information_MillionsMonthlyReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Month == Month); } } }