| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using AspNet = System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.HSSE.SitePerson | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class PersonInfo : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 定义项 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 主键 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string CheckingId | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["CheckingId"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["CheckingId"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |         public string ProjectId | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |                 return (string)ViewState["ProjectId"]; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |                 ViewState["ProjectId"] = 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) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.DropDownPageSize(this.ddlPageSize); | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |                 this.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 ////权限按钮方法 | 
					
						
							|  |  |  |  |                 this.GetButtonPower(); | 
					
						
							|  |  |  |  |                 btnNew.OnClientClick = Window1.GetShowReference("PersonInfoEdit.aspx") + "return false;"; | 
					
						
							|  |  |  |  |                 this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!"); | 
					
						
							|  |  |  |  |                 this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的 <b><script>{0}</script></b> 行数据吗?", Grid1.GetSelectedCountReference()); | 
					
						
							|  |  |  |  |                 ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |                 UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId , true); | 
					
						
							|  |  |  |  |                 if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId , this.CurrUser.UnitId)) | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpUnit.SelectedValue = this.CurrUser.UnitId; | 
					
						
							|  |  |  |  |                     this.drpUnit.Enabled = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-08-21 10:53:31 +08:00
										 |  |  |  |                 this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); | 
					
						
							|  |  |  |  |                 this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(1)); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 // 绑定表格 | 
					
						
							|  |  |  |  |                 BindGrid(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |             var getData = SitePerson_CheckingService.getListData(this.ProjectId , this.drpUnit.SelectedValue, this.txtPersonName.Text.Trim(), | 
					
						
							|  |  |  |  |                this.txtStartDate.Text, this.txtEndDate.Text, Grid1); | 
					
						
							|  |  |  |  |             Grid1.RecordCount = SitePerson_CheckingService.count; | 
					
						
							|  |  |  |  |             Grid1.DataSource = getData; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |                | 
					
						
							|  |  |  |  |         #region 页索引改变事件 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 页索引改变事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.PageIndex = e.NewPageIndex; | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 排序 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 排序 | 
					
						
							|  |  |  |  |         /// </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(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 分页选择下拉改变事件 | 
					
						
							|  |  |  |  |         /// <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 Window1_Close(object sender, WindowCloseEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 编辑 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Grid行双击事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 右键编辑事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnMenuEdit_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.EditData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 编辑 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void EditData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (Grid1.SelectedRowIndexArray.Length == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             string CheckingId = Grid1.SelectedRowID; | 
					
						
							|  |  |  |  |             var checking = BLL.SitePerson_CheckingService.GetPersonInfoByCheckingId(CheckingId); | 
					
						
							|  |  |  |  |             if (checking != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (this.btnMenuEdit.Hidden)   ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面 | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonInfoEdit.aspx?CheckingId={0}&type=view", CheckingId, "查看 - "))); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonInfoEdit.aspx?CheckingId={0}", CheckingId, "编辑 - "))); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInTop("门禁系统自动考勤,不允许再次编辑!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 删除 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 右键删除事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnMenuDelete_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.DeleteData(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 删除方法 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void DeleteData() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (Grid1.SelectedRowIndexArray.Length > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 bool isShow = false; | 
					
						
							|  |  |  |  |                 if (Grid1.SelectedRowIndexArray.Length == 1) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     isShow = true; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 foreach (int rowIndex in Grid1.SelectedRowIndexArray) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     string rowID = Grid1.DataKeys[rowIndex][0].ToString(); | 
					
						
							|  |  |  |  |                     if (this.judgementDelete(rowID, isShow)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         var getV = BLL.SitePerson_CheckingService.GetPersonInfoByCheckingId(rowID); | 
					
						
							|  |  |  |  |                         if (getV != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             BLL.LogService.AddSys_Log(this.CurrUser, getV.CardNo, getV.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); | 
					
						
							|  |  |  |  |                             BLL.SitePerson_CheckingService.DeletePersonInfoByCheckingId(rowID); | 
					
						
							|  |  |  |  |                             | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             BLL.LogService.AddSys_Log(this.CurrUser, getV.CardNo, getV.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); | 
					
						
							|  |  |  |  |                             BLL.SitePerson_CheckingService.DeletePersonInfoByCheckingId(rowID); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         BindGrid(); | 
					
						
							|  |  |  |  |                         ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 判断是否可删除 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="rowID"></param> | 
					
						
							|  |  |  |  |         /// <param name="isShow"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         private bool judgementDelete(string rowID, bool isShow) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string content = string.Empty; | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(content)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (isShow) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Alert.ShowInTop(content); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 转换字符串 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 把进出转换为字符串类型 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sex"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         protected string ConvertIntoOut(object intoOut) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (intoOut != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-07-20 16:02:27 +08:00
										 |  |  |  |                 if (intoOut.ToString() == "1") | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return "进场"; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-07-20 16:02:27 +08:00
										 |  |  |  |                 else  | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     return "出场"; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return ""; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 判断按钮权限 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 判断按钮权限 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void GetButtonPower() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (Request.Params["value"] == "0") | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |             var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId , this.CurrUser.UserId, BLL.Const.PersonInfoMenuId); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             if (buttonList.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (buttonList.Contains(BLL.Const.BtnAdd)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnNew.Hidden = false; | 
					
						
							| 
									
										
										
										
											2021-07-26 11:08:59 +08:00
										 |  |  |  |                     this.btnImport.Hidden = false; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (buttonList.Contains(BLL.Const.BtnModify)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnMenuEdit.Hidden = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 if (buttonList.Contains(BLL.Const.BtnDelete)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnMenuDelete.Hidden = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 导出按钮 | 
					
						
							|  |  |  |  |         /// 导出按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnOut_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Response.ClearContent(); | 
					
						
							|  |  |  |  |             string filename = Funs.GetNewFileName(); | 
					
						
							|  |  |  |  |             Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("现场人员考勤管理" + filename, System.Text.Encoding.UTF8) + ".xls"); | 
					
						
							|  |  |  |  |             Response.ContentType = "application/excel"; | 
					
						
							|  |  |  |  |             Response.ContentEncoding = System.Text.Encoding.UTF8; | 
					
						
							| 
									
										
										
										
											2022-06-01 14:27:42 +08:00
										 |  |  |  |             this.Grid1.PageSize = this.Grid1.RecordCount; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |             Response.Write(GetGridTableHtml1(Grid1)); | 
					
						
							|  |  |  |  |             Response.End(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 导出方法 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="grid"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         private string GetGridTableHtml1(Grid grid) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             StringBuilder sb = new StringBuilder(); | 
					
						
							|  |  |  |  |             sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>"); | 
					
						
							|  |  |  |  |             sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">"); | 
					
						
							|  |  |  |  |             sb.Append("<tr>"); | 
					
						
							|  |  |  |  |             foreach (GridColumn column in grid.Columns) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 sb.AppendFormat("<td>{0}</td>", column.HeaderText); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             sb.Append("</tr>"); | 
					
						
							|  |  |  |  |             foreach (GridRow row in grid.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 sb.Append("<tr>"); | 
					
						
							|  |  |  |  |                 foreach (GridColumn column in grid.Columns) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     string html = row.Values[column.ColumnIndex].ToString(); | 
					
						
							|  |  |  |  |                     if (column.ColumnID == "tfNumber") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         html = (row.FindControl("labNumber") as AspNet.Label).Text; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     if (column.ColumnID == "tfIdentityCard") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         html = (row.FindControl("lblIdentityCard") as AspNet.Label).Text; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     if (column.ColumnID == "tfWorkAreaName") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         html = (row.FindControl("lblWorkAreaName") as AspNet.Label).Text; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     if (column.ColumnID == "tfIntoOut") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         html = (row.FindControl("lblIntoOut") as AspNet.Label).Text; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     if (column.ColumnID == "tfAddress") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         html = (row.FindControl("lblAddress") as AspNet.Label).Text; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     //sb.AppendFormat("<td>{0}</td>", html); | 
					
						
							|  |  |  |  |                     sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:140px;'>{0}</td>", html); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 sb.Append("</tr>"); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             sb.Append("</table>"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return sb.ToString(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btSearch_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-07-26 11:08:59 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 导入 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnImport_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PersonInfoIn.aspx", "导入 - "))); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } |