308 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			308 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Linq;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.JDGL.CostAnalysis
 | 
						|
{
 | 
						|
    public partial class PlanAdjust : PageBase
 | 
						|
    {
 | 
						|
        #region 加载
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                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.GetCnProfessionDropDownList();
 | 
						|
                drpCnProfession.DataBind();
 | 
						|
 | 
						|
            }
 | 
						|
        }
 | 
						|
        private void GetNewGrid()
 | 
						|
        {
 | 
						|
            int year;
 | 
						|
            int month;
 | 
						|
            string[] installationId = null;
 | 
						|
            string[] cnProfessionId = null;
 | 
						|
            int marking2 = 0;
 | 
						|
 | 
						|
            year = DateTime.Now.Year;
 | 
						|
            month = DateTime.Now.Month;
 | 
						|
 | 
						|
            if (this.CheckBoxList1.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 3;
 | 
						|
            }
 | 
						|
            if (this.CheckBoxList2.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 4;
 | 
						|
            }
 | 
						|
            if (this.CheckBoxList3.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 5;
 | 
						|
            }
 | 
						|
            if (this.CheckBoxList4.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 6;
 | 
						|
            }
 | 
						|
            if (this.CheckBoxList5.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 7;
 | 
						|
            }
 | 
						|
            if (this.CheckBoxList6.SelectedValueArray.Length > 0)
 | 
						|
            {
 | 
						|
                marking2 = 8;
 | 
						|
            }
 | 
						|
            installationId = this.drpInstallation.SelectedValueArray;
 | 
						|
            cnProfessionId = this.drpCnProfession.SelectedValueArray;
 | 
						|
            DataTable table = BLL.WBSReportService.GetTreeDataTable(this.CurrUser.LoginProjectId, year, month, installationId, cnProfessionId, marking2, drpRectificationMeasureType.SelectedValue);
 | 
						|
 | 
						|
            Grid1.DataSource = table;
 | 
						|
            Grid1.DataBind();
 | 
						|
            List<string> list1 = new List<string>();    //进度纠偏最大值集合
 | 
						|
            List<string> list2 = new List<string>();    //费用纠偏最大值集合
 | 
						|
            for (int i = 0; i < Grid1.Rows.Count; i++)
 | 
						|
            {
 | 
						|
                if (drpRectificationMeasureType.SelectedValue == "1")   //进度纠偏
 | 
						|
                {
 | 
						|
                    if (!string.IsNullOrEmpty(Grid1.Rows[i].Values[15].ToString()))
 | 
						|
                    {
 | 
						|
                        if (Convert.ToDecimal(Grid1.Rows[i].Values[15].ToString()) < 0)
 | 
						|
                        {
 | 
						|
                            Grid1.Rows[i].RowCssClass = "yellow";
 | 
						|
                            if (Grid1.Rows[i].Values[26].ToString() == "true")
 | 
						|
                            {
 | 
						|
                                list1.Add(Grid1.Rows[i].Values[15].ToString() + "," + i);
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                else   //费用纠偏
 | 
						|
                {
 | 
						|
                    if (!string.IsNullOrEmpty(Grid1.Rows[i].Values[17].ToString()))
 | 
						|
                    {
 | 
						|
                        if (Convert.ToDecimal(Grid1.Rows[i].Values[17].ToString()) < 0)
 | 
						|
                        {
 | 
						|
                            Grid1.Rows[i].RowCssClass = "yellow";
 | 
						|
                            if (Grid1.Rows[i].Values[26].ToString() == "true")
 | 
						|
                            {
 | 
						|
                                list2.Add(Grid1.Rows[i].Values[17].ToString() + "," + i);
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            if (drpRectificationMeasureType.SelectedValue == "1")   //进度纠偏
 | 
						|
            {
 | 
						|
                if (list1.Count > 0)
 | 
						|
                {
 | 
						|
                    list1 = (from x in list1 orderby Convert.ToDecimal(x.Split(',')[0]) select x).ToList();
 | 
						|
                    int value = Convert.ToInt32(nbMaxValue.Text.Trim()) >= list1.Count ? list1.Count : Convert.ToInt32(nbMaxValue.Text.Trim());
 | 
						|
                    for (int i = 0; i < value; i++)
 | 
						|
                    {
 | 
						|
                        Grid1.Rows[Convert.ToInt32(list1[i].Split(',')[1])].RowCssClass = "red";
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                if (list2.Count > 0)
 | 
						|
                {
 | 
						|
                    list2 = (from x in list2 orderby Convert.ToDecimal(x.Split(',')[0]) select x).ToList();
 | 
						|
                    int value = Convert.ToInt32(nbMaxValue.Text.Trim()) >= list2.Count ? list2.Count : Convert.ToInt32(nbMaxValue.Text.Trim());
 | 
						|
                    for (int i = 0; i < value; i++)
 | 
						|
                    {
 | 
						|
                        Grid1.Rows[Convert.ToInt32(list2[i].Split(',')[1])].RowCssClass = "red";
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 查询
 | 
						|
        /// <summary>
 | 
						|
        /// 查询按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnNew_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(nbMaxValue.Text.Trim()))
 | 
						|
            {
 | 
						|
                ShowNotify("请先输入要查询的项数!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            GetNewGrid();
 | 
						|
        }
 | 
						|
        #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
 | 
						|
 | 
						|
        #region Grid行双击事件
 | 
						|
        /// <summary>
 | 
						|
        /// Grid行双击事件(最新动态)
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | 
						|
        {
 | 
						|
            if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.PlanAdjustMenuId, Const.BtnSave))
 | 
						|
            {
 | 
						|
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../WBSPlan/WBSPlanSet.aspx?ToWbs={0}", Grid1.SelectedRowID, "编辑 - ")));
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 关闭弹出窗口
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭窗口
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window1_Close(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("RectificationMeasureSet.aspx?ToWbs={0}&Type={1}", Grid1.SelectedRowID, drpRectificationMeasureType.SelectedValue, "编辑 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭窗口
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window2_Close(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            GetNewGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |