using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.WebControls; namespace BLL { public class WorkOrderFinalService { /// /// 根据方案审查Id删除一个方案审查信息 /// /// 方案审查Id public static void DeleteWorkOrder(string WorkOrderFinalId) { Model.SGGLDB db = Funs.DB; Model.CQMS_WorkOrder_Final visaApplication_Final = db.CQMS_WorkOrder_Final.First(e => e.WorkOrderFinalId == WorkOrderFinalId); db.CQMS_WorkOrder_Final.DeleteOnSubmit(visaApplication_Final); db.SubmitChanges(); } /// /// 增加方案审查信息 /// /// 方案审查实体 public static void AddWorkOrder(Model.CQMS_WorkOrder_Final constructSolution) { Model.SGGLDB db = Funs.DB; Model.CQMS_WorkOrder_Final newConstructSolution = new Model.CQMS_WorkOrder_Final(); newConstructSolution.WorkOrderFinalId = constructSolution.WorkOrderFinalId; newConstructSolution.ProjectId = constructSolution.ProjectId; newConstructSolution.UnitId = constructSolution.UnitId; newConstructSolution.CompileMan = constructSolution.CompileMan; newConstructSolution.State = constructSolution.State; newConstructSolution.CompileDate = constructSolution.CompileDate; db.CQMS_WorkOrder_Final.InsertOnSubmit(newConstructSolution); db.SubmitChanges(); } /// /// 修改方案审查信息 /// /// 方案审查实体 public static void UpdateWorkOrder(Model.CQMS_WorkOrder_Final constructSolution) { Model.SGGLDB db = Funs.DB; Model.CQMS_WorkOrder_Final newConstructSolution = db.CQMS_WorkOrder_Final.FirstOrDefault(e => e.WorkOrderFinalId == constructSolution.WorkOrderFinalId); if (newConstructSolution == null) { AddWorkOrder(constructSolution); } else { newConstructSolution.ProjectId = constructSolution.ProjectId; newConstructSolution.UnitId = constructSolution.UnitId; newConstructSolution.CompileMan = constructSolution.CompileMan; newConstructSolution.State = constructSolution.State; newConstructSolution.CompileDate = constructSolution.CompileDate; db.SubmitChanges(); } } /// /// 把状态转换代号为文字形式 /// /// /// /// public static string ConvertState(object state) { if (state != null) { if (state.ToString() == BLL.Const.CQMSConstructSolution_ReCompile) { return "重报"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Compile) { return "编制"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Audit) { return "会签"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Complete) { return "审批完成"; } } return ""; } /// /// 根据方案审查Id获取一个方案审查信息 /// /// 方案审查Id /// 一个方案审查实体 public static Model.CQMS_WorkOrder_Final GetWorkOrderById(string WorkOrderFinalId) { return Funs.DB.CQMS_WorkOrder_Final.FirstOrDefault(x => x.WorkOrderFinalId == WorkOrderFinalId); } } }