| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.ZHGL.Supervise | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class ShowRectifyItem : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 定义集合 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 定义集合 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private static List<string> list = new List<string>(); | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 类型:安全、质量 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string Type | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["type"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["type"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 加载页面 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 list = new List<string>(); | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |                 this.Type = Request.Params["type"]; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 string lists = Request.Params["lists"]; | 
					
						
							|  |  |  |  |                 list = Funs.GetStrListByStr(lists, ','); | 
					
						
							|  |  |  |  |                 InitTreeMenu(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 加载树 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载树 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void InitTreeMenu() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.trRectify.Nodes.Clear(); | 
					
						
							|  |  |  |  |             this.trRectify.ShowBorder = false; | 
					
						
							|  |  |  |  |             this.trRectify.ShowHeader = false; | 
					
						
							|  |  |  |  |             this.trRectify.EnableIcons = true; | 
					
						
							|  |  |  |  |             this.trRectify.AutoScroll = true; | 
					
						
							|  |  |  |  |             this.trRectify.EnableSingleClickExpand = true; | 
					
						
							|  |  |  |  |             TreeNode rootNode = new TreeNode | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Text = "作业类别", | 
					
						
							|  |  |  |  |                 NodeID = "0", | 
					
						
							|  |  |  |  |                 Expanded = true | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             this.trRectify.Nodes.Add(rootNode); | 
					
						
							|  |  |  |  |             BoundTree(rootNode.Nodes, "0"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载树 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="nodes"></param> | 
					
						
							|  |  |  |  |         /// <param name="menuId"></param> | 
					
						
							|  |  |  |  |         private void BoundTree(TreeNodeCollection nodes, string menuId) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |             var dt = BLL.RectifyService.GetRectifyBySupRectifyId(menuId, this.Type); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             if (dt.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 TreeNode tn = null; | 
					
						
							|  |  |  |  |                 foreach (var dr in dt) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     tn = new TreeNode | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Text = dr.RectifyName, | 
					
						
							|  |  |  |  |                         NodeID = dr.RectifyId, | 
					
						
							|  |  |  |  |                         EnableClickEvent = true | 
					
						
							|  |  |  |  |                     }; | 
					
						
							|  |  |  |  |                     nodes.Add(tn); | 
					
						
							|  |  |  |  |                     BoundTree(tn.Nodes, dr.RectifyId); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 树点击事件 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// tree点击事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void trRectify_NodeCommand(object sender, TreeCommandEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |             this.txtName.Text = ""; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 加载Grid | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载Grid | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |             string strSql = ""; | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = new SqlParameter[] { }; | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(this.txtName.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql = "select * from View_Technique_RectifyItem where RectifyId=@RectifyId and IsPass=@IsPass"; | 
					
						
							|  |  |  |  |                 parameter = new SqlParameter[] | 
					
						
							|  |  |  |  |                        { | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |                         new SqlParameter("@RectifyId",this.trRectify.SelectedNode.NodeID), | 
					
						
							|  |  |  |  |                         new SqlParameter("@IsPass",true) | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  |                        }; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql = "select * from View_Technique_RectifyItem where IsPass=@IsPass and HazardSourcePoint like @HazardSourcePoint "; | 
					
						
							|  |  |  |  |                 parameter = new SqlParameter[] | 
					
						
							|  |  |  |  |                    { | 
					
						
							|  |  |  |  |                         new SqlParameter("@IsPass",true), | 
					
						
							|  |  |  |  |                         new SqlParameter("@HazardSourcePoint", "%" + this.txtName.Text.Trim() + "%"), | 
					
						
							|  |  |  |  |                    }; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             //tb = GetFilteredTable(Grid1.FilteredData, tb); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-07 18:55:33 +08:00
										 |  |  |  |             if (list.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 for (int i = 0; i < Grid1.Rows.Count; i++) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected"); | 
					
						
							|  |  |  |  |                     string id = Grid1.DataKeys[i][0].ToString(); | 
					
						
							|  |  |  |  |                     if (list.Contains(id)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         checkField.SetCheckedState(i, true); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 过滤表头、分页、排序、关闭窗口 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 过滤表头 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_FilterChange(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         ///  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.PageIndex = e.NewPageIndex; | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Grid1排序 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_Sort(object sender, GridSortEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.SortDirection = e.SortDirection; | 
					
						
							|  |  |  |  |             Grid1.SortField = e.SortField; | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页下拉选择事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 确认按钮 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 确认按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (list.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ShowNotify("请至少选择一项!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             string str = string.Empty; | 
					
						
							|  |  |  |  |             foreach (var item in list) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 str += item + ","; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(str)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 str = str.Substring(0, str.LastIndexOf(",")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(str) | 
					
						
							|  |  |  |  |                    + ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region Grid行点击事件 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Grid1行点击事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string rowID = Grid1.DataKeys[e.RowIndex][0].ToString(); | 
					
						
							|  |  |  |  |             if (e.CommandName == "IsSelected") | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected"); | 
					
						
							|  |  |  |  |                 if (checkField.GetCheckedState(e.RowIndex)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (!list.Contains(rowID)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         list.Add(rowID); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     if (list.Contains(rowID)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         list.Remove(rowID); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2025-06-19 16:55:10 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 查询 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void txtName_TextChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.BindGrid(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } |