| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.JDGL.WBS | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class WBSSetAuditEdit : 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 type = Request.Params["Type"]; | 
					
						
							|  |  |  |  |                 string oper = Request.Params["oper"]; | 
					
						
							|  |  |  |  |                 if (oper == "add")   //增加 | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (type == "cnProfession") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.WBS_CnProfession cnProfession = BLL.CnProfessionService.GetCnProfessionByCnProfessionId(id); | 
					
						
							|  |  |  |  |                         if (cnProfession != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", cnProfession.StartDate); | 
					
						
							|  |  |  |  |                             txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", cnProfession.EndDate); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     else if (type == "unitProject") | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.Wbs_UnitProject unitProject = BLL.UnitProjectService.GetUnitProjectByUnitProjectId(id); | 
					
						
							|  |  |  |  |                         if (unitProject != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                             txtCode.Text = GetNewCode(unitProject.UnitProjectCode, 0, "wbsSet"); | 
					
						
							| 
									
										
										
										
											2022-04-20 17:24:24 +08:00
										 |  |  |  |                             //this.txtCode.Readonly = true; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                             if (unitProject.StartDate != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", unitProject.StartDate); | 
					
						
							|  |  |  |  |                                 txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", unitProject.EndDate); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else if (type == "wbsSet") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id); | 
					
						
							|  |  |  |  |                         if (wbsSet != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                             txtCode.Text = GetNewCode(wbsSet.WbsSetCode, 0, "wbsSet"); | 
					
						
							| 
									
										
										
										
											2022-04-20 17:24:24 +08:00
										 |  |  |  |                             //this.txtCode.Readonly = true; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                             if (wbsSet.StartDate != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", wbsSet.StartDate); | 
					
						
							|  |  |  |  |                                 txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", wbsSet.EndDate); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else    //修改 | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     if (type == "unitProject") | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.Wbs_UnitProject unitProject = BLL.UnitProjectService.GetUnitProjectByUnitProjectId(id); | 
					
						
							|  |  |  |  |                         if (unitProject != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             txtCode.Text = unitProject.UnitProjectCode; | 
					
						
							|  |  |  |  |                             txtName.Text = unitProject.UnitProjectName; | 
					
						
							|  |  |  |  |                             if (unitProject.StartDate != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", unitProject.StartDate); | 
					
						
							|  |  |  |  |                                 txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", unitProject.EndDate); | 
					
						
							|  |  |  |  |                             } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                             if (unitProject.SortIndex != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtSortIndex.Text = unitProject.SortIndex.ToString(); | 
					
						
							|  |  |  |  |                             } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                             txtRemark.Text = unitProject.Remark; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else if (type == "wbsSet") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id); | 
					
						
							|  |  |  |  |                         if (wbsSet != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             txtCode.Text = wbsSet.WbsSetCode; | 
					
						
							|  |  |  |  |                             txtName.Text = wbsSet.WbsSetName; | 
					
						
							|  |  |  |  |                             if (wbsSet.StartDate != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", wbsSet.StartDate); | 
					
						
							|  |  |  |  |                                 txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", wbsSet.EndDate); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             txtRemark.Text = wbsSet.Remark; | 
					
						
							|  |  |  |  |                             if (BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(id).Count == 0)  //末级节点 | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 this.trWbsSet2.Hidden = false; | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                                 if (wbsSet.Weights != null) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							|  |  |  |  |                                     txtWeights.Text = wbsSet.Weights.ToString(); | 
					
						
							|  |  |  |  |                                 } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else if (type == "cnProfession") | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                         //this.trUnit.Hidden = false; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         Model.WBS_CnProfession cnProfession = BLL.CnProfessionService.GetCnProfessionByCnProfessionId(id); | 
					
						
							|  |  |  |  |                         if (cnProfession != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             txtCode.Text = cnProfession.CnProfessionCode; | 
					
						
							|  |  |  |  |                             txtName.Text = cnProfession.CnProfessionName; | 
					
						
							|  |  |  |  |                             if (cnProfession.StartDate != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", cnProfession.StartDate); | 
					
						
							|  |  |  |  |                                 txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", cnProfession.EndDate); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             this.trSortIndex.Hidden = true; | 
					
						
							|  |  |  |  |                             this.txtRemark.Hidden = true; | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                             //this.drpUnit.DataTextField = "UnitName"; | 
					
						
							|  |  |  |  |                             //this.drpUnit.DataValueField = "UnitId"; | 
					
						
							|  |  |  |  |                             //this.drpUnit.DataSource = BLL.UnitService.GetUnitByProjectIdList(cnProfession.ProjectId); | 
					
						
							|  |  |  |  |                             //this.drpUnit.DataBind(); | 
					
						
							|  |  |  |  |                             //Funs.FineUIPleaseSelect(this.drpUnit); | 
					
						
							|  |  |  |  |                             //if (!string.IsNullOrEmpty(cnProfession.UnitId)) | 
					
						
							|  |  |  |  |                             //{ | 
					
						
							|  |  |  |  |                             //    this.drpUnit.SelectedValue = cnProfession.UnitId; | 
					
						
							|  |  |  |  |                             //} | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |         #region 获取编号 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取编号 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="code"></param> | 
					
						
							|  |  |  |  |         /// <param name="i"></param> | 
					
						
							|  |  |  |  |         /// <param name="type"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         private string GetNewCode(string code, int i, string type) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string newCode = string.Empty; | 
					
						
							|  |  |  |  |             string testCode = string.Empty; | 
					
						
							|  |  |  |  |             string istr = string.Empty; | 
					
						
							|  |  |  |  |             i++; | 
					
						
							|  |  |  |  |             if (i < 10) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 istr = "0" + i.ToString(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 istr = i.ToString(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             testCode = string.Empty; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             testCode = code + istr; | 
					
						
							|  |  |  |  |             if (BLL.WbsSetService.GetWbsSetByWbsSetCode(testCode, this.CurrUser.LoginProjectId) == null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newCode = testCode; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 do | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     i++; | 
					
						
							|  |  |  |  |                     if (i < 10) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         istr = "0" + i.ToString(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         istr = i.ToString(); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     testCode = code + istr; | 
					
						
							|  |  |  |  |                 } while (BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(testCode) != null); | 
					
						
							|  |  |  |  |                 newCode = testCode; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return newCode; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +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 type = Request.Params["Type"]; | 
					
						
							|  |  |  |  |             string oper = Request.Params["oper"]; | 
					
						
							|  |  |  |  |             if (oper == "add")   //增加 | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string newId = string.Empty; | 
					
						
							|  |  |  |  |                 if (type == "cnProfession") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.WBS_CnProfession cnProfession = BLL.CnProfessionService.GetCnProfessionByCnProfessionId(id); | 
					
						
							|  |  |  |  |                     Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject(); | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject)); | 
					
						
							|  |  |  |  |                     newId = unitProject.UnitProjectId; | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.SuperUnitProjectId = null; | 
					
						
							|  |  |  |  |                     if (cnProfession != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         unitProject.ProjectId = cnProfession.ProjectId; | 
					
						
							|  |  |  |  |                         unitProject.InstallationId = cnProfession.InstallationId; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     unitProject.CnProfessionId = id; | 
					
						
							|  |  |  |  |                     unitProject.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     unitProject.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     unitProject.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.IsSelected = true; | 
					
						
							|  |  |  |  |                     unitProject.IsApprove = true; | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         unitProject.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     BLL.UnitProjectService.AddUnitProject(unitProject); | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 else if (type == "unitProject") | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Wbs_UnitProject unitProject = BLL.UnitProjectService.GetUnitProjectByUnitProjectId(id); | 
					
						
							|  |  |  |  |                     Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet(); | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet)); | 
					
						
							|  |  |  |  |                     newId = wbsSet.WbsSetId; | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                     if (unitProject != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.InstallationId = unitProject.InstallationId; | 
					
						
							|  |  |  |  |                         wbsSet.CnProfessionId = unitProject.CnProfessionId; | 
					
						
							|  |  |  |  |                         wbsSet.ProjectId = unitProject.ProjectId; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     wbsSet.UnitProjectId = id; | 
					
						
							|  |  |  |  |                     wbsSet.SuperWbsSetId = null; | 
					
						
							|  |  |  |  |                     wbsSet.Flag = 1; | 
					
						
							|  |  |  |  |                     wbsSet.IsSelected = true; | 
					
						
							|  |  |  |  |                     wbsSet.IsApprove = true; | 
					
						
							|  |  |  |  |                     wbsSet.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     wbsSet.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     wbsSet.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     if (!string.IsNullOrEmpty(this.txtWeights.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.Weights = Funs.GetNewDecimal(this.txtWeights.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                     BLL.WbsSetService.AddWbsSet(wbsSet); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (type == "wbsSet") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Wbs_WbsSet oldWbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id); | 
					
						
							|  |  |  |  |                     Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet(); | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet)); | 
					
						
							|  |  |  |  |                     newId = wbsSet.WbsSetId; | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     wbsSet.WbsSetName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                     if (oldWbsSet != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.InstallationId = oldWbsSet.InstallationId; | 
					
						
							|  |  |  |  |                         wbsSet.CnProfessionId = oldWbsSet.CnProfessionId; | 
					
						
							|  |  |  |  |                         wbsSet.ProjectId = oldWbsSet.ProjectId; | 
					
						
							|  |  |  |  |                         wbsSet.UnitProjectId = oldWbsSet.UnitProjectId; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     wbsSet.SuperWbsSetId = id; | 
					
						
							|  |  |  |  |                     wbsSet.Flag = (oldWbsSet.Flag ?? 0) + 1; | 
					
						
							|  |  |  |  |                     wbsSet.IsSelected = true; | 
					
						
							|  |  |  |  |                     wbsSet.IsApprove = true; | 
					
						
							|  |  |  |  |                     wbsSet.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     wbsSet.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     wbsSet.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                     if (!string.IsNullOrEmpty(this.txtWeights.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.Weights = Funs.GetNewDecimal(this.txtWeights.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                     BLL.WbsSetService.AddWbsSet(wbsSet); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (type == "installation") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id); | 
					
						
							|  |  |  |  |                     Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject(); | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject)); | 
					
						
							|  |  |  |  |                     newId = unitProject.UnitProjectId; | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.UnitProjectName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.SuperUnitProjectId = null; | 
					
						
							|  |  |  |  |                     if (installation != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         unitProject.ProjectId = installation.ProjectId; | 
					
						
							|  |  |  |  |                         unitProject.InstallationId = installation.InstallationId; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     unitProject.CnProfessionId = null; | 
					
						
							|  |  |  |  |                     unitProject.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     unitProject.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                     unitProject.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                     unitProject.IsSelected = true; | 
					
						
							|  |  |  |  |                     unitProject.IsApprove = true; | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         unitProject.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     BLL.UnitProjectService.AddUnitProject(unitProject); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newId) | 
					
						
							|  |  |  |  |                    + ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else    //修改 | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 if (type == "unitProject") | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Wbs_UnitProject unitProject = BLL.UnitProjectService.GetUnitProjectByUnitProjectId(id); | 
					
						
							|  |  |  |  |                     if (unitProject != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         unitProject.UnitProjectCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                         unitProject.UnitProjectName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                         unitProject.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         unitProject.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         unitProject.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                         if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             unitProject.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         BLL.UnitProjectService.UpdateUnitProject(unitProject); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (type == "wbsSet") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id); | 
					
						
							|  |  |  |  |                     if (wbsSet != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         wbsSet.WbsSetCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                         wbsSet.WbsSetName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                         wbsSet.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         wbsSet.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         wbsSet.Remark = txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                         if (!string.IsNullOrEmpty(txtSortIndex.Text.Trim())) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             wbsSet.SortIndex = Convert.ToInt32(txtSortIndex.Text.Trim()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                         if (!string.IsNullOrEmpty(this.txtWeights.Text.Trim())) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             wbsSet.Weights = Funs.GetNewDecimal(this.txtWeights.Text.Trim()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         BLL.WbsSetService.UpdateWbsSet(wbsSet); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (type == "cnProfession") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.WBS_CnProfession cnProfession = BLL.CnProfessionService.GetCnProfessionByCnProfessionId(id); | 
					
						
							|  |  |  |  |                     if (cnProfession != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         cnProfession.CnProfessionCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                         cnProfession.CnProfessionName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                         cnProfession.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         cnProfession.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                         //if (this.drpUnit.SelectedValue != BLL.Const._Null) | 
					
						
							|  |  |  |  |                         //{ | 
					
						
							|  |  |  |  |                         //    cnProfession.UnitId = this.drpUnit.SelectedValue; | 
					
						
							|  |  |  |  |                         //} | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         BLL.CnProfessionService.UpdateCnProfession(cnProfession); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else if (type == "installation") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id); | 
					
						
							|  |  |  |  |                     if (installation != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         installation.InstallationCode = txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |                         installation.InstallationName = txtName.Text.Trim(); | 
					
						
							|  |  |  |  |                         installation.StartDate = Convert.ToDateTime(txtStartDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         installation.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim()); | 
					
						
							|  |  |  |  |                         installation.Def = this.txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |                         if (this.drpUnit.SelectedValue != BLL.Const._Null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             installation.UnitId = this.drpUnit.SelectedValue; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         BLL.Project_InstallationService.UpdateInstallation(installation); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 //BLL.LogService.AddSys_Log(this.CurrUser, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改单位、分部、分项工程"); | 
					
						
							|  |  |  |  |                 PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |