using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 应急演练开展情况季报主表 /// public static class DrillConductedQuarterlyReportService { /// /// 根据主键获取应急演练开展情况季报表 /// /// /// public static Model.Information_DrillConductedQuarterlyReport GetDrillConductedQuarterlyReportById(string drillConductedQuarterlyReportId) { return Funs.DB.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId); } /// /// 应急演练开展情况季报表 /// /// 单位Id /// 年度 /// 季度 /// 应急演练开展情况季报表 public static Model.Information_DrillConductedQuarterlyReport GetDrillConductedQuarterlyReportByUnitIdAndYearAndQuarters(string unitId, int year, int quarters) { return Funs.DB.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.UnitId == unitId && e.Quarter == quarters && e.YearId == year); } /// /// 根据单位Id获取安全生产数据季报集合 /// /// 单位Id /// 安全生产数据季报集合 public static List GetDrillConductedQuarterlyReportsByUnitId(string UnitId) { return (from x in Funs.DB.View_Information_DrillConductedQuarterlyReport where x.UnitId == UnitId orderby x.ReportDate descending select x).ToList(); } /// /// 添加应急演练开展情况季报表 /// /// public static void AddDrillConductedQuarterlyReport(Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport) { Model.Information_DrillConductedQuarterlyReport newDrillConductedQuarterlyReport = new Model.Information_DrillConductedQuarterlyReport { DrillConductedQuarterlyReportId = drillConductedQuarterlyReport.DrillConductedQuarterlyReportId, UnitId = drillConductedQuarterlyReport.UnitId, ReportDate = drillConductedQuarterlyReport.ReportDate, YearId = drillConductedQuarterlyReport.YearId, Quarter = drillConductedQuarterlyReport.Quarter, CompileMan = drillConductedQuarterlyReport.CompileMan, UpState = drillConductedQuarterlyReport.UpState, HandleState = drillConductedQuarterlyReport.HandleState, HandleMan = drillConductedQuarterlyReport.HandleMan }; Funs.DB.Information_DrillConductedQuarterlyReport.InsertOnSubmit(newDrillConductedQuarterlyReport); Funs.DB.SubmitChanges(); } /// /// 修改应急演练开展情况季报表 /// /// public static void UpdateDrillConductedQuarterlyReport(Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport) { Model.Information_DrillConductedQuarterlyReport newDrillConductedQuarterlyReport = Funs.DB.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == drillConductedQuarterlyReport.DrillConductedQuarterlyReportId); if (newDrillConductedQuarterlyReport != null) { newDrillConductedQuarterlyReport.UnitId = drillConductedQuarterlyReport.UnitId; newDrillConductedQuarterlyReport.ReportDate = drillConductedQuarterlyReport.ReportDate; newDrillConductedQuarterlyReport.YearId = drillConductedQuarterlyReport.YearId; newDrillConductedQuarterlyReport.Quarter = drillConductedQuarterlyReport.Quarter; newDrillConductedQuarterlyReport.UpState = drillConductedQuarterlyReport.UpState; newDrillConductedQuarterlyReport.HandleState = drillConductedQuarterlyReport.HandleState; newDrillConductedQuarterlyReport.HandleMan = drillConductedQuarterlyReport.HandleMan; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除应急演练开展情况季报表 /// /// public static void DeleteDrillConductedQuarterlyReportById(string drillConductedQuarterlyReportId) { Model.Information_DrillConductedQuarterlyReport drillConductedQuarterlyReport = Funs.DB.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId); if (drillConductedQuarterlyReport != null) { Funs.DB.Information_DrillConductedQuarterlyReport.DeleteOnSubmit(drillConductedQuarterlyReport); Funs.DB.SubmitChanges(); } } /// /// 根据单位、季度获取应急演练开展情况季报表 /// /// /// /// public static Model.Information_DrillConductedQuarterlyReport GetDrillConductedQuarterlyReportByUnitIdDate(string unitId, int yearId, int quarter, string drillConductedQuarterlyReportId) { return Funs.DB.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.UnitId == unitId && e.YearId == yearId && e.Quarter == quarter && ((drillConductedQuarterlyReportId == null && e.DrillConductedQuarterlyReportId != null) || e.DrillConductedQuarterlyReportId != drillConductedQuarterlyReportId)); } } }