| 
									
										
										
										
											2025-03-21 14:33:56 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using BLL.OfficeCheck.Inspect; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.OfficeCheck.Inspect | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class ProjectSafetyInspectionRectify : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 定义项 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 主键 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private string InspectionItemId | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["InspectionItemId"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["InspectionItemId"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 责任人 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string PersonResponsible | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["PersonResponsible"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["PersonResponsible"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 类型 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string type | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["type"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["type"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 加载 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); | 
					
						
							|  |  |  |  |                 this.InspectionItemId = Request.QueryString["InspectionItemId"]; | 
					
						
							|  |  |  |  |                 this.type = Request.QueryString["type"]; | 
					
						
							|  |  |  |  |                 if (this.type == "1") | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnSave.Hidden = true; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.InspectionItemId)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     var registration = (from x in Funs.DB.Inspect_InspectionItem | 
					
						
							|  |  |  |  |                         join y in Funs.DB.Inspect_Inspection on x.InspectionId equals y.InspectionId into inspection | 
					
						
							|  |  |  |  |                         from inspectionJoin in inspection.DefaultIfEmpty() | 
					
						
							|  |  |  |  |                         where x.InspectionItemId == this.InspectionItemId | 
					
						
							|  |  |  |  |                         select new  | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2025-04-06 23:26:22 +08:00
										 |  |  |  |                             //x.InspectionItemId, | 
					
						
							|  |  |  |  |                             //x.InspectionDescribe, | 
					
						
							|  |  |  |  |                             //x.PhotoUrl, | 
					
						
							|  |  |  |  |                             //x.VideoUrl, | 
					
						
							|  |  |  |  |                             //inspectionJoin.PersonResponsible, | 
					
						
							|  |  |  |  |                             //x.EvaluateResults, | 
					
						
							|  |  |  |  |                             //inspectionJoin.InspectMan, | 
					
						
							|  |  |  |  |                             //x.TimeLimited, | 
					
						
							|  |  |  |  |                             //x.RectificationDescription | 
					
						
							| 
									
										
										
										
											2025-03-21 14:33:56 +08:00
										 |  |  |  |                         }).FirstOrDefault(); | 
					
						
							| 
									
										
										
										
											2025-04-06 23:26:22 +08:00
										 |  |  |  |                     //if (registration != null) | 
					
						
							|  |  |  |  |                     //{ | 
					
						
							|  |  |  |  |                     //    this.txtInspectionDescribe.Text = registration.InspectionDescribe; | 
					
						
							|  |  |  |  |                     //    // this.UploadPhoto.Text = registration.PhotoUrl; | 
					
						
							|  |  |  |  |                     //    // this.UploadVideo.Text = registration.VideoUrl; | 
					
						
							|  |  |  |  |                     //    if (registration.InspectMan != null) | 
					
						
							|  |  |  |  |                     //    { | 
					
						
							|  |  |  |  |                     //        //查询用户名 | 
					
						
							|  |  |  |  |                     //        var user = (from x in Funs.DB.Sys_User | 
					
						
							|  |  |  |  |                     //            where x.UserId == registration.InspectMan | 
					
						
							|  |  |  |  |                     //            select new { x.UserName }).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     //        if (user != null) | 
					
						
							|  |  |  |  |                     //        { | 
					
						
							|  |  |  |  |                     //            this.txtCheckManName.Text = user.UserName; | 
					
						
							|  |  |  |  |                     //        } | 
					
						
							|  |  |  |  |                     //    } | 
					
						
							|  |  |  |  |                     //    this.txtEvaluateResults.Text = registration.EvaluateResults; | 
					
						
							|  |  |  |  |                     //    if (registration.PersonResponsible != null) | 
					
						
							|  |  |  |  |                     //    { | 
					
						
							|  |  |  |  |                     //        //查询用户名 | 
					
						
							|  |  |  |  |                     //        var user = (from x in Funs.DB.Sys_User | 
					
						
							|  |  |  |  |                     //            where x.UserId == registration.PersonResponsible | 
					
						
							|  |  |  |  |                     //            select new { x.UserName }).FirstOrDefault(); | 
					
						
							|  |  |  |  |                     //        if (user != null) | 
					
						
							|  |  |  |  |                     //        { | 
					
						
							|  |  |  |  |                     //            this.txtResponsibleManName.Text = user.UserName; | 
					
						
							|  |  |  |  |                     //        } | 
					
						
							|  |  |  |  |                     //    } | 
					
						
							|  |  |  |  |                     //    if (registration.TimeLimited != null) | 
					
						
							|  |  |  |  |                     //    { | 
					
						
							|  |  |  |  |                     //        this.txtTimeLimited.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", registration.TimeLimited); | 
					
						
							|  |  |  |  |                     //    } | 
					
						
							|  |  |  |  |                     //    this.txtRectificationDescription.Text = registration.RectificationDescription; | 
					
						
							|  |  |  |  |                     //    this.PersonResponsible = registration.PersonResponsible; | 
					
						
							|  |  |  |  |                     //} | 
					
						
							| 
									
										
										
										
											2025-03-21 14:33:56 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 保存 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.PersonResponsible) && this.PersonResponsible == this.CurrUser.UserId) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 SaveData(true); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInTop("您不是当前责任人,无法整改!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="p"></param> | 
					
						
							|  |  |  |  |         private void SaveData(bool isClosed) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var register = Inspect_InspectionService.GetInspectItemsById(this.InspectionItemId); | 
					
						
							|  |  |  |  |             if (register != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2025-04-06 23:26:22 +08:00
										 |  |  |  |                 //var file = AttachFileService.GetAttachFile(register.InspectionItemId + "_3", BLL.Const.ProjectSafetyInspectionMenuId); | 
					
						
							|  |  |  |  |                 //if (file != null && file.AttachUrl != "") | 
					
						
							|  |  |  |  |                 //{ | 
					
						
							|  |  |  |  |                 //    register.States = "3"; //已整改待复查 | 
					
						
							|  |  |  |  |                 //    //register.RectificationPhotoUrl = file.AttachUrl.Trim(); | 
					
						
							|  |  |  |  |                 //} | 
					
						
							|  |  |  |  |                 //else | 
					
						
							|  |  |  |  |                 //{ | 
					
						
							|  |  |  |  |                 //    ShowNotify("请先上传整改后照片!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 //    return; | 
					
						
							|  |  |  |  |                 //} | 
					
						
							| 
									
										
										
										
											2025-03-21 14:33:56 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-06 23:26:22 +08:00
										 |  |  |  |                 //Inspect_InspectionService.UpdateInspectionItem(register); | 
					
						
							| 
									
										
										
										
											2025-03-21 14:33:56 +08:00
										 |  |  |  |                 if (isClosed) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (string.IsNullOrEmpty(Request.Params["Main"])) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         PageContext.RegisterStartupScript(String.Format("window.close();")); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 附件查看 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 附件查看 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnPhotoUrl_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |            var itemId = this.InspectionItemId + "_1"; | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format( | 
					
						
							|  |  |  |  |                 "../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId, | 
					
						
							|  |  |  |  |                 BLL.Const.ProjectSafetyInspectionMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void btnVideoUrl_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var itemId = this.InspectionItemId + "_2"; | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format( | 
					
						
							|  |  |  |  |                 "../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId, | 
					
						
							|  |  |  |  |                 BLL.Const.ProjectSafetyInspectionMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 附件上传 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 附件上传 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnAttachUrlR_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var itemId = this.InspectionItemId + "_3"; | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format( | 
					
						
							|  |  |  |  |                 "../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/InspectionItem&menuId={1}", itemId, | 
					
						
							|  |  |  |  |                 BLL.Const.ProjectSafetyInspectionMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |