| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							| 
									
										
										
										
											2021-08-17 20:04:45 +08:00
										 |  |  |  | using System.Linq; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.HSSE.SitePerson | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class PersonOut : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <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(); | 
					
						
							|  |  |  |  |                 //项目施工单位 | 
					
						
							|  |  |  |  |                 BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, false); | 
					
						
							|  |  |  |  |                 if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpUnitId.SelectedValue = this.CurrUser.UnitId; | 
					
						
							|  |  |  |  |                     this.drpUnitId.Enabled = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 this.txtChangeTime.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now); | 
					
						
							|  |  |  |  |                 this.BindGrid(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 人员下拉框绑定数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string strSql = string.Empty; | 
					
						
							|  |  |  |  |                 ///在场人员出场 | 
					
						
							|  |  |  |  |                 strSql = @"SELECT PersonId,CardNo,PersonName,IdentityCard" | 
					
						
							| 
									
										
										
										
											2021-08-17 11:01:22 +08:00
										 |  |  |  |                           + @" FROM SitePerson_Person WHERE IsUsed =1 AND (OutTime IS  NULL OR OutTime>= GETDATE())"; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |                 strSql += " AND ProjectId = @ProjectId"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.CurrUser.UnitId) && this.CurrUser.UnitId != Const.UnitId_CWCEC) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     strSql += " AND UnitId = @UnitId"; | 
					
						
							|  |  |  |  |                     listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue)); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue) && this.drpUnitId.SelectedValue != Const._Null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     strSql += " AND UnitId = @UnitId2"; | 
					
						
							|  |  |  |  |                     listStr.Add(new SqlParameter("@UnitId2", this.drpUnitId.SelectedValue)); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim())) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     strSql += " AND PersonName LIKE @PersonName"; | 
					
						
							|  |  |  |  |                     listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim())) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     strSql += " AND IdentityCard LIKE @IdentityCard"; | 
					
						
							|  |  |  |  |                     listStr.Add(new SqlParameter("@IdentityCard", "%" + this.txtIdentityCard.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 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 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             foreach (var item in this.drpPerson.Values) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-08-17 20:04:45 +08:00
										 |  |  |  |                 DateTime date = Funs.GetNewDateTimeOrNow(this.txtChangeTime.Text); | 
					
						
							|  |  |  |  |                 PersonService.PersonOut(item, date); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             BLL.LogService.AddSys_Log(this.CurrUser, "人员批量出场", null, BLL.Const.PersonListMenuId, BLL.Const.BtnModify); | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 查询 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 下拉框查询 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void TextBox_TextChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |