277 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			277 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using Newtonsoft.Json.Linq;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Linq;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.JDGL.Progress
 | |
| {
 | |
|     public partial class WbsManager : PageBase
 | |
|     {
 | |
|         #region 页面加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 GetButtonPower();
 | |
|                 InitTreeMenu();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private void InitTreeMenu() { 
 | |
|             
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 树节点展开
 | |
|         /// <summary>
 | |
|         /// 树节点展开
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e) { 
 | |
|             
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region   Tree点击事件
 | |
|         /// <summary>
 | |
|         /// Tree点击事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
 | |
|         {
 | |
|             
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region  关闭窗口
 | |
|         /// <summary>
 | |
|         /// 关闭窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|           
 | |
|             //getWBSSet();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 关闭窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window2_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             ShowNotify("拷贝成功!", MessageBoxIcon.Success);
 | |
|            
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 关闭窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window3_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
| 
 | |
|            
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存事件
 | |
|         /// <summary>
 | |
|         /// 保存
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (Grid1.Rows.Count > 0)
 | |
|             {
 | |
|                 JArray mergedData = Grid1.GetMergedData();
 | |
| 
 | |
|                 bool isPass = true;
 | |
|                 if (isPass)
 | |
|                 {
 | |
|                     foreach (var item in this.Grid1.SelectedRowIDArray)
 | |
|                     {
 | |
|                         Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(item);
 | |
| 
 | |
|                     }
 | |
| 
 | |
|                     foreach (JObject mergedRow in mergedData)
 | |
|                     {
 | |
|                         JObject values = mergedRow.Value<JObject>("values");
 | |
|                         string costControlId = values.Value<string>("CostControlId");
 | |
|                         //string totalNum = values.Value<string>("TotalNum");
 | |
|                         //string realPrice = values.Value<string>("RealPrice");
 | |
|                         //string planPrice = values.Value<string>("PlanPrice");
 | |
|                         Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
 | |
|                         if (this.Grid1.SelectedRowIDArray.Contains(costControlId))
 | |
|                         {
 | |
|                             costControl.IsSelected = true;
 | |
|                         }
 | |
|                         else
 | |
|                         {
 | |
|                             costControl.IsSelected = false;
 | |
|                         }
 | |
|                         BLL.CostControlService.UpdateCostControl(costControl);
 | |
|                     }
 | |
|                 }
 | |
|                 BindGrid();
 | |
|             }
 | |
|             Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 绑定数据
 | |
| 
 | |
|         private string upStartDate = string.Empty;
 | |
|         private string upEndDate = string.Empty;
 | |
|         protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
 | |
|         {
 | |
|             string id = e.RowID;
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 绑定数据
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Grid1_FilterChange(object sender, EventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | |
|         {
 | |
|             Grid1.PageIndex = e.NewPageIndex;
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Grid1排序
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | |
|         {
 | |
|             Grid1.SortDirection = e.SortDirection;
 | |
|             Grid1.SortField = e.SortField;
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 分页下拉选择事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 加载Grid
 | |
|         /// </summary>
 | |
|         private void BindGrid()
 | |
|         {
 | |
|             
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 获取按钮权限
 | |
|         /// <summary>
 | |
|         /// 获取按钮权限
 | |
|         /// </summary>
 | |
|         /// <param name="button"></param>
 | |
|         /// <returns></returns>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             if (Request.Params["value"] == "0")
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetAuditMenuId);
 | |
|             if (buttonList.Count() > 0)
 | |
|             {
 | |
|                 if (buttonList.Contains(BLL.Const.BtnAdd))
 | |
|                 {
 | |
|                     
 | |
|                     this.btnAdd.Hidden = false;
 | |
|                     //this.btnMenuDetail.Hidden = false;
 | |
|                     //this.btnMenuWeekDetail.Hidden = false;
 | |
|                     //this.btnMenuCopy2.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnModify))
 | |
|                 {
 | |
|                     this.btnMenuModify.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnSave))
 | |
|                 {
 | |
|                     this.btnSave.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnDelete))
 | |
|                 {
 | |
|                     this.btnMenuDel.Hidden = false;
 | |
|                 }
 | |
|                 //if (buttonList.Contains(BLL.Const.BtnAuditing))
 | |
|                 //{
 | |
|                 //    this.btnMenuAudit.Hidden = false;
 | |
|                 //}
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 增加费用项
 | |
|         /// <summary>
 | |
|         /// 增加费控项
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAdd_Click(object sender, EventArgs e) {
 | |
|             if (!string.IsNullOrEmpty(trWBS.SelectedNodeID))
 | |
|             {
 | |
|                 this.hdSelectId.Text = this.trWBS.SelectedNodeID;
 | |
|                 Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
 | |
|                 if (wbsSet != null)
 | |
|                 {
 | |
|                     var list = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(this.trWBS.SelectedNodeID);
 | |
|                     if (list.Count == 0)
 | |
|                     {
 | |
|                         string openUrl = String.Format("CostControlEdit.aspx?operating=add&Id={0}", trWBS.SelectedNodeID, "增加 - ");
 | |
|                         PageContext.RegisterStartupScript(Window3.GetShowReference(openUrl));
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         ShowNotify("请选择工作项节点进行增加!", MessageBoxIcon.Warning);
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     ShowNotify("请选择工作项节点进行增加!", MessageBoxIcon.Warning);
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |