| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using Model; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.JDGL.WBS | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class CostControlEdit : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 加载 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 LoadData(); | 
					
						
							|  |  |  |  |                 string id = Request.Params["Id"]; | 
					
						
							|  |  |  |  |                 string operating = Request.Params["operating"]; | 
					
						
							| 
									
										
										
										
											2023-05-26 10:24:02 +08:00
										 |  |  |  |                 BLL.EquipmentMaterialTypeService.InitEquipmentMaterialTypeDownList(this.drpEquipmentMaterialType,true); | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 if (operating == "add") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(id); | 
					
						
							|  |  |  |  |                     if (costControl != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtCostControlCode.Text = costControl.CostControlCode; | 
					
						
							|  |  |  |  |                         this.txtCostControlName.Text = costControl.CostControlName; | 
					
						
							| 
									
										
										
										
											2023-05-26 10:24:02 +08:00
										 |  |  |  |                         if (!string.IsNullOrEmpty(costControl.EquipmentMaterialTypeId)) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             this.drpEquipmentMaterialType.SelectedValue = costControl.EquipmentMaterialTypeId; | 
					
						
							|  |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                         this.txtUnit.Text = costControl.Unit; | 
					
						
							| 
									
										
										
										
											2021-12-21 16:10:02 +08:00
										 |  |  |  |                         //if (costControl.TotalNum != null) | 
					
						
							|  |  |  |  |                         //{ | 
					
						
							|  |  |  |  |                         //    this.txtTotalNum.Text = costControl.TotalNum.ToString(); | 
					
						
							|  |  |  |  |                         //} | 
					
						
							|  |  |  |  |                         //if (costControl.RealPrice != null) | 
					
						
							|  |  |  |  |                         //{ | 
					
						
							|  |  |  |  |                         //    this.txtRealPrice.Text = costControl.RealPrice.ToString(); | 
					
						
							|  |  |  |  |                         //} | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void LoadData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             btnClose.OnClientClick = ActiveWindow.GetHideReference(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 保存 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string id = Request.Params["Id"]; | 
					
						
							|  |  |  |  |             string code = Request.Params["Code"]; | 
					
						
							|  |  |  |  |             string operating = Request.Params["operating"]; | 
					
						
							| 
									
										
										
										
											2021-09-17 10:51:44 +08:00
										 |  |  |  |             if (operating == "add") | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |             { | 
					
						
							|  |  |  |  |                 Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id); | 
					
						
							|  |  |  |  |                 Model.WBS_CostControl costControl = new WBS_CostControl(); | 
					
						
							|  |  |  |  |                 costControl.CostControlCode = txtCostControlCode.Text.Trim(); | 
					
						
							|  |  |  |  |                 costControl.CostControlName = txtCostControlName.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2023-05-26 10:24:02 +08:00
										 |  |  |  |                 if (this.drpEquipmentMaterialType.SelectedValue != BLL.Const._Null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     costControl.EquipmentMaterialTypeId = this.drpEquipmentMaterialType.SelectedValue; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 costControl.ProjectId = wbsSet.ProjectId; | 
					
						
							|  |  |  |  |                 costControl.WbsSetId = wbsSet.WbsSetId; | 
					
						
							|  |  |  |  |                 costControl.Unit = txtUnit.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2021-12-21 16:10:02 +08:00
										 |  |  |  |                 costControl.IsSelected = true; | 
					
						
							|  |  |  |  |                 //costControl.TotalNum = Funs.GetNewDecimal(txtTotalNum.Text.Trim()); | 
					
						
							|  |  |  |  |                 //costControl.RealPrice = Funs.GetNewDecimal(txtRealPrice.Text.Trim()); | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 BLL.CostControlService.AddCostControl(costControl); | 
					
						
							|  |  |  |  |                 //增加对应关系内容 | 
					
						
							|  |  |  |  |                 Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new WBS_WbsSetMatchCostControl(); | 
					
						
							|  |  |  |  |                 wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID(); | 
					
						
							|  |  |  |  |                 wbsSetMatchCostControl.WbsSetId = id; | 
					
						
							|  |  |  |  |                 wbsSetMatchCostControl.CostControlCode = costControl.CostControlCode; | 
					
						
							|  |  |  |  |                 BLL.WbsSetMatchCostControlService.AddWbsSetMatchCostControl(wbsSetMatchCostControl); | 
					
						
							|  |  |  |  |                 BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.WBSSetMenuId, "增加费用清单项!"); | 
					
						
							|  |  |  |  |                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(id); | 
					
						
							|  |  |  |  |                 if (costControl != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     //更新对应关系内容 | 
					
						
							|  |  |  |  |                     Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = BLL.WbsSetMatchCostControlService.GetWbsSetMatchCostControlByWbsSetIdAndCostControlCode(code, costControl.CostControlCode); | 
					
						
							|  |  |  |  |                     if (wbsSetMatchCostControl != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSetMatchCostControl.WbsSetId = code; | 
					
						
							|  |  |  |  |                         wbsSetMatchCostControl.CostControlCode = txtCostControlCode.Text.Trim(); | 
					
						
							|  |  |  |  |                         BLL.WbsSetMatchCostControlService.UpdateWbsSetMatchCostControl(wbsSetMatchCostControl); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     costControl.CostControlCode = txtCostControlCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     costControl.CostControlName = txtCostControlName.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2023-05-26 10:24:02 +08:00
										 |  |  |  |                     if (this.drpEquipmentMaterialType.SelectedValue != BLL.Const._Null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         costControl.EquipmentMaterialTypeId = this.drpEquipmentMaterialType.SelectedValue; | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     costControl.Unit = txtUnit.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2021-12-21 16:10:02 +08:00
										 |  |  |  |                     //costControl.TotalNum = Funs.GetNewDecimal(txtTotalNum.Text.Trim()); | 
					
						
							|  |  |  |  |                     //costControl.RealPrice = Funs.GetNewDecimal(txtRealPrice.Text.Trim()); | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     BLL.CostControlService.UpdateCostControl(costControl); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.WBSSetMenuId, "修改费用清单项!"); | 
					
						
							|  |  |  |  |                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |