87 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			87 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using System; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.TestRun.DriverPrepare | |||
|  | { | |||
|  |     public partial class DriverDataEdit :PageBase | |||
|  |     { | |||
|  |         #region 加载 | |||
|  |         /// <summary> | |||
|  |         /// 页面加载 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 string id = Request.Params["driverDataId"]; | |||
|  |                 if (!string.IsNullOrEmpty(id)) | |||
|  |                 { | |||
|  |                     Model.DriverPrepare_DriverData driverData = BLL.DriverPrepareDriverDataService.GetDriverDataById(id); | |||
|  |                     if (driverData!=null) | |||
|  |                     { | |||
|  |                         this.hdId.Text = id; | |||
|  |                         this.txtCode.Text = driverData.Code; | |||
|  |                         this.txtDriverDataName.Text = driverData.DriverDataName; | |||
|  |                         this.txtRemark.Text = driverData.Remark; | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #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.DriverPrepare_DriverData)); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverPrepare/DriverData&menuId={1}", this.hdId.Text, BLL.Const.DriverDataMenuId))); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 保存 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             string id = Request.Params["driverDataId"]; | |||
|  |             Model.DriverPrepare_DriverData newDriverData = new Model.DriverPrepare_DriverData(); | |||
|  |             newDriverData.Code = this.txtCode.Text.Trim(); | |||
|  |             newDriverData.DriverDataName = this.txtDriverDataName.Text.Trim(); | |||
|  |             newDriverData.Remark = this.txtRemark.Text.Trim(); | |||
|  |             newDriverData.ProjectId = this.CurrUser.LoginProjectId; | |||
|  |             if (!string.IsNullOrEmpty(id)) | |||
|  |             { | |||
|  |                 newDriverData.DriverDataId = id; | |||
|  |                 BLL.DriverPrepareDriverDataService.UpdateDriverPrepareDriverData(newDriverData); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdId.Text)) | |||
|  |                 { | |||
|  |                     newDriverData.DriverDataId = this.hdId.Text.Trim(); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     newDriverData.DriverDataId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_DriverData)); | |||
|  |                     this.hdId.Text = newDriverData.DriverDataId; | |||
|  |                 } | |||
|  |                 BLL.DriverPrepareDriverDataService.AddDriverPrepareDriverData(newDriverData); | |||
|  |             } | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  |         #endregion | |||
|  |     } | |||
|  | } |