SGGL_SHJ/SGGL/FineUIPro.Web/HSSE/SitePerson/SitePersonNowStatistic.aspx.cs

116 lines
4.0 KiB
C#
Raw Normal View History

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.HSSE.SitePerson
{
public partial class SitePersonNowStatistic : PageBase
{
/// <summary>
/// 项目id
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
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"];
}
UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true);
this.drpUnit.SelectedValue = string.IsNullOrEmpty(this.CurrUser.UnitId) ? Const.UnitId_SEDIN : this.CurrUser.UnitId;
if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
{
this.drpUnit.Enabled = false;
}
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true);
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
// 绑定表格
this.BindGrid();
}
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
var getData = SitePerson_PersonService.getNowPersonListData(this.ProjectId, this.drpUnit.SelectedValue, this.drpWorkPost.SelectedValue
, this.txtPersonName.Text.Trim(),this.txtIdcard.Text.Trim(),Funs.GetNewDateTimeOrNow(this.txtStartDate.Text), Grid1);
Grid1.RecordCount = SitePerson_PersonService.nowCount;
Grid1.DataSource = getData;
Grid1.DataBind();
}
#endregion
protected void btnSearch_Click(object sender, EventArgs e)
{
// 绑定表格
this.BindGrid();
}
#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 Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
#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;
this.Grid1.PageSize = this.Grid1.RecordCount;
this.BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
#endregion
}
}