173 lines
		
	
	
		
			7.9 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			173 lines
		
	
	
		
			7.9 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.UI; | |||
|  | using System.Web.UI.WebControls; | |||
|  | using BLL; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.CQMS.WBS | |||
|  | { | |||
|  |     public partial class EditBreakdownProject : PageBase | |||
|  |     { | |||
|  |         #region 定义项 | |||
|  |         /// <summary> | |||
|  |         /// 主键 | |||
|  |         /// </summary> | |||
|  |         public string BreakdownProjectId | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return (string)ViewState["BreakdownProjectId"]; | |||
|  |             } | |||
|  |             set | |||
|  |             { | |||
|  |                 ViewState["BreakdownProjectId"] = value; | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 string divisionProjectId = Request.Params["divisionProjectId"]; | |||
|  |                 BreakdownProjectId = Request.Params["breakdownProjectId"]; | |||
|  |                 Funs.FineUIPleaseSelect(this.drpCheckAcceptType); | |||
|  |                 Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(BreakdownProjectId); | |||
|  |                 var division = BLL.DivisionProjectService.GetDivisionProjectById(divisionProjectId); | |||
|  |                 if (division != null) | |||
|  |                 { | |||
|  |                     if (division.CNProfessionalId != null && Const.CNProfessionalConstructId == division.CNProfessionalId) | |||
|  |                     { | |||
|  |                         this.tr1.Hidden = false; | |||
|  |                         this.tr2.Hidden = false; | |||
|  |                         this.tr3.Hidden = false; | |||
|  |                         this.tr4.Hidden = false; | |||
|  |                         this.txtCheckPoints.Label = "质量记录名称"; | |||
|  |                         this.txtRecordAndCode.Label = "记录格式文本号"; | |||
|  |                     } | |||
|  |                     else | |||
|  |                     { | |||
|  |                         this.tr1.Hidden = true; | |||
|  |                         this.tr2.Hidden = true; | |||
|  |                         this.tr3.Hidden = true; | |||
|  |                         this.tr4.Hidden = true; | |||
|  |                     } | |||
|  |                 } | |||
|  |                 if (Request.Params["type"] == "add") | |||
|  |                 { | |||
|  |                     var list = BLL.BreakdownProjectService.GetBreakdownProjectsByDivisionProjectId(divisionProjectId); | |||
|  |                     this.txtSortIndex.Text = (list.Count() + 1).ToString(); | |||
|  |                 } | |||
|  |                 if (Request.Params["type"] == "modify") | |||
|  |                 { | |||
|  |                     if (breakdownProject != null) | |||
|  |                     { | |||
|  |                         this.txtBreakdownCode.Text = breakdownProject.BreakdownCode; | |||
|  |                         this.txtBreakdownName.Text = breakdownProject.BreakdownName; | |||
|  |                         this.txtBasis.Text = breakdownProject.Basis; | |||
|  |                         this.txtCheckPoints.Text = breakdownProject.CheckPoints; | |||
|  |                         this.txtRecordAndCode.Text = breakdownProject.RecordAndCode; | |||
|  |                         this.txtClass.Text = breakdownProject.Class; | |||
|  |                         this.YeZhu.Text = breakdownProject.YeZhu; | |||
|  |                         this.JianLi.Text = breakdownProject.JianLi; | |||
|  |                         this.WuHuan.Text = breakdownProject.WuHuan; | |||
|  |                         this.FenBao.Text = breakdownProject.FenBao; | |||
|  |                         if (!string.IsNullOrEmpty(breakdownProject.CheckAcceptType)) | |||
|  |                         { | |||
|  |                             this.drpCheckAcceptType.SelectedValue = breakdownProject.CheckAcceptType; | |||
|  |                         } | |||
|  |                         if (breakdownProject.SortIndex != null) | |||
|  |                         { | |||
|  |                             this.txtSortIndex.Text = breakdownProject.SortIndex.ToString(); | |||
|  |                         } | |||
|  |                         this.txtRemark.Text = breakdownProject.Remark; | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 保存 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             string divisionProjectId = Request.Params["divisionProjectId"]; | |||
|  |             Model.WBS_BreakdownProject newBreakdown = new Model.WBS_BreakdownProject(); | |||
|  |             newBreakdown.BreakdownCode = this.txtBreakdownCode.Text.Trim(); | |||
|  |             newBreakdown.BreakdownName = this.txtBreakdownName.Text.Trim(); | |||
|  |             newBreakdown.DivisionProjectId = divisionProjectId; | |||
|  |             newBreakdown.Basis = this.txtBasis.Text.Trim(); | |||
|  |             newBreakdown.CheckPoints = this.txtCheckPoints.Text.Trim(); | |||
|  |             newBreakdown.RecordAndCode = this.txtRecordAndCode.Text.Trim(); | |||
|  |             newBreakdown.Class = this.txtClass.Text.Trim(); | |||
|  |             newBreakdown.FenBao = this.FenBao.Text.Trim(); | |||
|  |             newBreakdown.WuHuan = this.WuHuan.Text.Trim(); | |||
|  |             newBreakdown.JianLi = this.JianLi.Text.Trim(); | |||
|  |             newBreakdown.YeZhu = this.YeZhu.Text.Trim(); | |||
|  |             if (this.drpCheckAcceptType.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 newBreakdown.CheckAcceptType = this.drpCheckAcceptType.SelectedValue; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(this.txtSortIndex.Text.Trim())) | |||
|  |             { | |||
|  |                 try | |||
|  |                 { | |||
|  |                     newBreakdown.SortIndex = Convert.ToInt32(this.txtSortIndex.Text.Trim()); | |||
|  |                 } | |||
|  |                 catch (Exception) | |||
|  |                 { | |||
|  |                     ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('排序只能为整数!')", true); | |||
|  |                     return; | |||
|  |                 } | |||
|  |             } | |||
|  |             newBreakdown.Remark = this.txtRemark.Text.Trim(); | |||
|  |             if (Request.Params["type"] == "add") | |||
|  |             { | |||
|  |                 if (this.rblIsAcceptance.SelectedValue == "True") | |||
|  |                 { | |||
|  |                     newBreakdown.IsAcceptance = true; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     newBreakdown.IsAcceptance = false; | |||
|  |                 } | |||
|  |                 newBreakdown.CompileMan = this.CurrUser.UserId; | |||
|  |                 newBreakdown.CompileDate = DateTime.Now; | |||
|  |                 if (string.IsNullOrEmpty(this.BreakdownProjectId)) | |||
|  |                 { | |||
|  |                     string newKeyID = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | |||
|  |                     newBreakdown.BreakdownProjectId = newKeyID; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     newBreakdown.BreakdownProjectId = this.BreakdownProjectId; | |||
|  |                 } | |||
|  |                 newBreakdown.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |                 BLL.BreakdownProjectService.AddBreakdownProject(newBreakdown); | |||
|  |                 BLL.LogService.AddSys_Log(this.CurrUser, newBreakdown.BreakdownCode, newBreakdown.BreakdownProjectId, BLL.Const.ProjectControlPointMenuId, "添加分项工程信息!"); | |||
|  |             } | |||
|  |             if (Request.Params["type"] == "modify") | |||
|  |             { | |||
|  |                 Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(BreakdownProjectId); | |||
|  |                 newBreakdown.BreakdownProjectId = BreakdownProjectId; | |||
|  |                 newBreakdown.IsSelected = breakdownProject.IsSelected; | |||
|  |                 BLL.BreakdownProjectService.UpdateBreakdownProject(newBreakdown); | |||
|  |                 BLL.LogService.AddSys_Log(this.CurrUser, newBreakdown.BreakdownCode, BreakdownProjectId, BLL.Const.ProjectControlPointMenuId, "修改分项工程信息!"); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  | 
 | |||
|  |         protected void btnAttachUrl_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (string.IsNullOrEmpty(this.BreakdownProjectId)) | |||
|  |             { | |||
|  |                 this.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject)); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/BreakdownProject&menuId={1}&type=0", BreakdownProjectId, BLL.Const.ProjectControlPointMenuId))); | |||
|  |         } | |||
|  |     } | |||
|  | } |