/// <summary> /// 绑定查询后的审批表 /// </summary> private void BindSearchRuleTable() { ProcessRuleBLL bll = new ProcessRuleBLL(); if (ddlGroup.Items.Count > 0 && ddlProcessType.Items.Count > 0) { IList <ApproveRuleGroupInfo> argList = bll.GetApproveRuleGroupByGroupNameAndProcessID(ddlGroup.SelectedItem.Text, ddlProcessType.SelectedValue); if (argList != null) { ViewState["SearchTable"] = argList; appedTable.Controls.Clear(); foreach (ApproveRuleGroupInfo info in argList) { //创建“编辑”和“删除”按钮 ImageButton btnEdit = new ImageButton(); btnEdit.ID = "btnEdit" + info.ID.ToString(); btnEdit.ImageUrl = "../pic/btnImg/btnEdt_nor.png"; btnEdit.Attributes["ApproveID"] = info.ID.ToString(); btnEdit.OnClientClick = "return EditTable('" + info.ID.ToString() + "')"; ImageButton btnDel = new ImageButton(); btnDel.ID = "btnDel" + info.ID.ToString(); btnDel.ImageUrl = "../pic/btnImg/btnDelete_nor.png"; btnDel.Attributes["ApproveID"] = info.ID.ToString(); btnDel.OnClientClick = "return DelTable('" + info.ID.ToString() + "')"; appedTable.Controls.Add(btnEdit); appedTable.Controls.Add(btnDel); DataSet ds = bll.GetApproveTableExtendByTableName(info.RuleTableName, info.ProcessID.ToString()); //审批表 GridView gvTable = new GridView(); gvTable.RowDataBound += new GridViewRowEventHandler(gvTable_RowDataBound); gvTable.Width = new Unit(540); gvTable.CssClass = "datalist2"; DataTable dt = null; if (ds != null) { dt = ds.Tables[0]; } gvTable.DataSource = ds; gvTable.DataBind(); appedTable.Controls.Add(gvTable); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["ProcessID"]) && !string.IsNullOrEmpty(Request.QueryString["GroupName"]) && !string.IsNullOrEmpty(Request.QueryString["Formula"])) { ProcessRuleBLL bll = new ProcessRuleBLL(); IList <ApproveRuleGroupInfo> argList = bll.GetApproveRuleGroupByGroupNameAndProcessID(Request.QueryString["GroupName"], Request.QueryString["ProcessID"]); List <DataTable> dtList = new List <DataTable>(); DataTable result; if (argList != null) { //int pos = 0; foreach (ApproveRuleGroupInfo info in argList) { DataSet ds = bll.GetApproveTableByTableName(info.RuleTableName, info.ProcessID.ToString()); //审批表 dtList.Add(ds.Tables[0]); } result = dtList[0].Copy(); result.Clear(); StringBuilder sb = new StringBuilder(); Descartes.TableDescarts(dtList, result, 0, sb); ChangeSpaceToNbsp(result); Expression expression = new Expression(); DataTable dts = new DataTable(); DataTable resultModel = new DataTable(); string formula = Request.QueryString["Formula"]; formula = formula.Replace(" ", "").Replace("AND", "*").Replace("OR", "+").Replace("NOT", "-"); expression.clac(formula, result, ref dts, ref resultModel); //测试用 DataTable t = Expression.GetResultCollection(dts, resultModel); gvConfiguration.DataSource = t; gvConfiguration.DataBind(); } } } }