97 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using Model;
 | |
| using System;
 | |
| using System.Linq;
 | |
| 
 | |
| namespace FineUIPro.Web.JDGL.WBS
 | |
| {
 | |
|     public partial class CostControlInitEdit : 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"];
 | |
|                 if (operating == "add")
 | |
|                 {
 | |
| 
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     Model.WBS_CostControlInit costControl = BLL.CostControlInitService.GetCostControlInitByCostControlInitId(id);
 | |
|                     if (costControl != null)
 | |
|                     {
 | |
|                         this.txtCostControlInitCode.Text = costControl.CostControlInitCode;
 | |
|                         this.txtCostControlInitName.Text = costControl.CostControlInitName;
 | |
|                         this.txtUnit.Text = costControl.Unit;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         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"];
 | |
|             if (operating == "add")
 | |
|             {
 | |
|                 Model.WBS_CostControlInit costControl = new WBS_CostControlInit();
 | |
|                 costControl.CostControlInitCode = txtCostControlInitCode.Text.Trim();
 | |
|                 costControl.CostControlInitName = txtCostControlInitName.Text.Trim();
 | |
|                 costControl.Unit = txtUnit.Text.Trim();
 | |
|                 BLL.CostControlInitService.AddCostControlInit(costControl);
 | |
|                 //增加对应关系内容
 | |
|                 Model.WBS_WbsSetMatchCostControlInit wbsSetMatchCostControlInit = new WBS_WbsSetMatchCostControlInit();
 | |
|                 wbsSetMatchCostControlInit.WbsSetMatchCostControlInitId = SQLHelper.GetNewID();
 | |
|                 wbsSetMatchCostControlInit.WbsSetCode = id;
 | |
|                 wbsSetMatchCostControlInit.CostControlInitCode = costControl.CostControlInitCode;
 | |
|                 BLL.WbsSetMatchCostControlInitService.AddWbsSetMatchCostControlInit(wbsSetMatchCostControlInit);
 | |
|                 BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.WBSSetMenuId, "增加费用清单项!");
 | |
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 Model.WBS_CostControlInit costControl = BLL.CostControlInitService.GetCostControlInitByCostControlInitId(id);
 | |
|                 if (costControl != null)
 | |
|                 {
 | |
|                     //更新对应关系内容
 | |
|                     Model.WBS_WbsSetMatchCostControlInit wbsSetMatchCostControlInit = BLL.WbsSetMatchCostControlInitService.GetWbsSetMatchCostControlInitByWbsSetCodeAndCostControlInitCode(code, costControl.CostControlInitCode);
 | |
|                     if (wbsSetMatchCostControlInit != null)
 | |
|                     {
 | |
|                         wbsSetMatchCostControlInit.WbsSetCode = code;
 | |
|                         wbsSetMatchCostControlInit.CostControlInitCode = txtCostControlInitCode.Text.Trim();
 | |
|                         BLL.WbsSetMatchCostControlInitService.UpdateWbsSetMatchCostControlInit(wbsSetMatchCostControlInit);
 | |
|                     }
 | |
|                     costControl.CostControlInitCode = txtCostControlInitCode.Text.Trim();
 | |
|                     costControl.CostControlInitName = txtCostControlInitName.Text.Trim();
 | |
|                     costControl.Unit = txtUnit.Text.Trim();
 | |
|                     BLL.CostControlInitService.UpdateCostControlInit(costControl);
 | |
|                 }
 | |
|                 BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.WBSSetMenuId, "修改费用清单项!");
 | |
|                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |