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

150 lines
4.8 KiB
C#
Raw Normal View History

using BLL;
using System;
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;
}
}
2023-09-18 16:38:55 +08:00
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
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);
2023-09-18 16:38:55 +08:00
Funs.DropDownPageSize(this.ddlPageSize);
// 绑定表格
this.BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
var getData = SitePerson_PersonService.getNowPersonListData(this.ProjectId, this.drpUnit.SelectedValue, this.drpWorkPost.SelectedValue
2023-09-18 16:38:55 +08:00
, this.txtPersonName.Text.Trim(), this.txtIdcard.Text.Trim(), Funs.GetNewDateTimeOrNow(this.txtStartDate.Text), Grid1);
Grid1.RecordCount = SitePerson_PersonService.nowCount;
Grid1.DataSource = getData;
Grid1.DataBind();
}
2023-09-18 16:38:55 +08:00
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
this.BindGrid();
}
2023-09-18 16:38:55 +08:00
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
2023-09-18 16:38:55 +08:00
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
2023-09-18 16:38:55 +08:00
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2023-09-18 16:38:55 +08:00
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
2023-09-18 16:38:55 +08:00
#region Grid编辑事件
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
2023-09-18 16:38:55 +08:00
}
/// <summary>
/// 右键编辑事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
2023-09-18 16:38:55 +08:00
}
#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
}
}