| 
									
										
										
										
											2024-10-12 15:27:37 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Threading.Tasks; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace BLL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public static class ActionWorkLedgerService | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键获取中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ActionWorkLedgerId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static Model.Information_ActionWorkLedger GetActionWorkLedgerById(string ActionWorkLedgerId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.Information_ActionWorkLedger.FirstOrDefault(e => e.ActionWorkLedgerId == ActionWorkLedgerId); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="unitId">单位Id</param> | 
					
						
							|  |  |  |  |         /// <param name="year">年度</param> | 
					
						
							|  |  |  |  |         /// <param name="quarters">季度</param> | 
					
						
							|  |  |  |  |         /// <returns>中央企业安全生产治本攻坚三年行动工作台账</returns> | 
					
						
							|  |  |  |  |         public static Model.Information_ActionWorkLedger GetActionWorkLedgerByUnitIdAndYearAndQuarters(string unitId, int year, int quarters) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.Information_ActionWorkLedger.FirstOrDefault(e => e.UnitId == unitId && e.Quarter == quarters && e.YearId == year); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据单位Id获取安全生产数据季报集合 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="UnitId">单位Id</param> | 
					
						
							|  |  |  |  |         /// <returns>安全生产数据季报集合</returns> | 
					
						
							|  |  |  |  |         public static List<Model.View_Information_ActionWorkLedger> GetActionWorkLedgersByUnitId(string UnitId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return (from x in Funs.DB.View_Information_ActionWorkLedger where x.UnitId == UnitId orderby x.ReportDate descending select x).ToList(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 添加中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ActionWorkLedger"></param> | 
					
						
							|  |  |  |  |         public static void AddActionWorkLedger(Model.Information_ActionWorkLedger ActionWorkLedger) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.Information_ActionWorkLedger newActionWorkLedger = new Model.Information_ActionWorkLedger | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ActionWorkLedgerId = ActionWorkLedger.ActionWorkLedgerId, | 
					
						
							|  |  |  |  |                 UnitId = ActionWorkLedger.UnitId, | 
					
						
							|  |  |  |  |                 ReportDate = ActionWorkLedger.ReportDate, | 
					
						
							|  |  |  |  |                 YearId = ActionWorkLedger.YearId, | 
					
						
							|  |  |  |  |                 Quarter = ActionWorkLedger.Quarter, | 
					
						
							|  |  |  |  |                 CompileMan = ActionWorkLedger.CompileMan, | 
					
						
							|  |  |  |  |                 UpState = ActionWorkLedger.UpState, | 
					
						
							|  |  |  |  |                 HandleState = ActionWorkLedger.HandleState, | 
					
						
							|  |  |  |  |                 HandleMan = ActionWorkLedger.HandleMan | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             Funs.DB.Information_ActionWorkLedger.InsertOnSubmit(newActionWorkLedger); | 
					
						
							|  |  |  |  |             Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 修改中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ActionWorkLedger"></param> | 
					
						
							|  |  |  |  |         public static void UpdateActionWorkLedger(Model.Information_ActionWorkLedger ActionWorkLedger) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.Information_ActionWorkLedger newActionWorkLedger = Funs.DB.Information_ActionWorkLedger.FirstOrDefault(e => e.ActionWorkLedgerId == ActionWorkLedger.ActionWorkLedgerId); | 
					
						
							|  |  |  |  |             if (newActionWorkLedger != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newActionWorkLedger.UnitId = ActionWorkLedger.UnitId; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.ReportDate = ActionWorkLedger.ReportDate; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.YearId = ActionWorkLedger.YearId; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.Quarter = ActionWorkLedger.Quarter; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.UpState = ActionWorkLedger.UpState; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.HandleState = ActionWorkLedger.HandleState; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.HandleMan = ActionWorkLedger.HandleMan; | 
					
						
							| 
									
										
										
										
											2025-07-11 18:07:04 +08:00
										 |  |  |  |                 newActionWorkLedger.KeyWorkNum = ActionWorkLedger.KeyWorkNum; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.KeyWorkOKNum = ActionWorkLedger.KeyWorkOKNum; | 
					
						
							|  |  |  |  |                 newActionWorkLedger.KeyWorkOKRate = ActionWorkLedger.KeyWorkOKRate; | 
					
						
							| 
									
										
										
										
											2024-10-12 15:27:37 +08:00
										 |  |  |  |                 Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键删除中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ActionWorkLedgerId"></param> | 
					
						
							|  |  |  |  |         public static void DeleteActionWorkLedgerById(string ActionWorkLedgerId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.Information_ActionWorkLedger ActionWorkLedger = Funs.DB.Information_ActionWorkLedger.FirstOrDefault(e => e.ActionWorkLedgerId == ActionWorkLedgerId); | 
					
						
							|  |  |  |  |             if (ActionWorkLedger != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.DB.Information_ActionWorkLedger.DeleteOnSubmit(ActionWorkLedger); | 
					
						
							|  |  |  |  |                 Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据单位、季度获取中央企业安全生产治本攻坚三年行动工作台账 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="unitId"></param> | 
					
						
							|  |  |  |  |         /// <param name="quarter"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static Model.Information_ActionWorkLedger GetActionWorkLedgerByUnitIdDate(string unitId, int yearId, int quarter, string ActionWorkLedgerId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.Information_ActionWorkLedger.FirstOrDefault(e => e.UnitId == unitId && e.YearId == yearId && e.Quarter == quarter && ((ActionWorkLedgerId == null && e.ActionWorkLedgerId != null) || e.ActionWorkLedgerId != ActionWorkLedgerId)); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |