| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 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) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                 string licenseTypeId = Request.Params["licenseTypeId"]; | 
					
						
							|  |  |  |  |                 string hseLicenseId = Request.Params["hseLicenseId"]; | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(hseLicenseId)) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                     Model.DriverHse_HseLicense data = BLL.HseLicenseService.GetHseLicenseById(hseLicenseId); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                     if (data != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                         this.hdId.Text = hseLicenseId; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         this.txtCode.Text = data.Code; | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                         if (!string.IsNullOrEmpty(data.LicenseTypeId)) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                             this.txtLicenseTypeName.Text = BLL.TestRunLicenseTypeService.GetLicenseTypeById(data.LicenseTypeId).LicenseTypeName; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         } | 
					
						
							|  |  |  |  |                         this.txtApplyUnit.Text = data.ApplyUnit; | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                         this.txtApplyMan.Text = data.ApplyMan; | 
					
						
							|  |  |  |  |                         this.txtHeaderMan.Text = data.HeaderMan; | 
					
						
							|  |  |  |  |                         this.txtWorkAddress.Text = data.WorkAddress; | 
					
						
							|  |  |  |  |                         this.txtWorkContents.Text = data.WorkContents;                       | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         this.txtRemark.Text = data.Remark; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.txtLicenseTypeName.Text = BLL.TestRunLicenseTypeService.GetLicenseTypeById(licenseTypeId).LicenseTypeName; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 附件上传 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 附件上传 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |         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))); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 保存 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |             string licenseTypeId = Request.Params["licenseTypeId"]; | 
					
						
							|  |  |  |  |             string hseLicenseId = Request.Params["hseLicenseId"]; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             Model.DriverHse_HseLicense newData = new Model.DriverHse_HseLicense(); | 
					
						
							|  |  |  |  |             newData.Code = this.txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.ApplyUnit = this.txtApplyUnit.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |             newData.ApplyMan = this.txtApplyMan.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.HeaderMan = this.txtHeaderMan.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.WorkAddress = this.txtWorkAddress.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.WorkContents = this.txtWorkContents.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             newData.Remark = this.txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |             if (!string.IsNullOrEmpty(hseLicenseId)) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                 newData.HseLicenseId = hseLicenseId; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 BLL.HseLicenseService.UpdateHseLicense(newData); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                 newData.LicenseTypeId = licenseTypeId; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 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 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |