159 lines
6.5 KiB
C#
159 lines
6.5 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.JDGL.WBS
|
|
{
|
|
public partial class WorkloadStatistics : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.drpCnProfession.DataValueField = "CnProfessionId";
|
|
this.drpCnProfession.DataTextField = "CnProfessionName";
|
|
this.drpCnProfession.DataSource = BLL.CnProfessionInitService.GetCnProfessionInitDropDownList();
|
|
this.drpCnProfession.DataBind();
|
|
Funs.FineUIPleaseSelect(drpCnProfession);
|
|
Funs.FineUIPleaseSelect(drpUnitProject);
|
|
Funs.FineUIPleaseSelect(drpWbsSet);
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
|
|
{
|
|
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
|
|
//if (this.rblStatisticsType.SelectedValue == "1")
|
|
//{
|
|
DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
//}
|
|
//else
|
|
//{
|
|
// if (this.drpCnProfession.SelectedValue != BLL.Const._Null)
|
|
// {
|
|
// DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue);
|
|
// Grid1.DataSource = table;
|
|
// Grid1.DataBind();
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 统计类型选择事件
|
|
/// <summary>
|
|
/// 统计类型选择事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void rblStatisticsType_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
//if (this.rblStatisticsType.SelectedValue == "1")
|
|
//{
|
|
// this.drpCnProfession.Hidden = true;
|
|
// this.drpUnitProject.Hidden = true;
|
|
// this.drpCnProfession.SelectedValue = BLL.Const._Null;
|
|
//}
|
|
//else if (this.rblStatisticsType.SelectedValue == "2")
|
|
//{
|
|
// this.drpCnProfession.Hidden = false;
|
|
//}
|
|
}
|
|
#endregion
|
|
|
|
protected void drpCnProfession_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.drpCnProfession.SelectedValue != BLL.Const._Null)
|
|
{
|
|
this.drpUnitProject.DataValueField = "UnitProjectCode";
|
|
this.drpUnitProject.DataTextField = "UnitProjectName";
|
|
this.drpUnitProject.DataSource = BLL.UnitProjectInitService.GetUnitProjectInitsByCnProfessionId(this.drpCnProfession.SelectedValue);
|
|
this.drpUnitProject.DataBind();
|
|
Funs.FineUIPleaseSelect(drpUnitProject);
|
|
this.drpUnitProject.SelectedValue = BLL.Const._Null;
|
|
this.drpWbsSet.Items.Clear();
|
|
Funs.FineUIPleaseSelect(drpWbsSet);
|
|
this.drpWbsSet.SelectedValue = BLL.Const._Null;
|
|
}
|
|
else
|
|
{
|
|
this.drpUnitProject.Items.Clear();
|
|
Funs.FineUIPleaseSelect(drpUnitProject);
|
|
this.drpUnitProject.SelectedValue = BLL.Const._Null;
|
|
this.drpWbsSet.Items.Clear();
|
|
Funs.FineUIPleaseSelect(drpWbsSet);
|
|
this.drpWbsSet.SelectedValue = BLL.Const._Null;
|
|
}
|
|
}
|
|
|
|
protected void drpUnitProject_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnitProject.SelectedValue != BLL.Const._Null)
|
|
{
|
|
this.drpWbsSet.DataValueField = "WbsSetCode";
|
|
this.drpWbsSet.DataTextField = "WbsSetName";
|
|
this.drpWbsSet.DataSource = BLL.WbsSetInitService.GetWbsSetInitsByUnitProjectCode(this.drpUnitProject.SelectedValue);
|
|
this.drpWbsSet.DataBind();
|
|
Funs.FineUIPleaseSelect(drpWbsSet);
|
|
this.drpWbsSet.SelectedValue = BLL.Const._Null;
|
|
}
|
|
else
|
|
{
|
|
this.drpWbsSet.Items.Clear();
|
|
Funs.FineUIPleaseSelect(drpWbsSet);
|
|
this.drpWbsSet.SelectedValue = BLL.Const._Null;
|
|
}
|
|
}
|
|
|
|
#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 = Encoding.UTF8;
|
|
this.Grid1.PageSize = Grid1.RecordCount;
|
|
Response.Write(GetGridTableHtml2(Grid1));
|
|
Response.End();
|
|
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
|
|
DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
}
|
|
} |