/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { if (!BLL.CommonService.IsMainUnitOrAdmin(this.CurrUser.UserId) && type == BLL.Const.BtnSubmit && this.ctlAuditFlow.NextStep == BLL.Const.State_2) { Alert.ShowInParent("分包商不能关闭审核流程", MessageBoxIcon.Warning); return; } Model.CostGoods_CostManage costManage = new Model.CostGoods_CostManage { ProjectId = this.ProjectId, CostManageCode = this.txtCostManageCode.Text.Trim(), CostManageName = this.txtCostManageName.Text.Trim() }; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { costManage.UnitId = this.drpUnitId.SelectedValue; } costManage.ContractNum = this.txtContractNum.Text.Trim(); costManage.CostManageDate = Funs.GetNewDateTime(this.txtCostManageDate.Text.Trim()); costManage.Opinion = this.txtOpinion.Text.Trim(); costManage.SubHSE = this.txtSubHSE.Text.Trim(); costManage.SubCN = this.txtSubCN.Text.Trim(); costManage.SubProject = this.txtSubProject.Text.Trim(); costManage.CompileMan = this.CurrUser.UserId; costManage.CompileDate = DateTime.Now; costManage.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { costManage.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.CostManageId)) { costManage.CostManageId = this.CostManageId; BLL.CostManageService.UpdateCostManage(costManage); BLL.LogService.AddSys_Log(this.CurrUser, costManage.CostManageCode, costManage.CostManageId, BLL.Const.ProjectCostManageMenuId, BLL.Const.BtnModify); } else { this.CostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_CostManage)); costManage.CostManageId = this.CostManageId; BLL.CostManageService.AddCostManage(costManage); BLL.LogService.AddSys_Log(this.CurrUser, costManage.CostManageCode, costManage.CostManageId, BLL.Const.ProjectCostManageMenuId, BLL.Const.BtnAdd); } jerqueSaveMonthPlanList(); BLL.CostManageItemService.DeleteCostManageItemByCostManageId(this.CostManageId); foreach (var costManageItem in costManageItems) { costManageItem.CostManageId = this.CostManageId; BLL.CostManageItemService.AddCostManageItem(costManageItem); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCostManageMenuId, this.CostManageId, (type == BLL.Const.BtnSubmit ? true : false), costManage.CostManageName, "../CostGoods/CostManageView.aspx?CostManageId={0}"); }
/// <summary> /// 根据主键删除费用管理 /// </summary> /// <param name="costManageId"></param> public static void DeleteCostManageById(string costManageId) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_CostManage costManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManageId); if (costManage != null) { CodeRecordsService.DeleteCodeRecordsByDataId(costManageId); //删除编号 ProjectDataFlowSetService.DeleteFlowSetByDataId(costManageId); //删除流程 CommonService.DeleteFlowOperateByID(costManageId); //删除审核流程 CommonService.DeleteAttachFileById(costManageId); //删除附件 db.CostGoods_CostManage.DeleteOnSubmit(costManage); db.SubmitChanges(); } }
/// <summary> /// 修改费用管理 /// </summary> /// <param name="costManage"></param> public static void UpdateCostManage(Model.CostGoods_CostManage costManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_CostManage newCostManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManage.CostManageId); if (newCostManage != null) { //newCostManage.ProjectId = costManage.ProjectId; newCostManage.CostManageCode = costManage.CostManageCode; newCostManage.CostManageName = costManage.CostManageName; newCostManage.UnitId = costManage.UnitId; newCostManage.ContractNum = costManage.ContractNum; newCostManage.CostManageDate = costManage.CostManageDate; newCostManage.Opinion = costManage.Opinion; newCostManage.SubCN = costManage.SubCN; newCostManage.SubHSE = costManage.SubHSE; newCostManage.SubProject = costManage.SubProject; newCostManage.States = costManage.States; newCostManage.CompileMan = costManage.CompileMan; newCostManage.CompileDate = costManage.CompileDate; db.SubmitChanges(); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.CostManageId = Request.Params["CostManageId"]; if (!string.IsNullOrEmpty(this.CostManageId)) { Model.CostGoods_CostManage costManage = BLL.CostManageService.GetCostManageById(this.CostManageId); if (costManage != null) { this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostManageId); this.txtCostManageName.Text = costManage.CostManageName; if (!string.IsNullOrEmpty(costManage.UnitId)) { var unit = BLL.UnitService.GetUnitByUnitId(costManage.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } this.txtContractNum.Text = costManage.ContractNum; if (costManage.CostManageDate != null) { this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate); } this.txtOpinion.Text = costManage.Opinion; this.txtSubHSE.Text = costManage.SubHSE; this.txtSubCN.Text = costManage.SubCN; this.txtSubProject.Text = costManage.SubProject; } BindGrid(); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostManageMenuId; this.ctlAuditFlow.DataId = this.CostManageId; } }
/// <summary> /// 添加安全费用管理 /// </summary> /// <param name="costManage"></param> public static void AddCostManage(Model.CostGoods_CostManage costManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_CostManage newCostManage = new Model.CostGoods_CostManage { CostManageId = costManage.CostManageId, ProjectId = costManage.ProjectId, CostManageCode = costManage.CostManageCode, CostManageName = costManage.CostManageName, UnitId = costManage.UnitId, ContractNum = costManage.ContractNum, CostManageDate = costManage.CostManageDate, Opinion = costManage.Opinion, SubCN = costManage.SubCN, SubHSE = costManage.SubHSE, SubProject = costManage.SubProject, States = costManage.States, CompileMan = costManage.CompileMan, CompileDate = costManage.CompileDate }; db.CostGoods_CostManage.InsertOnSubmit(newCostManage); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectCostManageMenuId, costManage.ProjectId, null, costManage.CostManageId, costManage.CompileDate); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.InitDropDownList(); this.CostManageId = Request.Params["CostManageId"]; this.drpInvestCostProject.DataTextField = "Text"; this.drpInvestCostProject.DataValueField = "Value"; this.drpInvestCostProject.DataSource = BLL.CostManageItemService.GetInvestCostProjectList(); this.drpInvestCostProject.DataBind(); if (!BLL.CommonService.IsMainUnitOrAdmin(this.CurrUser.UserId)) //分包单位用户,隐藏审核列 { this.Grid1.Columns[7].Hidden = true; this.Grid1.Columns[8].Hidden = true; this.Grid1.Columns[9].Hidden = true; } this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now); if (!string.IsNullOrEmpty(this.CostManageId)) { Model.CostGoods_CostManage costManage = BLL.CostManageService.GetCostManageById(this.CostManageId); if (costManage != null) { this.ProjectId = costManage.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostManageId); this.txtCostManageName.Text = costManage.CostManageName; if (!string.IsNullOrEmpty(costManage.UnitId)) { this.drpUnitId.SelectedValue = costManage.UnitId; } this.txtContractNum.Text = costManage.ContractNum; this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate); this.txtOpinion.Text = costManage.Opinion; this.txtSubHSE.Text = costManage.SubHSE; this.txtSubCN.Text = costManage.SubCN; this.txtSubProject.Text = costManage.SubProject; } BindGrid(); } else { this.txtCostManageCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCostManageMenuId, this.ProjectId, this.CurrUser.UserId); this.txtCostManageName.Text = "分包商HSE措施费申请表"; } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostManageMenuId; this.ctlAuditFlow.DataId = this.CostManageId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } else { if (GetRequestEventArgument() == "UPDATE_SUMMARY") { jerqueSaveMonthPlanList(); this.Grid1.DataSource = costManageItems; this.Grid1.DataBind(); // 页面要求重新计算合计行的值 OutputSummaryData(); } } }