| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.TestRun.DriverHse | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class HseHazardEdit : 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
										 |  |  |  |                 //BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                 string id = Request.Params["id"]; | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.DriverHse_HseHazard data = BLL.HseHazardService.GetHseHazardById(id); | 
					
						
							|  |  |  |  |                     if (data != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.hdId.Text = id; | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                         this.txtCode.Text = data.Code;                        | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         this.txtWorkArea.Text = data.WorkArea; | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |                         this.txtIdentificationDate.Text = data.IdentificationDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.IdentificationDate) : ""; | 
					
						
							|  |  |  |  |                         this.txtControlHeaderMan.Text = data.ControlHeaderMan; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                         this.txtRemark.Text = data.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.DriverHse_HseHazard)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverHse/HseHazard&menuId={1}", this.hdId.Text, BLL.Const.HseHazardMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #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_HseHazard newData = new Model.DriverHse_HseHazard(); | 
					
						
							|  |  |  |  |             newData.Code = this.txtCode.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.WorkArea = this.txtWorkArea.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2024-03-05 09:52:53 +08:00
										 |  |  |  |             newData.IdentificationDate =Funs.GetNewDateTime(this.txtIdentificationDate.Text.Trim()); | 
					
						
							|  |  |  |  |             newData.ControlHeaderMan = this.txtControlHeaderMan.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             newData.Remark = this.txtRemark.Text.Trim(); | 
					
						
							|  |  |  |  |             newData.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newData.HseHazardId = id; | 
					
						
							|  |  |  |  |                 BLL.HseHazardService.UpdateHseHazard(newData); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.hdId.Text)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newData.HseHazardId = this.hdId.Text.Trim(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newData.HseHazardId = SQLHelper.GetNewID(typeof(Model.DriverHse_HseHazard)); | 
					
						
							|  |  |  |  |                     this.hdId.Text = newData.HseHazardId; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 BLL.HseHazardService.AddHseHazard(newData); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |