102 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			102 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.UI; | |||
|  | using System.Web.UI.WebControls; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.CQMS.WBS | |||
|  | { | |||
|  |     public partial class ForeignControlPointEdit : PageBase | |||
|  |     { | |||
|  |         #region 加载 | |||
|  |         /// <summary> | |||
|  |         /// 加载 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 string BreakdownId = Request.Params["BreakdownId"]; | |||
|  |                 string CNProfessionalId = Request.Params["CNProfessionalId"]; | |||
|  |                 if (!string.IsNullOrEmpty(BreakdownId)) | |||
|  |                 { | |||
|  |                     var ForeignBreakdown = BLL.ForeignBreakdownService.GetForeignBreakdownById(BreakdownId); | |||
|  |                     if (ForeignBreakdown != null) | |||
|  |                     { | |||
|  |                         this.txtBreakdownCode.Text = ForeignBreakdown.BreakdownCode; | |||
|  |                         this.txtBreakdownName.Text = ForeignBreakdown.BreakdownName; | |||
|  |                         this.txtSortIndex.Text = ForeignBreakdown.SortIndex.HasValue ? ForeignBreakdown.SortIndex.ToString() : ""; | |||
|  |                         this.txtDef.Text = ForeignBreakdown.BreakdownDef; | |||
|  |                         this.txtRemark.Text = ForeignBreakdown.Remark; | |||
|  |                         this.hdBreakdownId.Text = BreakdownId; | |||
|  |                     } | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     var list = BLL.ForeignBreakdownService.GetForeignBreakdownsByCNProfessionalId(CNProfessionalId); | |||
|  |                     this.txtSortIndex.Text = (list.Count() + 1).ToString(); | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 保存 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             string BreakdownId = Request.Params["BreakdownId"]; | |||
|  |             string CNProfessionalId = Request.Params["CNProfessionalId"]; | |||
|  |             Model.WBS_ForeignBreakdown newForeignBreakdown = new Model.WBS_ForeignBreakdown(); | |||
|  |             newForeignBreakdown.CNProfessionalId = CNProfessionalId; | |||
|  |             newForeignBreakdown.BreakdownCode = this.txtBreakdownCode.Text.Trim(); | |||
|  |             newForeignBreakdown.BreakdownName = this.txtBreakdownName.Text.Trim(); | |||
|  |             newForeignBreakdown.BreakdownDef = this.txtDef.Text.Trim(); | |||
|  |             newForeignBreakdown.Remark = this.txtRemark.Text.Trim(); | |||
|  |             newForeignBreakdown.SortIndex = Funs.GetNewInt(this.txtSortIndex.Text.Trim()); | |||
|  |             if (!string.IsNullOrEmpty(BreakdownId)) | |||
|  |             { | |||
|  |                 newForeignBreakdown.BreakdownId = BreakdownId; | |||
|  |                 BLL.ForeignBreakdownService.UpdateForeignBreakdown(newForeignBreakdown); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdBreakdownId.Text.Trim())) | |||
|  |                 { | |||
|  |                     newForeignBreakdown.BreakdownId = this.hdBreakdownId.Text.Trim(); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     newForeignBreakdown.BreakdownId = SQLHelper.GetNewID(typeof(Model.WBS_ForeignBreakdown)); | |||
|  |                 } | |||
|  |                 BLL.ForeignBreakdownService.AddForeignBreakdown(newForeignBreakdown); | |||
|  |             } | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 附件上传 | |||
|  |         /// <summary> | |||
|  |         /// 附件上传 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnAttach_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (string.IsNullOrEmpty(this.hdBreakdownId.Text))   //新增记录 | |||
|  |             { | |||
|  |                 this.hdBreakdownId.Text = SQLHelper.GetNewID(typeof(Model.WBS_ForeignBreakdown)); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/WBS/ForeignControlPoint&menuId={1}", this.hdBreakdownId.Text, BLL.Const.ForeignControlPointMenuId))); | |||
|  |         } | |||
|  |         #endregion | |||
|  |     } | |||
|  | } |