/// <summary> /// 根据主键删除费用管理 /// </summary> /// <param name="HSSECostManageId"></param> public static void DeleteHSSECostManageById(string HSSECostManageId) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_HSSECostManage HSSECostManage = db.CostGoods_HSSECostManage.FirstOrDefault(e => e.HSSECostManageId == HSSECostManageId); if (HSSECostManage != null) { CodeRecordsService.DeleteCodeRecordsByDataId(HSSECostManageId); //删除编号 ProjectDataFlowSetService.DeleteFlowSetByDataId(HSSECostManageId); //删除流程 CommonService.DeleteFlowOperateByID(HSSECostManageId); //删除审核流程 CommonService.DeleteAttachFileById(HSSECostManageId); //删除附件 db.CostGoods_HSSECostManage.DeleteOnSubmit(HSSECostManage); db.SubmitChanges(); } }
/// <summary> /// 修改费用管理 /// </summary> /// <param name="hsseCostManage"></param> public static void UpdateHSSECostManage(Model.CostGoods_HSSECostManage hsseCostManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_HSSECostManage newHSSECostManage = db.CostGoods_HSSECostManage.FirstOrDefault(e => e.HSSECostManageId == hsseCostManage.HSSECostManageId); if (newHSSECostManage != null) { //newHSSECostManage.ProjectId = HSSECostManage.ProjectId; newHSSECostManage.Month = hsseCostManage.Month; newHSSECostManage.Code = hsseCostManage.Code; newHSSECostManage.ReportDate = hsseCostManage.ReportDate; newHSSECostManage.MainIncome = hsseCostManage.MainIncome; newHSSECostManage.Remark1 = hsseCostManage.Remark1; newHSSECostManage.ConstructionIncome = hsseCostManage.ConstructionIncome; newHSSECostManage.Remark2 = hsseCostManage.Remark2; newHSSECostManage.SafetyCosts = hsseCostManage.SafetyCosts; newHSSECostManage.Remark3 = hsseCostManage.Remark3; newHSSECostManage.States = hsseCostManage.States; newHSSECostManage.AuditManId = hsseCostManage.AuditManId; db.SubmitChanges(); } }
/// <summary> /// 添加安全费用管理 /// </summary> /// <param name="hsseCostManage"></param> public static void AddHSSECostManage(Model.CostGoods_HSSECostManage hsseCostManage) { Model.SUBHSSEDB db = Funs.DB; Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage { HSSECostManageId = hsseCostManage.HSSECostManageId, ProjectId = hsseCostManage.ProjectId, Month = hsseCostManage.Month, Code = hsseCostManage.Code, ReportDate = hsseCostManage.ReportDate, MainIncome = hsseCostManage.MainIncome, Remark1 = hsseCostManage.Remark1, ConstructionIncome = hsseCostManage.ConstructionIncome, Remark2 = hsseCostManage.Remark2, SafetyCosts = hsseCostManage.SafetyCosts, Remark3 = hsseCostManage.Remark3, CompileDate = hsseCostManage.CompileDate, CompileManId = hsseCostManage.CompileManId, }; db.CostGoods_HSSECostManage.InsertOnSubmit(newHSSECostManage); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectHSSECostManageMenuId, hsseCostManage.ProjectId, null, hsseCostManage.HSSECostManageId, hsseCostManage.Month); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnNew_Click(object sender, EventArgs e) { if (this.drpYear.SelectedValue != BLL.Const._Null && this.drpMonths.SelectedValue != BLL.Const._Null && this.drpUnitId.SelectedValue != BLL.Const._Null && this.drpUnitId.SelectedValue != BLL.Const._Null) { DateTime?Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue); string hsseCostManageId = string.Empty; string unitId = this.drpUnitId.SelectedValue; var hsseCost = BLL.HSSECostManageService.GetHSSECostManageByProjectIdMonth(this.ProjectId, Funs.GetNewIntOrZero(this.drpYear.SelectedValue), Funs.GetNewIntOrZero(this.drpMonths.SelectedValue)); if (hsseCost != null) { hsseCostManageId = hsseCost.HSSECostManageId; } else { hsseCostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostManage)); Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage { HSSECostManageId = hsseCostManageId, ProjectId = this.ProjectId, Month = Months, Code = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectHSSECostManageMenuId, this.ProjectId, string.Empty), ReportDate = System.DateTime.Now, CompileDate = System.DateTime.Now, }; BLL.HSSECostManageService.AddHSSECostManage(newHSSECostManage); } var unitCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostManageIdUnitId(hsseCostManageId, unitId); if (unitCost == null) { string HSSECostUnitManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostUnitManage)); Model.CostGoods_HSSECostUnitManage newHSSECostUnit = new Model.CostGoods_HSSECostUnitManage { HSSECostUnitManageId = HSSECostUnitManageId, HSSECostManageId = hsseCostManageId, UnitId = unitId, StateType = "1", States = "0", CompileManId = this.CurrUser.UserId, CompileDate = DateTime.Now, CostA1 = 0, CostA2 = 0, CostA3 = 0, CostA4 = 0, CostA5 = 0, CostA6 = 0, CostA7 = 0, CostA8 = 0, CostB1 = 0, CostB2 = 0, CostC1 = 0, CostD1 = 0, CostD2 = 0, CostD3 = 0, }; BLL.HSSECostUnitManageService.AddHSSECostUnitManage(newHSSECostUnit); PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HSSECostUnitManageEdit.aspx?HSSECostUnitManageId={0}", HSSECostUnitManageId, "编辑 - "))); } else { Alert.ShowInTop("当月已存在费用表!", MessageBoxIcon.Warning); } } else { Alert.ShowInTop("请选择月份、单位!", MessageBoxIcon.Warning); } }
/// <summary> /// /// </summary> private void SaveData(string type) { ///添加安全费用 DateTime?Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue); Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage { ProjectId = this.ProjectId, Month = Months, Code = this.txtCode.Text, ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text), MainIncome = Funs.GetNewDecimal(this.txtMainIncome.Text), Remark1 = this.txtRemark1.Text, ConstructionIncome = Funs.GetNewDecimal(this.txtConstructionIncome.Text), Remark2 = this.txtRemark2.Text, SafetyCosts = Funs.GetNewDecimal(this.txtSafetyCosts.Text), Remark3 = this.txtRemark3.Text, }; ////单据状态 newHSSECostManage.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { newHSSECostManage.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.HSSECostManageId)) { newHSSECostManage.HSSECostManageId = this.HSSECostManageId; BLL.HSSECostManageService.UpdateHSSECostManage(newHSSECostManage); BLL.LogService.AddSys_Log(this.CurrUser, newHSSECostManage.Code, newHSSECostManage.HSSECostManageId, BLL.Const.ProjectHSSECostManageMenuId, BLL.Const.BtnModify); } else { this.HSSECostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostManage)); newHSSECostManage.HSSECostManageId = this.HSSECostManageId; newHSSECostManage.CompileDate = System.DateTime.Now; newHSSECostManage.CompileManId = this.CurrUser.UserId; BLL.HSSECostManageService.AddHSSECostManage(newHSSECostManage); BLL.LogService.AddSys_Log(this.CurrUser, newHSSECostManage.Code, newHSSECostManage.HSSECostManageId, BLL.Const.ProjectHSSECostManageMenuId, BLL.Const.BtnAdd); } if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue) && this.drpUnitId.SelectedValue != BLL.Const._Null) { var updateItem = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId); if (updateItem != null) { updateItem.HSSECostManageId = this.HSSECostManageId; updateItem.UnitId = this.drpUnitId.SelectedValue; updateItem.EngineeringCost = Funs.GetNewDecimal(this.txtEngineeringCost.Text); updateItem.Remark1 = this.txtRemark1.Text; updateItem.SubUnitCost = Funs.GetNewDecimal(this.txtSubUnitCost.Text); updateItem.Remark2 = this.txtRemark2.Text; updateItem.AuditedSubUnitCost = Funs.GetNewDecimal(this.txtAuditedSubUnitCost.Text); updateItem.Remark3 = this.txtRemark1.Text; updateItem.CostRatio = Funs.GetNewDecimal(this.txtCostRatio.Text); updateItem.Remark4 = this.txtRemark1.Text; BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateItem); } else { ///添加施工单位安全费用 Model.CostGoods_HSSECostUnitManage newHSSECostUnitManage = new Model.CostGoods_HSSECostUnitManage { HSSECostManageId = this.HSSECostManageId, UnitId = this.drpUnitId.SelectedValue, EngineeringCost = Funs.GetNewDecimal(this.txtEngineeringCost.Text), Remark1 = this.txtRemark1.Text, SubUnitCost = Funs.GetNewDecimal(this.txtSubUnitCost.Text), Remark2 = this.txtRemark2.Text, AuditedSubUnitCost = Funs.GetNewDecimal(this.txtAuditedSubUnitCost.Text), Remark3 = this.txtRemark1.Text, CostRatio = Funs.GetNewDecimal(this.txtCostRatio.Text), Remark4 = this.txtRemark1.Text, }; this.HSSECostUnitManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostUnitManage)); newHSSECostUnitManage.HSSECostUnitManageId = this.HSSECostUnitManageId; BLL.HSSECostUnitManageService.AddHSSECostUnitManage(newHSSECostUnitManage); } this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostManageMenuId, this.HSSECostManageId, (type == BLL.Const.BtnSubmit ? true : false), this.drpYear.SelectedText + "年" + this.drpMonths.SelectedText + "月安全费用", "../CostGoods/HSSECostManageView.aspx?HSSECostManageId={0}"); ////判断单据是否 加入到企业管理资料 string menuId = BLL.Const.ProjectHSSECostManageMenuId; var safeData = Funs.DB.SafetyData_SafetyData.FirstOrDefault(x => x.MenuId == menuId); if (safeData != null) { BLL.SafetyDataService.AddSafetyData(menuId, this.HSSECostManageId, this.drpYear.SelectedText + "-" + this.drpMonths.SelectedText + "安全费用", "../CostGoods/HSSECostManageView.aspx?HSSECostManageId={0}", this.ProjectId); } } }