| 
									
										
										
										
											2024-04-25 17:06:47 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.DataShow | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class SafePerson : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 加载页面 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.DropDownPageSize(this.ddlPageSize); | 
					
						
							|  |  |  |  |                 ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); | 
					
						
							|  |  |  |  |                 BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); | 
					
						
							|  |  |  |  |                 // 绑定表格t | 
					
						
							|  |  |  |  |                 BindGrid(); | 
					
						
							|  |  |  |  |                 this.Panel1.Title = "安全管理人员(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")"; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName,
 | 
					
						
							|  |  |  |  |                         Person.PersonName,Person.PersonId,Person.IdentityCard,Person.Sex,Person.WorkPostId,WorkPost.WorkPostName,Person.Telephone | 
					
						
							|  |  |  |  |                         ,(CASE WHEN Sex=2 THEN '女'  WHEN Sex=1 THEN '男' ELSE '' END) AS SexStr | 
					
						
							|  |  |  |  |                         FROM SitePerson_Person  AS Person | 
					
						
							|  |  |  |  |                         LEFT JOIN Base_Project AS Project ON Person.ProjectId =Project.ProjectId | 
					
						
							|  |  |  |  |                         LEFT JOIN Base_Unit AS Unit ON Person.UnitId =Unit.UnitId | 
					
						
							|  |  |  |  |                         LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId =WorkPost.WorkPostId | 
					
						
							| 
									
										
										
										
											2025-03-26 18:41:39 +08:00
										 |  |  |  |                         WHERE IsUsed=1 AND InTime <=GETDATE() AND (OutTime IS NULL OR OutTime > GETDATE()) and Project.ProjectState ='1' ";
 | 
					
						
							| 
									
										
										
										
											2024-04-25 17:06:47 +08:00
										 |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             if (this.drpProject.SelectedValue != Const._Null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND Person.ProjectId = @ProjectId"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@ProjectId", this.drpProject.SelectedValue)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             strSql += " AND WorkPost.IsHsse = 1"; | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							|  |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 查询 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 查询 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void TextBox_TextChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 表排序、分页、关闭窗口 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 排序 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_Sort(object sender, GridSortEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             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(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 关闭弹出窗 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Window1_Close(object sender, WindowCloseEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region Grid双击事件 编辑 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Grid行双击事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         ///  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void EditData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (Grid1.SelectedRowIndexArray.Length == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/SitePerson/PersonListEdit.aspx?PersonId={0}&type=show", Grid1.SelectedRowID, "查看 - "))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnView_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |