CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/JDGL/WBSCompleteAndReal/WBSReport.aspx.cs

208 lines
7.6 KiB
C#

using BLL;
using System;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.JDGL.WBSCompleteAndReal
{
public partial class WBSReport :PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.drpInstallation.DataTextField = "InstallationName";
this.drpInstallation.DataValueField = "InstallationId";
this.drpInstallation.DataSource = (from x in Funs.DB.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId orderby x.InstallationCode select x).ToList();
drpInstallation.DataBind();
this.drpCnProfession.DataTextField = "CnProfessionName";
this.drpCnProfession.DataValueField = "CnProfessionId";
this.drpCnProfession.DataSource = BLL.CnProfessionService.GetCnProfessionDropDownList2();
drpCnProfession.DataBind();
}
}
#endregion
#region
/// <summary>
/// 查询按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
int year;
int month;
string[] installationId = null;
string[] cnProfessionId = null;
int marking2 = 0;
if (!string.IsNullOrEmpty(this.txtStartDate.Text))
{
year = Convert.ToDateTime(this.txtStartDate.Text).Year;
month = Convert.ToDateTime(this.txtStartDate.Text).Month;
}
else
{
year = DateTime.Now.Year;
month = DateTime.Now.Month;
}
if (this.CheckBoxList1.SelectedValueArray.Length > 0)
{
marking2 = 5;
}
if (this.CheckBoxList2.SelectedValueArray.Length > 0)
{
marking2 = 6;
}
if (this.CheckBoxList3.SelectedValueArray.Length > 0)
{
marking2 = 7;
}
if (this.CheckBoxList4.SelectedValueArray.Length > 0)
{
marking2 = 8;
}
if (this.CheckBoxList5.SelectedValueArray.Length > 0)
{
marking2 = 9;
}
if (this.CheckBoxList6.SelectedValueArray.Length > 0)
{
marking2 = 10;
}
installationId = this.drpInstallation.SelectedValueArray;
cnProfessionId = this.drpCnProfession.SelectedValueArray;
DataTable table = BLL.WBSReportService.GetTreeDataTable(this.CurrUser.LoginProjectId, year, month, installationId, cnProfessionId, marking2, string.Empty);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region CheckBoxList选择事件
/// <summary>
/// 单位工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList1.SelectedValueArray.Length == 0)
{
CheckBoxList2.SelectedValueArray = new string[] { };
CheckBoxList3.SelectedValueArray = new string[] { };
CheckBoxList4.SelectedValueArray = new string[] { };
CheckBoxList5.SelectedValueArray = new string[] { };
CheckBoxList6.SelectedValueArray = new string[] { };
}
}
/// <summary>
/// 子单位工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList2_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList2.SelectedValueArray.Length > 0)
{
CheckBoxList1.SelectedValueArray = new string[] { "1" };
}
else
{
CheckBoxList3.SelectedValueArray = new string[] { };
CheckBoxList4.SelectedValueArray = new string[] { };
CheckBoxList5.SelectedValueArray = new string[] { };
CheckBoxList6.SelectedValueArray = new string[] { };
}
}
/// <summary>
/// 分部工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList3_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList3.SelectedValueArray.Length > 0)
{
CheckBoxList1.SelectedValueArray = new string[] { "1" };
CheckBoxList2.SelectedValueArray = new string[] { "2" };
}
else
{
CheckBoxList4.SelectedValueArray = new string[] { };
CheckBoxList5.SelectedValueArray = new string[] { };
CheckBoxList6.SelectedValueArray = new string[] { };
}
}
/// <summary>
/// 子分部工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList4_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList4.SelectedValueArray.Length > 0)
{
CheckBoxList1.SelectedValueArray = new string[] { "1" };
CheckBoxList2.SelectedValueArray = new string[] { "2" };
CheckBoxList3.SelectedValueArray = new string[] { "3" };
}
else
{
CheckBoxList5.SelectedValueArray = new string[] { };
CheckBoxList6.SelectedValueArray = new string[] { };
}
}
/// <summary>
/// 分项工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList5_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList5.SelectedValueArray.Length > 0)
{
CheckBoxList1.SelectedValueArray = new string[] { "1" };
CheckBoxList2.SelectedValueArray = new string[] { "2" };
CheckBoxList3.SelectedValueArray = new string[] { "3" };
CheckBoxList4.SelectedValueArray = new string[] { "4" };
}
else
{
CheckBoxList6.SelectedValueArray = new string[] { };
}
}
/// <summary>
/// 子分项工程选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void CheckBoxList6_SelectedIndexChanged(object sender, EventArgs e)
{
if (CheckBoxList6.SelectedValueArray.Length > 0)
{
CheckBoxList1.SelectedValueArray = new string[] { "1" };
CheckBoxList2.SelectedValueArray = new string[] { "2" };
CheckBoxList3.SelectedValueArray = new string[] { "3" };
CheckBoxList4.SelectedValueArray = new string[] { "4" };
CheckBoxList5.SelectedValueArray = new string[] { "5" };
}
}
#endregion
}
}