163 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			163 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Linq;
 | |
| 
 | |
| namespace FineUIPro.Web.HSSE.Hazard
 | |
| {
 | |
|     public partial class RoutingInspectionView : PageBase
 | |
|     {
 | |
|         #region 定义项
 | |
|         /// <summary>
 | |
|         /// 主键
 | |
|         /// </summary>
 | |
|         private string PatrolPlanId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["PatrolPlanId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["PatrolPlanId"] = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private string HazardSelectedItemId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["HazardSelectedItemId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["HazardSelectedItemId"] = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private string RoutingInspectionId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["RoutingInspectionId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["RoutingInspectionId"] = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 图片路径
 | |
|         /// </summary>
 | |
|         public string ImageUrl
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["ImageUrl"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["ImageUrl"] = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 整改后附件路径
 | |
|         /// </summary>
 | |
|         public string RectificationImageUrl
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["RectificationImageUrl"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["RectificationImageUrl"] = value;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 加载页面
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | |
|             {
 | |
|                 if (!IsPostBack)
 | |
|                 {
 | |
|                     this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
 | |
|                     UserService.InitUsersDropDownList(this.drpPatrolMan, this.CurrUser.LoginProjectId, true, string.Empty);
 | |
|                     UserService.InitUsersDropDownList(this.drpRiskMan, this.CurrUser.LoginProjectId, true, string.Empty);
 | |
|                     this.RoutingInspectionId = Request.Params["RoutingInspectionId"];
 | |
|                     this.hdCheckManId.Text = this.CurrUser.UserId;
 | |
|                     if (!string.IsNullOrEmpty(this.RoutingInspectionId))
 | |
|                     {
 | |
|                         Model.Hazard_RoutingInspection routingInspection = BLL.Hazard_RoutingInspectionService.GetRoutingInspectionByRoutingInspectionId(this.RoutingInspectionId);
 | |
|                         Model.Hazard_PatrolPlan plan = BLL.Hazard_PatrolPlanService.GetPatrolPlanByPatrolPlanId(routingInspection.PatrolPlanId);
 | |
|                         HazardSelectedItemId = plan.HazardSelectedItemId;
 | |
|                         Model.Hazard_HazardSelectedItem item = BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemByHazardSelectedItemId(plan.HazardSelectedItemId);
 | |
|                         if (item != null)
 | |
|                         {
 | |
|                             var q = BLL.HazardListService.GetHazardListById(item.HazardId);
 | |
|                             if (q != null)
 | |
|                             {
 | |
|                                 this.txtHazardCode.Text = q.HazardCode;
 | |
|                                 this.txtHazardItems.Text = item.HazardItems;
 | |
|                                 this.txtDefectsType.Text = item.DefectsType;
 | |
|                                 this.txtMayLeadAccidents.Text = item.MayLeadAccidents;
 | |
|                             }
 | |
|                         }
 | |
|                         if (routingInspection != null)
 | |
|                         {
 | |
|                             if (!string.IsNullOrEmpty(routingInspection.PatrolManId))
 | |
|                             {
 | |
|                                 this.drpPatrolMan.SelectedValue = routingInspection.PatrolManId;
 | |
|                             }
 | |
|                             if (routingInspection.PatrolTime != null)
 | |
|                             {
 | |
|                                 this.txtPatrolTime.Text = string.Format("{0:yyyy-MM-dd}", routingInspection.PatrolTime);
 | |
|                             }
 | |
|                             if (routingInspection.PatrolResult != null)
 | |
|                             {
 | |
|                                 this.rblPatrolResult.SelectedValue = routingInspection.PatrolResult.ToString();
 | |
|                             }
 | |
|                             this.txtControlMeasures.Text = routingInspection.ControlMeasures;
 | |
|                             this.txtDealReason.Text = routingInspection.DealReason;
 | |
|                             if (!string.IsNullOrEmpty(routingInspection.RiskManId))
 | |
|                             {
 | |
|                                 this.drpRiskMan.SelectedValue = routingInspection.RiskManId;
 | |
|                             }
 | |
|                         }
 | |
|                         else
 | |
|                         {
 | |
|                             this.drpPatrolMan.SelectedValue = this.CurrUser.UserId;
 | |
|                             this.txtPatrolTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | |
|                             this.drpRiskMan.SelectedValue = this.CurrUser.UserId;
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 上传附件资源
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttachUrl_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string edit = "-1";
 | |
|             DateTime date = Funs.GetNewDateTimeOrNow(this.txtPatrolTime.Text.Trim());
 | |
|             string dateStr = date.Year.ToString() + date.Month.ToString();
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/RoutingInspection/" + dateStr + "&menuId={1}&type={2}", this.RoutingInspectionId, Const.ProjectRiskControlMenuId, edit)));
 | |
|         }
 | |
| 
 | |
|         #endregion
 | |
|     }
 | |
| } |