106 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.DriverHse
 | |
| {
 | |
|     public partial class HseLicenseEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 string licenseTypeId = Request.Params["licenseTypeId"];
 | |
|                 string hseLicenseId = Request.Params["hseLicenseId"];
 | |
|                 if (!string.IsNullOrEmpty(hseLicenseId))
 | |
|                 {
 | |
|                     Model.DriverHse_HseLicense data = BLL.HseLicenseService.GetHseLicenseById(hseLicenseId);
 | |
|                     if (data != null)
 | |
|                     {
 | |
|                         this.hdId.Text = hseLicenseId;
 | |
|                         this.txtCode.Text = data.Code;
 | |
|                         if (!string.IsNullOrEmpty(data.LicenseTypeId))
 | |
|                         {
 | |
|                             this.txtLicenseTypeName.Text = BLL.TestRunLicenseTypeService.GetLicenseTypeById(data.LicenseTypeId).LicenseTypeName;
 | |
|                         }
 | |
|                         this.txtApplyUnit.Text = data.ApplyUnit;
 | |
|                         this.txtApplyMan.Text = data.ApplyMan;
 | |
|                         this.txtHeaderMan.Text = data.HeaderMan;
 | |
|                         this.txtWorkAddress.Text = data.WorkAddress;
 | |
|                         this.txtWorkContents.Text = data.WorkContents;                      
 | |
|                         this.txtRemark.Text = data.Remark;
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.txtLicenseTypeName.Text = BLL.TestRunLicenseTypeService.GetLicenseTypeById(licenseTypeId).LicenseTypeName;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #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_HseLicense));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverHse/HseLicense&menuId={1}", this.hdId.Text, BLL.Const.HseLicenseMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string licenseTypeId = Request.Params["licenseTypeId"];
 | |
|             string hseLicenseId = Request.Params["hseLicenseId"];
 | |
|             Model.DriverHse_HseLicense newData = new Model.DriverHse_HseLicense();
 | |
|             newData.Code = this.txtCode.Text.Trim();
 | |
|             newData.ApplyUnit = this.txtApplyUnit.Text.Trim();
 | |
|             newData.ApplyMan = this.txtApplyMan.Text.Trim();
 | |
|             newData.HeaderMan = this.txtHeaderMan.Text.Trim();
 | |
|             newData.WorkAddress = this.txtWorkAddress.Text.Trim();
 | |
|             newData.WorkContents = this.txtWorkContents.Text.Trim();
 | |
|             newData.Remark = this.txtRemark.Text.Trim();
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (!string.IsNullOrEmpty(hseLicenseId))
 | |
|             {
 | |
|                 newData.HseLicenseId = hseLicenseId;
 | |
|                 BLL.HseLicenseService.UpdateHseLicense(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 newData.LicenseTypeId = licenseTypeId;
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newData.HseLicenseId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.HseLicenseId = SQLHelper.GetNewID(typeof(Model.DriverHse_HseLicense));
 | |
|                     this.hdId.Text = newData.HseLicenseId;
 | |
|                 }
 | |
|                 BLL.HseLicenseService.AddHseLicense(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |