109 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.DriverHse
 | |
| {
 | |
|     public partial class HseMeasureEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
 | |
| 
 | |
|                 string id = Request.Params["id"];
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.DriverHse_HseMeasure data = BLL.HseMeasureService.GetHseMeasureById(id);
 | |
|                     if (data != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         this.txtHseMeasureName.Text = data.HseMeasureName;
 | |
|                         this.txtHseMeasureCode.Text = data.HseMeasureCode;
 | |
|                         if (!string.IsNullOrEmpty(data.CompileMan))
 | |
|                         {
 | |
|                             this.drpCompileMan.SelectedValue = data.CompileMan;
 | |
|                         }
 | |
|                         this.txtAuditMan.Text = data.AuditMan;
 | |
|                         this.txtApproveMan.Text = data.ApproveMan;
 | |
|                         this.txtApproveDate.Text = data.ApproveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.ApproveDate) : "";
 | |
|                         this.txtIimplementation.Text = data.Iimplementation;
 | |
|                         this.txtRemark.Text = data.Remark;
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 附件上传
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverHse_HseMeasure));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverHse/HseMeasure&menuId={1}", this.hdId.Text, BLL.Const.HseMeasureMenuId)));
 | |
|         }
 | |
|         #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"];
 | |
|             Model.DriverHse_HseMeasure newData = new Model.DriverHse_HseMeasure();
 | |
|             newData.HseMeasureName = this.txtHseMeasureName.Text.Trim();
 | |
|             newData.HseMeasureCode = this.txtHseMeasureCode.Text.Trim();
 | |
|             if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
 | |
|             {
 | |
|                 newData.CompileMan = this.drpCompileMan.SelectedValue;
 | |
|             }
 | |
|             newData.AuditMan = this.txtAuditMan.Text.Trim();
 | |
|             newData.ApproveMan = this.txtApproveMan.Text.Trim();
 | |
|             newData.ApproveDate = Funs.GetNewDateTime(this.txtApproveDate.Text.Trim());
 | |
|             newData.Iimplementation = this.txtIimplementation.Text.Trim();
 | |
|             newData.Remark = this.txtRemark.Text.Trim();
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newData.HseMeasureId = id;
 | |
|                 BLL.HseMeasureService.UpdateHseMeasure(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newData.HseMeasureId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.HseMeasureId = SQLHelper.GetNewID(typeof(Model.DriverHse_HseMeasure));
 | |
|                     this.hdId.Text = newData.HseMeasureId;
 | |
|                 }
 | |
|                 BLL.HseMeasureService.AddHseMeasure(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |