using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 实施计划总结 /// public static class ActionPlanSummaryService { /// /// 根据主键获取实施计划 /// /// /// public static Model.ActionPlan_ActionPlanSummary GetActionPlanSummaryById(string ActionPlanSummaryId) { return Funs.DB.ActionPlan_ActionPlanSummary.FirstOrDefault(e => e.ActionPlanSummaryId == ActionPlanSummaryId); } /// /// 根据日期获取实施计划集合 /// /// 开始时间 /// 结束时间 /// 项目号 /// 实施计划集合 public static List GetActionPlanSummarysByDate(DateTime startTime, DateTime endTime, string projectId) { return (from x in Funs.DB.ActionPlan_ActionPlanSummary where x.CompileDate >= startTime && x.CompileDate <= endTime && x.ProjectId == projectId orderby x.CompileDate select x).ToList(); } /// /// 添加实施计划 /// /// public static void AddActionPlanSummary(Model.ActionPlan_ActionPlanSummary ActionPlanSummary) { Model.ActionPlan_ActionPlanSummary newActionPlanSummary = new Model.ActionPlan_ActionPlanSummary { ActionPlanSummaryId = ActionPlanSummary.ActionPlanSummaryId, ProjectId = ActionPlanSummary.ProjectId, UnitId = ActionPlanSummary.UnitId, Code = ActionPlanSummary.Code, Name = ActionPlanSummary.Name, Contents = ActionPlanSummary.Contents, CompileMan = ActionPlanSummary.CompileMan, CompileDate = ActionPlanSummary.CompileDate, States = ActionPlanSummary.States }; Funs.DB.ActionPlan_ActionPlanSummary.InsertOnSubmit(newActionPlanSummary); Funs.DB.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectActionPlanSummaryMenuId, newActionPlanSummary.ProjectId, null, newActionPlanSummary.ActionPlanSummaryId, newActionPlanSummary.CompileDate); } /// /// 修改实施计划 /// /// public static void UpdateActionPlanSummary(Model.ActionPlan_ActionPlanSummary ActionPlanSummary) { Model.ActionPlan_ActionPlanSummary newActionPlanSummary = Funs.DB.ActionPlan_ActionPlanSummary.FirstOrDefault(e => e.ActionPlanSummaryId == ActionPlanSummary.ActionPlanSummaryId); if (newActionPlanSummary != null) { newActionPlanSummary.UnitId = ActionPlanSummary.UnitId; newActionPlanSummary.Code = ActionPlanSummary.Code; newActionPlanSummary.Name = ActionPlanSummary.Name; newActionPlanSummary.Contents = ActionPlanSummary.Contents; newActionPlanSummary.CompileMan = ActionPlanSummary.CompileMan; newActionPlanSummary.CompileDate = ActionPlanSummary.CompileDate; newActionPlanSummary.States = ActionPlanSummary.States; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除实施计划 /// /// public static void DeleteActionPlanSummaryById(string ActionPlanSummaryId) { Model.ActionPlan_ActionPlanSummary ActionPlanSummary = Funs.DB.ActionPlan_ActionPlanSummary.FirstOrDefault(e => e.ActionPlanSummaryId == ActionPlanSummaryId); if (ActionPlanSummary != null) { BLL.CommonService.DeleteAttachFileById(ActionPlanSummaryId); ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(ActionPlanSummary.ActionPlanSummaryId); ////删除编码表记录 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(ActionPlanSummary.ActionPlanSummaryId); Funs.DB.ActionPlan_ActionPlanSummary.DeleteOnSubmit(ActionPlanSummary); Funs.DB.SubmitChanges(); } } } }