232 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			232 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using AspNet = System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.HSSE.SitePerson
 | |
| {
 | |
|     public partial class BlackPersonList : PageBase
 | |
|     {
 | |
|         #region 定义项
 | |
|         /// <summary>
 | |
|         /// 人员主键
 | |
|         /// </summary>
 | |
|         public string PersonId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["PersonId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["PersonId"] = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 项目id
 | |
|         /// </summary>
 | |
|         public string ProjectId
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return (string)ViewState["ProjectId"];
 | |
|             }
 | |
|             set
 | |
|             {
 | |
|                 ViewState["ProjectId"] = value;
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|         /// <summary>
 | |
|         /// 加载页面
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 Funs.DropDownPageSize(this.ddlPageSize);
 | |
|                 this.ProjectId = this.CurrUser.LoginProjectId;
 | |
|                 if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId)
 | |
|                 {
 | |
|                     this.ProjectId = Request.Params["projectId"];
 | |
|                 }
 | |
|                 ////权限按钮方法
 | |
|                 this.GetButtonPower();
 | |
|                
 | |
|                 this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
 | |
|                 BLL.WorkPostService.InitWorkPostDropDownList(this.drpPost, true);
 | |
|                 BindGrid();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 绑定数据
 | |
|         /// </summary>
 | |
|         private void BindGrid()
 | |
|         {
 | |
|             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | |
|             {
 | |
|                 string unitId = string.Empty;
 | |
|                 
 | |
|                 var getData = PersonService.getListData(this.ProjectId, unitId, this.txtPersonName.Text.Trim(), this.txtIdentityCard.Text.Trim(),
 | |
|                 "", Funs.GetStringByArray(this.drpPost.SelectedValueArray), this.ckTrain.Checked, this.rblPost.SelectedValue, this.ckJT.Checked,
 | |
|                  false, Grid1,true);
 | |
|                 Grid1.RecordCount = PersonService.count;
 | |
|                 Grid1.DataSource = getData;
 | |
|                 Grid1.DataBind();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         #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
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Grid双击事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | |
|         {
 | |
|             this.EditData();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 编辑
 | |
|         /// </summary>
 | |
|         private void EditData()
 | |
|         {
 | |
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | |
|             {
 | |
|                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             this.PersonId = Grid1.SelectedRowID;
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonListEdit.aspx?PersonId={0}", this.PersonId, "编辑 - ")));
 | |
|         }
 | |
| 
 | |
|         #region 关闭弹出窗口
 | |
|         /// <summary>
 | |
|         /// 关闭弹出窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 解除黑名单
 | |
|         protected void btnMenuBlack_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | |
|             {
 | |
|                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             this.PersonId = Grid1.SelectedRowID;
 | |
|             var result = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId);
 | |
|             if (result != null)
 | |
|             {
 | |
|                 result.IsBlacklist = false;
 | |
|                 Funs.DB.SubmitChanges();
 | |
|                 BindGrid();
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         protected void drpPost_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             this.drpPost.SelectedValueArray = Funs.RemoveDropDownListNull(this.drpPost.SelectedValueArray);
 | |
|         }
 | |
| 
 | |
|         #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>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             if (Request.Params["value"] == "0")
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PersonListMenuId);
 | |
|             if (buttonList.Count() > 0)
 | |
|             {
 | |
|                 if (buttonList.Contains(BLL.Const.BtnAdd))
 | |
|                 {
 | |
|                
 | |
|                   
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnModify))
 | |
|                 {
 | |
|                   
 | |
|                     btnMenuBlack.Hidden = false;
 | |
|                 }
 | |
|                 if (buttonList.Contains(BLL.Const.BtnDelete))
 | |
|                 {
 | |
|                  
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |