151 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			151 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Text;
 | |
| using AspNet = System.Web.UI.WebControls;
 | |
| 
 | |
| namespace FineUIPro.Web.BoSheng
 | |
| {
 | |
|     public partial class BoPerson : PageBase
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 GetButtonPower();
 | |
|                 Funs.DropDownPageSize(this.ddlPageSize);
 | |
|                 //this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | |
|                 //this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);                              
 | |
|                 this.GridBind();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 获取数据,合并相同行
 | |
|         /// </summary>
 | |
|         private void GridBind()
 | |
|         {
 | |
|             var getData = BOSHENGService.getPersonListData(this.CurrUser.LoginProjectId, this.txtDepartName.Text.Trim(),this.txtName.Text.Trim(), this.txtIdentifyID.Text.Trim(), Grid1);
 | |
|             Grid1.RecordCount = BOSHENGService.personcount;
 | |
|             Grid1.DataSource = getData;
 | |
|             Grid1.DataBind();
 | |
|         }
 | |
| 
 | |
|         protected void btnSearch_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.GridBind();
 | |
|         }
 | |
| 
 | |
|         #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, Encoding.UTF8) + ".xls");
 | |
|             Response.ContentType = "application/excel";
 | |
|             Response.ContentEncoding = Encoding.UTF8;
 | |
|             this.Grid1.PageSize = this.Grid1.RecordCount;
 | |
|             this.GridBind();
 | |
|             Response.Write(GetGridTableHtml(Grid1));
 | |
|             Response.End();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 分页 排序
 | |
|         /// <summary>
 | |
|         /// 改变索引事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | |
|         {
 | |
|             this.GridBind();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 分页下拉选择事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
 | |
|             this.GridBind();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | |
|         {
 | |
|             this.GridBind();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             this.GridBind();
 | |
|         }
 | |
| 
 | |
|         protected void btnMenuEdit_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.EditData();
 | |
|         }
 | |
| 
 | |
|         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;
 | |
|             }
 | |
|             string id = Grid1.SelectedRowID;
 | |
|             var person = BLL.BOSHENGService.GetBoPersonById(id);
 | |
|             if (person != null)
 | |
|             {
 | |
|                 PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("BoPersonEdit.aspx?id={0}", id, "编辑 - ")));
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         #region 获取按钮权限
 | |
|         /// <summary>
 | |
|         /// 获取按钮权限
 | |
|         /// </summary>
 | |
|         /// <param name="button"></param>
 | |
|         /// <returns></returns>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             if (Request.Params["value"] == "0")
 | |
|             {
 | |
|                 return;
 | |
|             }
 | |
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.BoPersonMenuId);
 | |
|             if (buttonList.Count > 0)
 | |
|             {
 | |
|                 if (buttonList.Contains(BLL.Const.BtnModify))
 | |
|                 {
 | |
|                     this.btnMenuEdit.Hidden = false;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |