using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public static class DesignInputService { /// /// 根据主键获取矩阵信息 /// /// /// public static Model.Design_Rect_Init GetDesignRectById(int designRectId) { return Funs.DB.Design_Rect_Init.FirstOrDefault(e => e.DesignRectId == designRectId); } /// /// 根据主键获取设计输入信息 /// /// /// public static Model.Design_Input GetDesignInputById(string designInputId) { return Funs.DB.Design_Input.FirstOrDefault(e => e.DesignInputId == designInputId); } public static List GetDesignInputByProject(string projectId) { return Funs.DB.Design_Input.Where(x => x.EProjectId == projectId).ToList(); } /// /// 根据设计提出条件通知单ID获取提出条件通知单 /// /// /// public static Model.Design_Notice GetDesignNotice(string noticeId) { return Funs.DB.Design_Notice.FirstOrDefault(e => e.DesignNoticeId == noticeId); } /// /// 根据设计输入获取提出条件通知单 /// /// /// public static Model.Design_Notice GetDesignNoticeById(string designInputId) { return Funs.DB.Design_Notice.FirstOrDefault(e => e.DesignInputId == designInputId && e.Flag == "1"); } /// /// 输入项是否存在 /// /// /// /// /// public static bool IsExistDesignInput(string eprojectId, int designRectId, string issuedDiscipline, string receivedDiscipline) { bool exist = false; var q = from x in Funs.DB.Design_Input where x.EProjectId == eprojectId && x.DesignRectId == designRectId && x.IssuedDiscipline == issuedDiscipline && x.ReceivedDiscipline == receivedDiscipline select x; if (q.Count() > 0) { exist = true; } return exist; } /// /// 更新是否已二次提醒提出人 /// /// /// public static void DesignInputEmailIsWarn(string designInputId, bool isWarn) { Model.Design_Input update = Funs.DB.Design_Input.FirstOrDefault(e => e.DesignInputId == designInputId); if (update != null) { update.MailIsWarn = isWarn; Funs.DB.SubmitChanges(); } } /// /// 更新是否已二次提醒待办人 /// /// /// public static void NoticeEmailIsWarn(string noticeFlowId, bool isWarn) { Model.Design_NoticeFlow update = Funs.DB.Design_NoticeFlow.FirstOrDefault(e => e.NoticeFlowId == noticeFlowId); if (update != null) { update.MailIsWarn = isWarn; Funs.DB.SubmitChanges(); } } /// /// 更新设计输入邮件发送提醒(项目经理) /// /// /// public static void DesignInputMailSend(string eprojectId, bool isSend) { Model.Editor_EProject newEproject = Funs.DB.Editor_EProject.FirstOrDefault(e => e.EProjectId == eprojectId); if (newEproject != null) { newEproject.DesignInputMailIsSend = isSend; Funs.DB.SubmitChanges(); } } /// /// 更新设计输入策划完成 /// /// /// public static void DesignInputPlanComplete(string eprojectId, bool isComplete) { Model.Editor_EProject newEproject = Funs.DB.Editor_EProject.FirstOrDefault(e => e.EProjectId == eprojectId); if (newEproject != null) { newEproject.DesignPlanIsComplete = isComplete; Funs.DB.SubmitChanges(); } } // 项目设计归档 public static void UpdateProjectFiling(string eprojectId, bool designInputIsFile) { Model.Editor_EProject newEproject = Funs.DB.Editor_EProject.FirstOrDefault(e => e.EProjectId == eprojectId); if (newEproject != null) { newEproject.DesignInputIsFile = designInputIsFile; Funs.DB.SubmitChanges(); } } // 文档确认 public static void UpdateDesignDocumentIsConfirm(string eprojectId, bool designDocumentIsConfirm) { Model.Editor_EProject newEproject = Funs.DB.Editor_EProject.FirstOrDefault(e => e.EProjectId == eprojectId); if (newEproject != null) { newEproject.DesignDocumentIsConfirm = designDocumentIsConfirm; Funs.DB.SubmitChanges(); } } /// /// 增加设计输入 /// /// public static void AddDesignInput(Model.Design_Input input) { Model.Design_Input newInput = new Model.Design_Input(); newInput.DesignInputId = input.DesignInputId; newInput.DesignRectId = input.DesignRectId; newInput.EProjectId = input.EProjectId; newInput.DesignInputChName = input.DesignInputChName; newInput.DesignInputEnName = input.DesignInputEnName; newInput.DesignInputNo = input.DesignInputNo; newInput.IssuedDiscipline = input.IssuedDiscipline; newInput.IssuedDisciplineCode = input.IssuedDisciplineCode; newInput.ReceivedDiscipline = input.ReceivedDiscipline; newInput.ReceivedDisciplineCode = input.ReceivedDisciplineCode; Funs.DB.Design_Input.InsertOnSubmit(newInput); Funs.DB.SubmitChanges(); } /// /// 添加提出条件通知单 /// /// public static void AddDesignNotice(Model.Design_Notice notice) { Model.Design_Notice newNotice = new Model.Design_Notice(); newNotice.DesignNoticeId = notice.DesignNoticeId; newNotice.DesignInputId = notice.DesignInputId; newNotice.DesignStage = notice.DesignStage; newNotice.MutualIssuedNo = notice.MutualIssuedNo; newNotice.MutualIssuedName = notice.MutualIssuedName; newNotice.MutualIssuedDef = notice.MutualIssuedDef; newNotice.PlanMutualIssuedDate = notice.PlanMutualIssuedDate; newNotice.ActMutualIssuedDate = notice.ActMutualIssuedDate; newNotice.IssuedMan = notice.IssuedMan; newNotice.ReceivedMan = notice.ReceivedMan; newNotice.ProjectManagerId = notice.ProjectManagerId; newNotice.IsNeedConfirm = notice.IsNeedConfirm; newNotice.ConfirmResult = notice.ConfirmResult; newNotice.ReceivedManDef = notice.ReceivedManDef; newNotice.Flag = notice.Flag; newNotice.Sup_DesignNoticeId = notice.Sup_DesignNoticeId; Funs.DB.Design_Notice.InsertOnSubmit(newNotice); Funs.DB.SubmitChanges(); } public static void UpdateDesignNotice(Model.Design_Notice notice) { Model.Design_Notice newNotice = Funs.DB.Design_Notice.FirstOrDefault(e => e.DesignNoticeId == notice.DesignNoticeId); if (newNotice != null) { newNotice.DesignInputId = notice.DesignInputId; newNotice.DesignStage = notice.DesignStage; newNotice.MutualIssuedNo = notice.MutualIssuedNo; newNotice.MutualIssuedName = notice.MutualIssuedName; newNotice.MutualIssuedDef = notice.MutualIssuedDef; newNotice.PlanMutualIssuedDate = notice.PlanMutualIssuedDate; newNotice.ActMutualIssuedDate = notice.ActMutualIssuedDate; newNotice.IssuedMan = notice.IssuedMan; newNotice.ReceivedMan = notice.ReceivedMan; newNotice.ProjectManagerId = notice.ProjectManagerId; newNotice.IsNeedConfirm = notice.IsNeedConfirm; newNotice.ConfirmResult = notice.ConfirmResult; newNotice.ReceivedManDef = notice.ReceivedManDef; //newNotice.Flag = notice.Flag; Funs.DB.SubmitChanges(); } } public static void UpdateDesignInputActStartDate(string DesignInputId, DateTime? actStartDate) { Model.Design_Input inputPlan = Funs.DB.Design_Input.FirstOrDefault(e => e.DesignInputId == DesignInputId); if (inputPlan != null) { inputPlan.ActStartDate = actStartDate; Funs.DB.SubmitChanges(); } } /// /// 更新设计输入完成 /// /// /// /// public static void UpdateDesignInputComplete(string DesignInputId, bool isComplet, DateTime? actEndDate) { Model.Design_Input inputPlan = Funs.DB.Design_Input.FirstOrDefault(e => e.DesignInputId == DesignInputId); if (inputPlan != null) { inputPlan.IsComplete = isComplet; inputPlan.ActEndDate = actEndDate; Funs.DB.SubmitChanges(); } } /// /// 更新设计输入策划信息 /// /// /// /// /// /// public static void UpdateDesignInputPlan(string DesignInputId, string issuedMan, string receivedMan, DateTime? planStartDate, DateTime? planEndDate) { Model.Design_Input inputPlan = Funs.DB.Design_Input.FirstOrDefault(e => e.DesignInputId == DesignInputId); if (inputPlan != null) { inputPlan.IssuedMan = issuedMan; inputPlan.ReceivedMan = receivedMan; inputPlan.PlanStartDate = planStartDate; inputPlan.PlanEndDate = planEndDate; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除设计输入信息 /// /// public static void DeleteDesignInputById(string designInputId) { Model.EProjectDB db = Funs.DB; Model.Design_Input input = db.Design_Input.FirstOrDefault(e => e.DesignInputId == designInputId); if (input != null) { var notice = from x in db.Design_Notice where x.DesignInputId == designInputId select x; if (notice.Count() > 0) { db.Design_Notice.DeleteAllOnSubmit(notice); db.SubmitChanges(); } db.Design_Input.DeleteOnSubmit(input); db.SubmitChanges(); } } /// /// 删除一个通知单 /// /// public static void DeleteDesignNoticeById(string designNoticeId) { Model.EProjectDB db = Funs.DB; Model.Design_Notice notice = db.Design_Notice.FirstOrDefault(e => e.DesignNoticeId == designNoticeId); if (notice != null) { var flow = from x in db.Design_NoticeFlow where x.DesignNoticeId == designNoticeId select x; db.Design_NoticeFlow.DeleteAllOnSubmit(flow); db.Design_Notice.DeleteOnSubmit(notice); db.SubmitChanges(); } } public static void UpdateProjectDef(string designNoticeId, string pmDef) { Model.Design_Notice notice = Funs.DB.Design_Notice.FirstOrDefault(e => e.DesignNoticeId == designNoticeId); if (notice != null) { notice.ConfirmResult = pmDef; Funs.DB.SubmitChanges(); } } public static void UpdateReceivedManDef(string designNoticeId, string receivedManDef) { Model.Design_Notice notice = Funs.DB.Design_Notice.FirstOrDefault(e => e.DesignNoticeId == designNoticeId); if (notice != null) { notice.ReceivedManDef = receivedManDef; Funs.DB.SubmitChanges(); } } /// /// 添加通知单流程 /// /// public static void AddNoticeFlow(Model.Design_NoticeFlow flow) { Model.Design_NoticeFlow newFlow = new Model.Design_NoticeFlow(); newFlow.NoticeFlowId = flow.NoticeFlowId; newFlow.DesignNoticeId = flow.DesignNoticeId; newFlow.SubmitStep = flow.SubmitStep; newFlow.SubmitMan = flow.SubmitMan; newFlow.SubmitDate = flow.SubmitDate; newFlow.HandleState = flow.HandleState; newFlow.HandleIdea = flow.HandleIdea; Funs.DB.Design_NoticeFlow.InsertOnSubmit(newFlow); Funs.DB.SubmitChanges(); } /// /// 更新流程信息 /// /// /// /// /// public static void UpdateDesignFlow(string noticeFlowId, string handleState, string handleIdea, DateTime? submitDate) { Model.Design_NoticeFlow flow = Funs.DB.Design_NoticeFlow.FirstOrDefault(e => e.NoticeFlowId == noticeFlowId); if (flow != null) { flow.HandleState = handleState; flow.HandleIdea = handleIdea; flow.SubmitDate = submitDate; Funs.DB.SubmitChanges(); } } /// /// 获取通知单待办理的流程信息 /// /// /// public static Model.Design_NoticeFlow GetNoticeFlow(string designNoticeId) { return Funs.DB.Design_NoticeFlow.FirstOrDefault(e => e.DesignNoticeId == designNoticeId && !e.SubmitDate.HasValue); } } }