| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.ProjectData | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class UnitWorkEdit : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2024-07-29 23:00:57 +08:00
										 |  |  |  |         private static string superId; | 
					
						
							|  |  |  |  |         private static string id; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-29 23:00:57 +08:00
										 |  |  |  |                 superId = Request.Params["SuperId"]; | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                 if (!string.IsNullOrEmpty(superId) && superId != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.txtUnitWorkCode.Hidden = false; | 
					
						
							|  |  |  |  |                     this.txtUnitWorkName.Hidden = false; | 
					
						
							|  |  |  |  |                     Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId); | 
					
						
							|  |  |  |  |                     if (supUnitWork != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtSupUnitWorkCode.Text = supUnitWork.UnitWorkCode; | 
					
						
							|  |  |  |  |                         this.txtSupUnitWorkName.Text = supUnitWork.UnitWorkName; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.txtUnitWorkCode.Hidden = true; | 
					
						
							|  |  |  |  |                     this.txtUnitWorkName.Hidden = true; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2024-07-29 23:00:57 +08:00
										 |  |  |  |                 id = Request.Params["Id"]; | 
					
						
							|  |  |  |  |                 Model.WBS_UnitWork unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(id); | 
					
						
							|  |  |  |  |                 if (unitWork != null) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                     if (unitWork.SuperUnitWork == "0") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtUnitWorkCode.Hidden = true; | 
					
						
							|  |  |  |  |                         this.txtUnitWorkName.Hidden = true; | 
					
						
							|  |  |  |  |                         this.txtSupUnitWorkCode.Text = unitWork.UnitWorkCode; | 
					
						
							|  |  |  |  |                         this.txtSupUnitWorkName.Text = unitWork.UnitWorkName; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtUnitWorkCode.Hidden = false; | 
					
						
							|  |  |  |  |                         this.txtUnitWorkName.Hidden = false; | 
					
						
							|  |  |  |  |                         Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(unitWork.SuperUnitWork); | 
					
						
							|  |  |  |  |                         if (supUnitWork != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             this.txtSupUnitWorkCode.Text = supUnitWork.UnitWorkCode; | 
					
						
							|  |  |  |  |                             this.txtSupUnitWorkName.Text = supUnitWork.UnitWorkName; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         this.txtUnitWorkCode.Text = unitWork.UnitWorkCode; | 
					
						
							|  |  |  |  |                         this.txtUnitWorkName.Text = unitWork.UnitWorkName; | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |             if (!string.IsNullOrEmpty(superId) && superId != null) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                 Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId); | 
					
						
							|  |  |  |  |                 if (supUnitWork != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork(); | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkCode = this.txtUnitWorkCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkName = this.txtUnitWorkName.Text.Trim(); | 
					
						
							|  |  |  |  |                     newUnitWork.SuperUnitWork = superId; | 
					
						
							|  |  |  |  |                     newUnitWork.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newUnitWork.UnitWorkId = id; | 
					
						
							|  |  |  |  |                         BLL.UnitWorkService.UpdateUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                         BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改子单位工程!"); | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)); | 
					
						
							|  |  |  |  |                         BLL.UnitWorkService.AddUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                         BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加子单位工程!"); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork(); | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkCode = this.txtSupUnitWorkCode.Text.Trim(); | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkName = this.txtSupUnitWorkName.Text.Trim(); | 
					
						
							|  |  |  |  |                     newUnitWork.SuperUnitWork = "0"; | 
					
						
							|  |  |  |  |                     newUnitWork.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newUnitWork.UnitWorkId = id; | 
					
						
							|  |  |  |  |                         BLL.UnitWorkService.UpdateUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                         BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改单位工程!"); | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                         var divisionProject = Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.UnitWorkId == newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                         if (divisionProject == null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             #region  拷贝WBS内容 | 
					
						
							|  |  |  |  |                             //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                             var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null select x; | 
					
						
							|  |  |  |  |                             foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                                 newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                                 newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                                 newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.SubItemType = d1.SubItemType; | 
					
						
							|  |  |  |  |                                 BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                                 List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                                 if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							|  |  |  |  |                                     this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                                 } | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             //拷贝分项 | 
					
						
							|  |  |  |  |                             var breakdowns = from x in Funs.DB.WBS_Breakdown select x; | 
					
						
							|  |  |  |  |                             foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                                 bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                                 bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                                 bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                                 bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                                 bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                                 bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                                 bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                                 bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                                 bp.Class = b.Class; | 
					
						
							|  |  |  |  |                                 bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                                 bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                                 bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                                 bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                                 bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                                 bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                                 bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                                 bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                                 bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                                 bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                                 bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  |                                 bp.CheckAcceptType = b.CheckAcceptType; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                 BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             #endregion | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             #region  拷贝建筑工程WBS内容 | 
					
						
							|  |  |  |  |                             //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                             var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null && x.CNProfessionalId == BLL.Const.CNProfessionalConstructId select x; | 
					
						
							|  |  |  |  |                             foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                                 newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                                 newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                                 newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                                 newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                                 newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                                 BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                                 List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                                 if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							|  |  |  |  |                                     this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                                 } | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             //拷贝分项 | 
					
						
							|  |  |  |  |                             var breakdowns = from x in Funs.DB.WBS_Breakdown | 
					
						
							|  |  |  |  |                                              join y in Funs.DB.WBS_Division on x.DivisionId equals y.DivisionId | 
					
						
							|  |  |  |  |                                              where y.CNProfessionalId == BLL.Const.CNProfessionalConstructId | 
					
						
							|  |  |  |  |                                              select x; | 
					
						
							|  |  |  |  |                             foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                                 bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                                 bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                                 bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                                 bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                                 bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                                 bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                                 bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                                 bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                                 bp.Class = b.Class; | 
					
						
							|  |  |  |  |                                 bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                                 bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                                 bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                                 bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                                 bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                                 bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                                 bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                                 bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                                 bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                                 bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                                 bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                                 BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             #endregion | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         Model.DataBase_DataTypeProject dp = Funs.DB.DataBase_DataTypeProject.FirstOrDefault(x => x.UnitWorkId == newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                         if (dp == null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             #region  拷贝资料库内容 | 
					
						
							|  |  |  |  |                             Model.DataBase_DataTypeProject dataTypeProject = BLL.DataTypeProjectService.GetDataTypeProjectBySourceDataTypeId(Const.DataTypeNewConstructId, this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                             List<Model.DataBase_DataType> childDataTypes = BLL.DataTypeService.GetDataTypesBySuperDataTypeId(Const.DataTypeNewConstructId); | 
					
						
							|  |  |  |  |                             if (childDataTypes.Count > 0) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 if (dataTypeProject != null) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							|  |  |  |  |                                     InsertDataTypeDetail(childDataTypes, dataTypeProject.DataTypeProjectId, this.CurrUser.LoginProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                                 } | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             #endregion | 
					
						
							|  |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)); | 
					
						
							|  |  |  |  |                         BLL.UnitWorkService.AddUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                         BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!"); | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  |                         #region  拷贝WBS内容 | 
					
						
							|  |  |  |  |                         //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                         var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null select x; | 
					
						
							|  |  |  |  |                         foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                             newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                             newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                             newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                             newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                             newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                             BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                             List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                             if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         //拷贝分项 | 
					
						
							|  |  |  |  |                         var breakdowns = from x in Funs.DB.WBS_Breakdown select x; | 
					
						
							|  |  |  |  |                         foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                             bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                             bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                             bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                             bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                             bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                             bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                             bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                             bp.Class = b.Class; | 
					
						
							|  |  |  |  |                             bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                             bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                             bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                             bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                             bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                             bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                             bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                             bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                             bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                             bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         #endregion | 
					
						
							|  |  |  |  |                         #region  拷贝资料库内容 | 
					
						
							|  |  |  |  |                         Model.DataBase_DataTypeProject dataTypeProject = BLL.DataTypeProjectService.GetDataTypeProjectBySourceDataTypeId(Const.DataTypeNewConstructId, this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                         List<Model.DataBase_DataType> childDataTypes = BLL.DataTypeService.GetDataTypesBySuperDataTypeId(Const.DataTypeNewConstructId); | 
					
						
							|  |  |  |  |                         if (childDataTypes.Count > 0) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             if (dataTypeProject != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 InsertDataTypeDetail(childDataTypes, dataTypeProject.DataTypeProjectId, this.CurrUser.LoginProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         #endregion | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |             else | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                 Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork(); | 
					
						
							|  |  |  |  |                 newUnitWork.UnitWorkCode = this.txtSupUnitWorkCode.Text.Trim(); | 
					
						
							|  |  |  |  |                 newUnitWork.UnitWorkName = this.txtSupUnitWorkName.Text.Trim(); | 
					
						
							|  |  |  |  |                 newUnitWork.SuperUnitWork = "0"; | 
					
						
							|  |  |  |  |                 newUnitWork.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkId = id; | 
					
						
							|  |  |  |  |                     BLL.UnitWorkService.UpdateUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                     BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改单位工程!"); | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                     var divisionProject = Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.UnitWorkId == newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                     if (divisionProject == null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         #region  拷贝WBS内容 | 
					
						
							|  |  |  |  |                         //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                         var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null select x; | 
					
						
							|  |  |  |  |                         foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                             newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                             newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                             newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                             newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                             newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                             newDivisionProject.SubItemType = d1.SubItemType; | 
					
						
							|  |  |  |  |                             BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                             List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                             if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         //拷贝分项 | 
					
						
							|  |  |  |  |                         var breakdowns = from x in Funs.DB.WBS_Breakdown select x; | 
					
						
							|  |  |  |  |                         foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                             bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                             bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                             bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                             bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                             bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                             bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                             bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                             bp.Class = b.Class; | 
					
						
							|  |  |  |  |                             bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                             bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                             bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                             bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                             bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                             bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                             bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                             bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                             bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                             bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  |                             bp.CheckAcceptType = b.CheckAcceptType; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         #endregion | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         #region  拷贝建筑工程WBS内容 | 
					
						
							|  |  |  |  |                         //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                         var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null && x.CNProfessionalId == BLL.Const.CNProfessionalConstructId select x; | 
					
						
							|  |  |  |  |                         foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                             newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                             newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                             newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                             newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                             newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                             newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                             BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                             List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                             if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         //拷贝分项 | 
					
						
							|  |  |  |  |                         var breakdowns = from x in Funs.DB.WBS_Breakdown | 
					
						
							|  |  |  |  |                                          join y in Funs.DB.WBS_Division on x.DivisionId equals y.DivisionId | 
					
						
							|  |  |  |  |                                          where y.CNProfessionalId == BLL.Const.CNProfessionalConstructId | 
					
						
							|  |  |  |  |                                          select x; | 
					
						
							|  |  |  |  |                         foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                             bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                             bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                             bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                             bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                             bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                             bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                             bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                             bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                             bp.Class = b.Class; | 
					
						
							|  |  |  |  |                             bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                             bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                             bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                             bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                             bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                             bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                             bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                             bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                             bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                             bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                             bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         #endregion | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     Model.DataBase_DataTypeProject dp = Funs.DB.DataBase_DataTypeProject.FirstOrDefault(x => x.UnitWorkId == newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                     if (dp == null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         #region  拷贝资料库内容 | 
					
						
							|  |  |  |  |                         Model.DataBase_DataTypeProject dataTypeProject = BLL.DataTypeProjectService.GetDataTypeProjectBySourceDataTypeId(Const.DataTypeNewConstructId, this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                         List<Model.DataBase_DataType> childDataTypes = BLL.DataTypeService.GetDataTypesBySuperDataTypeId(Const.DataTypeNewConstructId); | 
					
						
							|  |  |  |  |                         if (childDataTypes.Count > 0) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             if (dataTypeProject != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 InsertDataTypeDetail(childDataTypes, dataTypeProject.DataTypeProjectId, this.CurrUser.LoginProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         #endregion | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)); | 
					
						
							|  |  |  |  |                     BLL.UnitWorkService.AddUnitWork(newUnitWork); | 
					
						
							|  |  |  |  |                     BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!"); | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  |                     #region  拷贝WBS内容 | 
					
						
							|  |  |  |  |                     //拷贝分部及子分部 | 
					
						
							|  |  |  |  |                     var divisions1 = from x in Funs.DB.WBS_Division where x.SuperDivisionId == null select x; | 
					
						
							|  |  |  |  |                     foreach (var d1 in divisions1) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                         newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                         newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                         newDivisionProject.DivisionCode = d1.DivisionCode; | 
					
						
							|  |  |  |  |                         newDivisionProject.DivisionName = d1.DivisionName; | 
					
						
							|  |  |  |  |                         newDivisionProject.SortIndex = d1.SortIndex; | 
					
						
							|  |  |  |  |                         newDivisionProject.SuperDivisionId = d1.SuperDivisionId; | 
					
						
							|  |  |  |  |                         newDivisionProject.CNProfessionalId = d1.CNProfessionalId; | 
					
						
							|  |  |  |  |                         newDivisionProject.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                         newDivisionProject.OldDivisionId = d1.DivisionId; | 
					
						
							|  |  |  |  |                         BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //分部 | 
					
						
							|  |  |  |  |                         List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d1.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                         if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     //拷贝分项 | 
					
						
							|  |  |  |  |                     var breakdowns = from x in Funs.DB.WBS_Breakdown select x; | 
					
						
							|  |  |  |  |                     foreach (var b in breakdowns) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject(); | 
					
						
							|  |  |  |  |                         bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | 
					
						
							|  |  |  |  |                         bp.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                         bp.BreakdownCode = b.BreakdownCode; | 
					
						
							|  |  |  |  |                         bp.BreakdownName = b.BreakdownName; | 
					
						
							|  |  |  |  |                         bp.DivisionProjectId = (from x in Funs.DB.WBS_DivisionProject where x.OldDivisionId == b.DivisionId && x.UnitWorkId == newUnitWork.UnitWorkId select x.DivisionProjectId).FirstOrDefault(); | 
					
						
							|  |  |  |  |                         bp.Basis = b.Basis; | 
					
						
							|  |  |  |  |                         bp.CheckPoints = b.CheckPoints; | 
					
						
							|  |  |  |  |                         bp.RecordAndCode = b.RecordAndCode; | 
					
						
							|  |  |  |  |                         bp.Class = b.Class; | 
					
						
							|  |  |  |  |                         bp.SortIndex = b.SortIndex; | 
					
						
							|  |  |  |  |                         bp.Remark = b.Remark; | 
					
						
							|  |  |  |  |                         bp.ModelURL = b.ModelURL; | 
					
						
							|  |  |  |  |                         bp.UnitWorkId = newUnitWork.UnitWorkId; | 
					
						
							|  |  |  |  |                         bp.IsAcceptance = b.IsAcceptance; | 
					
						
							|  |  |  |  |                         bp.IsYellow = b.IsYellow; | 
					
						
							|  |  |  |  |                         bp.WuHuan = b.WuHuan; | 
					
						
							|  |  |  |  |                         bp.JianLi = b.JianLi; | 
					
						
							|  |  |  |  |                         bp.FenBao = b.FenBao; | 
					
						
							|  |  |  |  |                         bp.YeZhu = b.YeZhu; | 
					
						
							|  |  |  |  |                         bp.SourceBreakdownId = b.BreakdownId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         BLL.BreakdownProjectService.AddBreakdownProject(bp); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     #endregion | 
					
						
							|  |  |  |  |                     #region  拷贝资料库内容 | 
					
						
							|  |  |  |  |                     Model.DataBase_DataTypeProject dataTypeProject = BLL.DataTypeProjectService.GetDataTypeProjectBySourceDataTypeId(Const.DataTypeNewConstructId, this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                     List<Model.DataBase_DataType> childDataTypes = BLL.DataTypeService.GetDataTypesBySuperDataTypeId(Const.DataTypeNewConstructId); | 
					
						
							|  |  |  |  |                     if (childDataTypes.Count > 0) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         if (dataTypeProject != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             InsertDataTypeDetail(childDataTypes, dataTypeProject.DataTypeProjectId, this.CurrUser.LoginProjectId, newUnitWork.UnitWorkId); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     #endregion | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 循环拷贝子级分部 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="dataTypes"></param> | 
					
						
							|  |  |  |  |         private void InsertDivisionDetail(List<Model.WBS_Division> divisions, string superDivisionId, string unitWorkId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             foreach (var d in divisions) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject(); | 
					
						
							|  |  |  |  |                 newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject)); | 
					
						
							|  |  |  |  |                 newDivisionProject.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |                 newDivisionProject.DivisionCode = d.DivisionCode; | 
					
						
							|  |  |  |  |                 newDivisionProject.DivisionName = d.DivisionName; | 
					
						
							|  |  |  |  |                 newDivisionProject.SortIndex = d.SortIndex; | 
					
						
							|  |  |  |  |                 newDivisionProject.SuperDivisionId = superDivisionId; | 
					
						
							|  |  |  |  |                 newDivisionProject.CNProfessionalId = d.CNProfessionalId; | 
					
						
							|  |  |  |  |                 newDivisionProject.UnitWorkId = unitWorkId; | 
					
						
							|  |  |  |  |                 newDivisionProject.OldDivisionId = d.DivisionId; | 
					
						
							|  |  |  |  |                 newDivisionProject.SubItemType = d.SubItemType; | 
					
						
							|  |  |  |  |                 BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);        //子级分部 | 
					
						
							|  |  |  |  |                 List<Model.WBS_Division> divisions2 = (from x in Funs.DB.WBS_Division where x.SuperDivisionId == d.DivisionId select x).ToList(); | 
					
						
							|  |  |  |  |                 if (divisions2.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, unitWorkId); | 
					
						
							| 
									
										
										
										
											2024-08-05 16:16:22 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-08-13 15:07:54 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 循环拷贝子级类别 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="dataTypes"></param> | 
					
						
							|  |  |  |  |         private void InsertDataTypeDetail(List<Model.DataBase_DataType> dataTypes, string superDataTypeId, string projectId, string unitWorkId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             foreach (var d in dataTypes) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 Model.DataBase_DataTypeProject newDataTypeProject = new Model.DataBase_DataTypeProject(); | 
					
						
							|  |  |  |  |                 newDataTypeProject.DataTypeProjectId = SQLHelper.GetNewID(typeof(Model.DataBase_DataTypeProject)); | 
					
						
							|  |  |  |  |                 newDataTypeProject.ProjectId = projectId; | 
					
						
							|  |  |  |  |                 newDataTypeProject.DataTypeCode = d.DataTypeCode; | 
					
						
							|  |  |  |  |                 newDataTypeProject.DataTypeName = d.DataTypeName; | 
					
						
							|  |  |  |  |                 newDataTypeProject.SuperDataTypeId = superDataTypeId; | 
					
						
							|  |  |  |  |                 newDataTypeProject.SortIndex = d.SortIndex; | 
					
						
							|  |  |  |  |                 newDataTypeProject.Pages = d.Pages; | 
					
						
							|  |  |  |  |                 newDataTypeProject.Remark = d.Remark; | 
					
						
							|  |  |  |  |                 newDataTypeProject.IsRelatedWBS = d.IsRelatedWBS; | 
					
						
							|  |  |  |  |                 newDataTypeProject.SourceDataTypeId = d.DataTypeId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 newDataTypeProject.UnitWorkId = unitWorkId; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 BLL.DataTypeProjectService.AddDataTypeProject(newDataTypeProject); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 List<Model.DataBase_DataType> childDataTypes = BLL.DataTypeService.GetDataTypesBySuperDataTypeId(d.DataTypeId); | 
					
						
							|  |  |  |  |                 if (childDataTypes.Count > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     InsertDataTypeDetail(childDataTypes, newDataTypeProject.DataTypeProjectId, projectId, unitWorkId); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |