private void LoadDataGrid() { try { CostBudgetSetStrategyBuilder sb = new CostBudgetSetStrategyBuilder(); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.ProjectCode, txtProjectCode.Value)); switch (this.txtType.Value.ToLower()) { case "notarget": //未做目标费用的 sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.NoTarget)); break; case "nobudget": //未做预算的 sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.NoBudget)); break; } //权限 ArrayList arA = new ArrayList(); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetSetStrategyName.AccessRange, arA)); //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); if (sortsql == "") { //缺省排序 sb.AddOrder("CostBudgetSetName", true); } string sql = sb.BuildQueryViewString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } Rms.ORMap.QueryAgent qa = new QueryAgent(); DataTable tb = qa.ExecSqlForDataSet(sql).Tables[0]; qa.Dispose(); this.dgList.DataSource = tb; this.dgList.DataBind(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "加载字典选择列表错误。"); Response.Write(Rms.Web.JavaScript.Alert(true, "加载字典选择列表错误。")); } }
private void showtree() { string CostBudgetSetCode = "" + Request["CostBudgetSetCode"]; ((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).Nodes.Clear(); string sqlUnit = "Select * from Building"; QueryAgent qa = new QueryAgent(); tbUnit = qa.ExecSqlForDataSet(sqlUnit).Tables[0]; string projectcode = Request.QueryString["ProjectCode"] + ""; //取目标费用表 CostBudgetSetStrategyBuilder sb = new CostBudgetSetStrategyBuilder(); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.ProjectCode, projectcode)); string sql; //权限 //ArrayList arA = new ArrayList(); //arA.Add(user.UserCode); //arA.Add(user.BuildStationCodes()); //sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetSetStrategyName.AccessRange, arA)); //缺省排序(项目总体费用排在最后) sb.AddOrder("GroupSortID", true); sb.AddOrder("PBSType", true); sb.AddOrder("CostBudgetSetName", true); sql = sb.BuildQueryViewString(); QueryAgent qal = new QueryAgent(); DataTable m_DataTable = qal.ExecSqlForDataSet(sql).Tables[0]; qal.Dispose(); //为初始化树节点做准备 DataRow[] inidrs = m_DataTable.Select("CostBudgetSetCode = '" + CostBudgetSetCode + "'"); if (inidrs.Length > 0) { this.PBSTypeID.Value = inidrs[0]["PBSType"].ToString(); PBSCodeID.Value = inidrs[0]["PBSCode"].ToString(); PBSNameID.Value = inidrs[0]["PBSName"].ToString(); this.txtSelectCostBudgetSetCode.Value = inidrs[0]["CostBudgetSetCode"].ToString(); RegisterClientScriptBlock("IsExecSearchTree", "<script>IsExecSearchTree = 1;</script>"); this.RadComboBox1.Items[0].Text = inidrs[0]["CostBudgetSetName"].ToString(); } ArrayList al = new ArrayList(); foreach (DataRow dr in m_DataTable.Rows) { string GroupCode = RmsPM.BLL.ConvertRule.ToString(dr["GroupCode"]); if ((GroupCode != "") && (al.IndexOf(GroupCode) < 0)) { al.Add(GroupCode); } } foreach (string GroupCode in al) { DataRow[] drs = m_DataTable.Select("GroupCode = '" + GroupCode + "'"); if (drs.Length > 0) { TreeNode mytree = new TreeNode(); mytree.Value = drs[0]["GroupCode"].ToString(); mytree.Text = drs[0]["GroupName"].ToString(); mytree.NavigateUrl = "#"; ((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).Nodes.Add(mytree); My2((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1"), mytree, m_DataTable); } } ((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).ExpandAll(); //((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).ShowExpandCollapse = false; //((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).ImageSet = System.Web.UI.WebControls.TreeViewImageSet.Arrows; //((TreeView)this.RadComboBox1.Items[0].FindControl("TreeView1")).Attributes.Add("onclick", "clicktr()"); }
private void LoadDataGrid() { try { CostBudgetSetStrategyBuilder sb = new CostBudgetSetStrategyBuilder(); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.ProjectCode, txtProjectCode.Value)); if (this.ucInputSystemGroup.Value != "") { ArrayList arGroup = new ArrayList(); arGroup.Add(this.ucInputSystemGroup.Value); arGroup.Add("0"); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.GroupCodeEx, arGroup)); } if (this.ucUnit.Value != "") { sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.UnitCode, this.ucUnit.Value)); } if (this.ucPBS.Value != "") { sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.PBSType, this.ucPBS.PBSType)); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.PBSCode, this.ucPBS.Value)); } if (this.txtAdvSearch.Value != "none") { if (this.ucCreatePerson.Value != "") { sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.CreatePerson, this.ucCreatePerson.Value)); } if (this.ucModifyPerson.Value != "") { sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.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(CostBudgetSetStrategyName.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(CostBudgetSetStrategyName.ModifyDateRange, ar)); } } //权限 ArrayList arA = new ArrayList(); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetSetStrategyName.AccessRange, arA)); //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); if (sortsql == "") { //缺省排序(项目总体费用排在最后) sb.AddOrder("GroupSortID", true); sb.AddOrder("PBSType", true); sb.AddOrder("CostBudgetSetName", true); } string sql = sb.BuildQueryViewString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } 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)); } }
protected void Page_Load(object sender, System.EventArgs e) { try { m_ProjectCode = Request["ProjectCode"] + ""; 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("CostBudget"); m_Table.Columns.Add("Type"); m_Table.Columns.Add("CostBudgetCode"); m_Table.Columns.Add("CostBudgetSetCode"); m_Table.Columns.Add("CostBudgetSetName"); m_Table.Columns.Add("VerName"); m_Table.Columns.Add("VerID"); m_Table.Columns.Add("CostBudgetName"); m_Table.Columns.Add("StatusName"); m_Table.Columns.Add("ParentCode"); 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"); //金额字段 foreach (string MoneyField in this.m_arrMoneyField) { m_Table.Columns.Add(MoneyField); } string sql = ""; //取目标费用表 CostBudgetSetStrategyBuilder sb = new CostBudgetSetStrategyBuilder(); sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.ProjectCode, m_ProjectCode)); //权限 ArrayList arA = new ArrayList(); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetSetStrategyName.AccessRange, arA)); //缺省排序(项目总体费用排在最后) sb.AddOrder("GroupSortID", true); sb.AddOrder("PBSType", true); sb.AddOrder("CostBudgetSetName", true); sql = sb.BuildQueryViewString(); 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\\"); string filter = ""; if (m_strGetType == "") { #region 取第一层 //合计清0 for (int i = 0; i < this.m_arrSum.Length; i++) { m_arrSum[i] = 0; } ArrayList al = new ArrayList(); foreach (DataRow dr in m_DataTable.Rows) { string GroupCode = BLL.ConvertRule.ToString(dr["GroupCode"]); if ((GroupCode != "") && (al.IndexOf(GroupCode) < 0)) { al.Add(GroupCode); } } foreach (string GroupCode in al) { DataRow[] drs = m_DataTable.Select("GroupCode = '" + 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); #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"]) == "") { string CostBudgetSetCode = BLL.ConvertRule.ToString(m_Row.Row["CostBudgetSetCode"]); FillCostBudgetSet(CostBudgetSetCode, m_Row.Row, m_Table, m_DataTable); } } #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) { string CostBudgetSetCode = BLL.ConvertRule.ToString(m_Row.Row["CostBudgetSetCode"]); FillCostBudgetSet(CostBudgetSetCode, m_Row.Row, m_Table, m_DataTable); } } #endregion } else if (m_strGetType == "ChildNodesOfTarget") { #region 目标费用展开,显示该目标费用的其它版本 EntityData entityCurr = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetByCode(m_strNodeId); if (entityCurr.HasRecord()) { string CostBudgetSetCode = entityCurr.GetString("CostBudgetSetCode"); filter = "CostBudgetSetCode='" + CostBudgetSetCode + "'"; DataView m_DV = new DataView(m_DataTable, filter, "", DataViewRowState.CurrentRows); if (m_DV.Count > 0) { //取该目标费用的其它版本 EntityData entityTarget = DAL.EntityDAO.CostBudgetDAO.GetCostBudgetByStatus(CostBudgetSetCode, 1, "0,1,2,3", true); DataView dvTarget = new DataView(entityTarget.CurrentTable, string.Format("CostBudgetCode <> '{0}'", m_strNodeId), "VerID desc", DataViewRowState.CurrentRows); foreach (DataRowView drvTarget in dvTarget) { DataRow m_NewRow = m_Table.NewRow(); this.FillRow(m_NewRow, m_DV[0].Row, m_DataTable, drvTarget.Row); m_Table.Rows.Add(m_NewRow); } entityTarget.Dispose(); } } entityCurr.Dispose(); #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(); }