Пример #1
0
        private void LoadDataGrid()
        {
            try
            {
                CostBudgetStrategyBuilder sb = new CostBudgetStrategyBuilder();
                sb.AddStrategy(new Strategy(CostBudgetStrategyName.ProjectCode, txtProjectCode.Value));

                //只显示目标费用或动态预算
                int TargetFlag = BLL.ConvertRule.ToInt(this.txtTargetFlag.Value);
                sb.AddStrategy(new Strategy(CostBudgetStrategyName.TargetFlag, TargetFlag.ToString()));

                ArrayList arStatus = new ArrayList();
                if (this.chkStatus0.Checked)
                {
                    arStatus.Add("0");
                }
                if (this.chkStatus1.Checked)
                {
                    arStatus.Add("1");
                }
                if (this.chkStatus2.Checked)
                {
                    arStatus.Add("2");
                }
                if (this.chkStatus3.Checked)
                {
                    arStatus.Add("3");
                }
                string status = BLL.ConvertRule.GetArrayLinkString(arStatus);
                if (status != "")
                {
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.Status, status));
                }

                if (this.txtAdvSearch.Value != "none")
                {
                    if (this.ucInputSystemGroup.Value != "")
                    {
                        ArrayList arGroup = new ArrayList();
                        arGroup.Add(this.ucInputSystemGroup.Value);
                        arGroup.Add("0");
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.GroupCodeEx, arGroup));
                    }

                    if (this.ucUnit.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.UnitCode, this.ucUnit.Value));
                    }

                    if (this.ucPBS.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.PBSType, this.ucPBS.PBSType));
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.PBSCode, this.ucPBS.Value));
                    }

                    if (this.ucCreatePerson.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CreatePerson, this.ucCreatePerson.Value));
                    }
                    if (this.ucModifyPerson.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.ModifyPerson, this.ucModifyPerson.Value));
                    }
                    if (this.ucCheckPerson.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CheckPerson, this.ucCheckPerson.Value));
                    }

                    if (this.dtCreateDateBegin.Value != "" || this.dtCreateDateEnd.Value != "")
                    {
                        ArrayList ar = new ArrayList();
                        ar.Add(this.dtCreateDateBegin.Value);
                        ar.Add(this.dtCreateDateEnd.Value);
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CreateDateRange, ar));
                    }

                    if (this.dtModifyDateBegin.Value != "" || this.dtModifyDateEnd.Value != "")
                    {
                        ArrayList ar = new ArrayList();
                        ar.Add(this.dtModifyDateBegin.Value);
                        ar.Add(this.dtModifyDateEnd.Value);
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.ModifyDateRange, ar));
                    }

                    if (this.dtCheckDateBegin.Value != "" || this.dtCheckDateEnd.Value != "")
                    {
                        ArrayList ar = new ArrayList();
                        ar.Add(this.dtCheckDateBegin.Value);
                        ar.Add(this.dtCheckDateEnd.Value);
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CheckDateRange, ar));
                    }
                }

                //权限
                ArrayList arA = new ArrayList();
                arA.Add(user.UserCode);
                arA.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetStrategyName.AccessRange, arA));

                //缺省排序(项目总体费用排在最后)
                sb.AddOrder("GroupSortID", true);
                sb.AddOrder("PBSType", true);
                sb.AddOrder("CostBudgetSetName", true);
                sb.AddOrder("VerID", true);
                string sql = sb.BuildQueryViewString();

                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("CostBudget", sql);
                qa.Dispose();

                /*
                 * string[] arrField = {"Money", "TotalPayoutMoney"};
                 * decimal[] arrSum = BLL.MathRule.SumColumn(entity.CurrentTable, arrField);
                 * this.txtSumMoney.Value = arrSum[0].ToString("N");
                 * this.txtSumTotalPayoutMoney.Value = arrSum[1].ToString("N");
                 */


                /*
                 * //显示未做预算的预算设置表
                 * if (this.chkStatus1.Checked)
                 * {
                 *      EntityData entitySet = GetEmptyCostBudgetSet(this.txtProjectCode.Value);
                 *      foreach(DataRow drSet in entitySet.CurrentTable.Rows)
                 *      {
                 *              DataRow drNew = entity.CurrentTable.NewRow();
                 *
                 *              BLL.ConvertRule.DataRowCopy(drSet, drNew, entitySet.CurrentTable, entity.CurrentTable, new string[] {"ModifyPerson", "ModifyPersonName", "ModifyDate"});
                 *              drNew["CostBudgetCode"] = "NULL_" + drSet["CostBudgetSetCode"].ToString();
                 *
                 *              entity.CurrentTable.Rows.Add(drNew);
                 *      }
                 *      entitySet.Dispose();
                 * }
                 */

                BindDataGrid(entity.CurrentTable);
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示列表出错:" + ex.Message));
            }
        }
Пример #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                m_ProjectCode          = Request["ProjectCode"] + "";
                m_CostBudgetBackupCode = Request["CostBudgetBackupCode"] + "";
                m_Layer = BLL.ConvertRule.ToInt(Request["Layer"]);

                string   m_strGetType       = Request.QueryString["GetType"] + "";                      //数据分类
                string   m_strNodeId        = Request.QueryString["NodeId"] + "";                       //父节点编号
                string[] m_Layers           = (Request.QueryString["Layers"] + "").Split('.');          //定点展开的序列
                string   m_strSelectedLayer = Request.QueryString["SelectedLayer"] + "";                //定层展开的深度

                DataTable m_Table = new DataTable("CostBudgetSet");

                m_Table.Columns.Add("Type");
                m_Table.Columns.Add("CostBudgetSetCode");
                m_Table.Columns.Add("CostBudgetCode");
                m_Table.Columns.Add("ParentCode");
                m_Table.Columns.Add("CostBudgetSetName");
                m_Table.Columns.Add("Description");
                m_Table.Columns.Add("Layer");
                m_Table.Columns.Add("ChildNodesCount");
                m_Table.Columns.Add("ShowChildNodes");

                m_Table.Columns.Add("ShowSpan");
                m_Table.Columns.Add("ShowHref");

                m_Table.Columns.Add("CreatePersonName");
                m_Table.Columns.Add("CreateDate");
                m_Table.Columns.Add("ModifyPersonName");
                m_Table.Columns.Add("ModifyDate");

                m_Table.Columns.Add("IconName");
                m_Table.Columns.Add("IconDisplay");

                //差额着重提醒
                m_Table.Columns.Add("AttributesContractBudgetBalance");

                //金额字段
                foreach (string MoneyField in this.m_arrMoneyField)
                {
                    m_Table.Columns.Add(MoneyField);
                }

                string sql = "";

                if (m_CostBudgetBackupCode != "")                 //备份
                {
                    //取备份的预算设置表
                    CostBudgetBackupSetStrategyBuilder sb = new CostBudgetBackupSetStrategyBuilder();
                    sb.AddStrategy(new Strategy(CostBudgetBackupSetStrategyName.ProjectCode, m_ProjectCode));
                    sb.AddStrategy(new Strategy(CostBudgetBackupSetStrategyName.CostBudgetBackupCode, m_CostBudgetBackupCode));

                    //权限
                    ArrayList arA = new ArrayList();
                    arA.Add(user.UserCode);
                    arA.Add(user.BuildStationCodes());
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetBackupSetStrategyName.AccessRange, arA));

                    //缺省排序(项目总体费用排在最后)
                    sb.AddOrder("GroupSortID", true);
                    sb.AddOrder("PBSType", true);
                    sb.AddOrder("CostBudgetSetName", true);
                    sql = sb.BuildQueryViewString();
                }
                else
                {
                    //取预算表
                    CostBudgetStrategyBuilder sb = new CostBudgetStrategyBuilder();
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.ProjectCode, m_ProjectCode));

                    //仅预算(不要显示估算)
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.SetType, BLL.CostBudgetRule.m_BaseSetType));

                    //权限
                    ArrayList arA = new ArrayList();
                    arA.Add(user.UserCode);
                    arA.Add(user.BuildStationCodes());
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetStrategyName.AccessRange, arA));

                    //缺省排序(项目总体费用排在最后)
                    sb.AddOrder("GroupSortID", true);
                    sb.AddOrder("PBSType", true);
                    sb.AddOrder("CostBudgetSetName", true);
                    sql = sb.BuildQueryViewCostDynamicListString();
                }

                QueryAgent qa          = new QueryAgent();
                DataTable  m_DataTable = qa.ExecSqlForDataSet(sql).Tables[0];
                qa.Dispose();

                //加所属区域
                if (!m_DataTable.Columns.Contains("DistrictCode"))
                {
                    m_DataTable.Columns.Add("DistrictCode");
                }

//                ApplicationLog.SetLogPath("d:\\Temp\\");

                if (m_strGetType == "")
                {
                    GenerateGroupDyn(m_DataTable, true);
                }
                else
                {
                    GenerateGroupDyn(m_DataTable, false);
                }

                string filter = "";
                if (m_strGetType == "")
                {
                    #region 取第一层

                    //					DateTime t1 = DateTime.Now;

                    //合计清0
                    for (int i = 0; i < this.m_arrSum.Length; i++)
                    {
                        m_arrSum[i] = 0;
                    }

                    BLL.CostBudgetGroupDynamic[] dynGroups = GetAllGroupDyn();

                    if (dynGroups != null)
                    {
                        foreach (BLL.CostBudgetGroupDynamic dynGroup in dynGroups)
                        {
                            DataRow[] drs = m_DataTable.Select("GroupCode = '" + dynGroup.GroupCode + "'");
                            if (drs.Length > 0)
                            {
                                DataRow m_NewRow = m_Table.NewRow();
                                this.FillRowCostBudgetSetGroup(m_NewRow, drs[0], m_DataTable);
                                m_Table.Rows.Add(m_NewRow);
                            }
                        }

                        AddSumRow(m_Table);
                    }


                    //					DateTime t2 = DateTime.Now;
                    //					TimeSpan t = t2.Subtract(t1);
                    //					ApplicationLog.WriteLog(this.ToString(),"时间:" + t.Duration().ToString());

                    #endregion
                }
                else if (m_strGetType == "ChildNodes")
                {
                    #region 取某节点子目录

                    filter = "ParentCode='" + m_strNodeId + "'";
                    DataView m_DV = new DataView(m_DataTable, filter, "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(m_NewRow, m_Row.Row, m_DataTable);

                        m_Table.Rows.Add(m_NewRow);
                    }
                    #endregion
                }
                else if (m_strGetType == "ChildNodesOfGroup")
                {
                    #region 预算表类型展开

                    string GroupCode = m_strNodeId.Replace("G_", "");
                    filter = "GroupCode='" + GroupCode + "'";
                    DataView m_DV = new DataView(m_DataTable, filter, "", DataViewRowState.CurrentRows);

                    //若有区域,则先显示区域
                    foreach (DataRowView m_Row in m_DV)
                    {
                        m_Row.Row["DistrictCode"] = BLL.CostBudgetRule.GetPBSDistrictCode(BLL.ConvertRule.ToString(m_Row.Row["PBSType"]), BLL.ConvertRule.ToString(m_Row.Row["PBSCode"]));
                    }

                    DataView dvDistrict = BLL.ConvertRule.GetDistinct(m_DV, "DistrictCode");

                    //显示区域
                    foreach (DataRowView drvDistrict in dvDistrict)
                    {
                        DataRow drDistrict   = drvDistrict.Row;
                        string  DistrictCode = BLL.ConvertRule.ToString(drDistrict["DistrictCode"]);
                        if (DistrictCode != "")
                        {
                            DataRow m_NewRow = m_Table.NewRow();

                            this.FillRowDistrict(m_NewRow, DistrictCode, GroupCode);

                            m_Table.Rows.Add(m_NewRow);
                        }
                    }

                    //显示预算表
                    foreach (DataRowView m_Row in m_DV)
                    {
                        if (BLL.ConvertRule.ToString(m_Row.Row["DistrictCode"]) == "")
                        {
                            DataRow m_NewRow = m_Table.NewRow();

                            this.FillRow(m_NewRow, m_Row.Row, m_DataTable);

                            m_Table.Rows.Add(m_NewRow);
                        }
                    }

                    #endregion
                }
                else if (m_strGetType == "ChildNodesOfDistrict")
                {
                    #region 区域展开

                    string[] arrCode      = m_strNodeId.Replace("D_", "").Split(":"[0]);
                    string   GroupCode    = arrCode[0];
                    string   DistrictCode = arrCode[1];

                    filter = "GroupCode='" + GroupCode + "'";
                    DataView m_DV = new DataView(m_DataTable, filter, "", DataViewRowState.CurrentRows);

                    //显示预算表
                    foreach (DataRowView m_Row in m_DV)
                    {
                        //是否该区域下的
                        string CurrentDistrictCode = BLL.CostBudgetRule.GetPBSDistrictCode(BLL.ConvertRule.ToString(m_Row.Row["PBSType"]), BLL.ConvertRule.ToString(m_Row.Row["PBSCode"]));

                        if (DistrictCode == CurrentDistrictCode)
                        {
                            DataRow m_NewRow = m_Table.NewRow();

                            this.FillRow(m_NewRow, m_Row.Row, m_DataTable);

                            m_Table.Rows.Add(m_NewRow);
                        }
                    }

                    #endregion
                }
                else if (m_strGetType == "SingleNode")
                {
                    #region 单个节点

                    filter = "CostBudgetSetCode='" + Request.QueryString["CostBudgetSetCode"] + "" + "'";

                    DataView m_DV = new DataView(m_DataTable, filter, "  ", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(m_NewRow, m_Row.Row, m_DataTable);

                        m_Table.Rows.Add(m_NewRow);
                    }
                    #endregion
                }

                Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(m_Table));
            }
            catch (Exception ex)
            {
//                ApplicationLog.SetLogPath("d:\\Temp\\");
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }

            Response.End();
        }
Пример #3
0
        private void LoadDataGrid()
        {
            try
            {
                CostBudgetStrategyBuilder sb = new CostBudgetStrategyBuilder();
                sb.AddStrategy(new Strategy(CostBudgetStrategyName.ProjectCode, txtProjectCode.Value));

                if (this.ucInputSystemGroup.Value != "")
                {
                    ArrayList arGroup = new ArrayList();
                    arGroup.Add(this.ucInputSystemGroup.Value);
                    arGroup.Add("0");
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.GroupCodeEx, arGroup));
                }

                if (this.ucUnit.Value != "")
                {
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.UnitCode, this.ucUnit.Value));
                }

                if (this.ucPBS.Value != "")
                {
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.PBSType, this.ucPBS.PBSType));
                    sb.AddStrategy(new Strategy(CostBudgetStrategyName.PBSCode, this.ucPBS.Value));
                }

                if (this.txtAdvSearch.Value != "none")
                {
                    if (this.ucCreatePerson.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CreatePerson, this.ucCreatePerson.Value));
                    }
                    if (this.ucModifyPerson.Value != "")
                    {
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.ModifyPerson, this.ucModifyPerson.Value));
                    }

                    if (this.dtCreateDateBegin.Value != "" || this.dtCreateDateEnd.Value != "")
                    {
                        ArrayList ar = new ArrayList();
                        ar.Add(this.dtCreateDateBegin.Value);
                        ar.Add(this.dtCreateDateEnd.Value);
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.CreateDateRange, ar));
                    }

                    if (this.dtModifyDateBegin.Value != "" || this.dtModifyDateEnd.Value != "")
                    {
                        ArrayList ar = new ArrayList();
                        ar.Add(this.dtModifyDateBegin.Value);
                        ar.Add(this.dtModifyDateEnd.Value);
                        sb.AddStrategy(new Strategy(CostBudgetStrategyName.ModifyDateRange, ar));
                    }
                }

                //权限
                ArrayList arA = new ArrayList();
                arA.Add(user.UserCode);
                arA.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetStrategyName.AccessRange, arA));

                sb.AddOrder("CostBudgetSetName", true);
                string sql = sb.BuildQueryViewCostDynamicListString();

                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("CostBudgetSet", sql);
                qa.Dispose();

                /*
                 * string[] arrField = {"Money", "TotalPayoutMoney"};
                 * decimal[] arrSum = BLL.MathRule.SumColumn(entity.CurrentTable, arrField);
                 * this.txtSumMoney.Value = arrSum[0].ToString("N");
                 * this.txtSumTotalPayoutMoney.Value = arrSum[1].ToString("N");
                 */


                BindDataGrid(entity.CurrentTable);
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示列表出错:" + ex.Message));
            }
        }