protected void btnSave_Click(object sender, EventArgs e) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = false; if (State.Equals("new", StringComparison.OrdinalIgnoreCase)) { string conditionExpression = "RoleId = " + dplist.SelectedValue.Trim(); ret = bll.InsertRequestNodeRule(NodeID, txtDisplayName.Text, txtTableName.Text, conditionExpression); if (ret) { //ExecAlertScritp("添加成功"); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('添加成功');</script>"); } else { ExecAlertScritp("添加失败"); } } else if (State.Equals("edit", StringComparison.OrdinalIgnoreCase)) { string conditionExpression = "RoleId = " + dplist.SelectedValue.Trim(); ret = bll.UpdateRequestNodeRule(hfID.Value, NodeID, txtDisplayName.Text, txtTableName.Text, conditionExpression); if (ret) { //ExecAlertScritp("添加成功"); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('更新成功');</script>"); } else { ExecAlertScritp("更新失败"); } } }
/// <summary> /// 绑定GridView数据 /// </summary> private void BindRequestNode() { ProcessRuleBLL bll = new ProcessRuleBLL(); gvRequestNodes.DataSource = bll.GetRequestNodeByProcessID(ddlProcessType.SelectedValue); gvRequestNodes.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = false; if (State.Equals("new", StringComparison.OrdinalIgnoreCase)) { ret = bll.InsertRequestNode(CreateObject()); if (ret) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('添加成功');</script>"); } else { ExecAlertScritp("添加失败"); } } else { ret = bll.UpdateRequestNode(CreateObject()); if (ret) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('更新成功');</script>"); } else { ExecAlertScritp("更新失败"); } } }
private void ReviewSearch(IList <ApproveRuleGroupInfo> argList) { if (argList != null) { ViewState["SearchTable"] = argList; appedTable.Controls.Clear(); foreach (ApproveRuleGroupInfo info in argList) { //创建“编辑”和“删除”按钮 ImageButton btnEdit = new ImageButton(); btnEdit.ID = "btnEdit" + Guid.NewGuid().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" + Guid.NewGuid().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); ProcessRuleBLL bll = new ProcessRuleBLL(); 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"; gvTable.DataSource = ds.Tables[0]; gvTable.DataBind(); appedTable.Controls.Add(gvTable); } } }
protected void InintApproveRule(string tableId) { hfSelectedApproveNode.Value = string.Empty; hfSelectedRequestNode.Value = string.Empty; hfSelectedCheckBox.Value = string.Empty; //通过ID取得审批表选中的节点ID ProcessRuleBLL bll = new ProcessRuleBLL(); DataSet ds = bll.GetNodeIDsByTableID(tableId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { if (!hfSelectedRequestNode.Value.Contains(dr["RequestNodeID"].ToString())) { hfSelectedRequestNode.Value += dr["RequestNodeID"].ToString() + ";"; } if (!hfSelectedApproveNode.Value.Contains(dr["ProcessNodeID"].ToString())) { hfSelectedApproveNode.Value += dr["ProcessNodeID"].ToString() + ";"; } } } ds = bll.GetRuleInfoByTableID(tableId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { txtGroup.Text = ds.Tables[0].Rows[0]["GroupName"].ToString(); txtRequestSPName.Text = ds.Tables[0].Rows[0]["RequestSPName"].ToString(); //txtRuleTableName.Text = ds.Tables[0].Rows[0]["RuleTableName"].ToString(); } ReBindRuleTable(); }
protected void btnSave_Click(object sender, EventArgs e) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = false; string conditionExpression = "RoleId = " + dplist.SelectedValue.Trim(); if (string.IsNullOrEmpty(hfID.Value)) { ret = bll.InsertApproveNodeRule(NodeID, txtDisplayName.Text, txtTableName.Text, conditionExpression, dplistSPName.SelectedValue.Trim()); if (ret) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('添加成功');</script>"); } else { ExecAlertScritp("添加失败"); } } else { ret = bll.UpdateApproveNodeRule(hfID.Value, NodeID, txtDisplayName.Text, txtTableName.Text, conditionExpression, dplistSPName.SelectedValue.Trim()); if (ret) { //ExecAlertScritp("添加成功"); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('更新成功');</script>"); } else { ExecAlertScritp("更新失败"); } } }
/// <summary> /// 绑定节点 /// </summary> private void BindNode() { ProcessRuleBLL bll = new ProcessRuleBLL(); gvApproveNode.DataSource = bll.GetRequestNodeByProcessID(ProcessID); gvApproveNode.DataBind(); }
/// <summary> /// 当为编辑状态(edit)时绑定数据 /// </summary> private void BindData() { ProcessRuleBLL bll = new ProcessRuleBLL(); ProcessNodeInfo pn = bll.GetProcessNodeByNodeID(NodeID); if (pn != null) { txtNodeName.Text = pn.NodeName; //cbMeet.Checked = pn.IsAllowMeet; //cbEndorsement.Checked = pn.IsAllowEndorsement; //cbIsAllowSpecialApproval.Checked = pn.IsAllowSpecialApproval; //txtApproveRule.Text = pn.ApproveRule.ToString(); //txtDeclineRule.Text = pn.DeclineRule.ToString(); txtURL.Text = pn.URL; txtNotification.Text = pn.Notification; txtOrderNo.Text = pn.OrderNo.ToString(); if (pn.WayBackNodeID != Guid.Empty) { foreach (ListItem li in ddlWayBack.Items) { if (li.Value.Equals(pn.WayBackNodeID.ToString(), StringComparison.OrdinalIgnoreCase)) { li.Selected = true; break; } } } //绑定加权方式 foreach (ListItem li in ddlWeighted.Items) { if (li.Value.Equals(pn.WeightedType, StringComparison.OrdinalIgnoreCase)) { li.Selected = true; break; } } txtSamplingRate.Text = pn.SamplingRate; if (pn.DepartCode != "") { ListItem listItem = new ListItem(pn.DepartName, pn.DepartCode); ddlDept.Items.Add(listItem); } //所属部门 //foreach (ListItem li in ddlDept.Items) //{ // if (li.Value.Equals(pn.DepartCode, StringComparison.OrdinalIgnoreCase)) // { // li.Selected = true; // break; // } //} } }
private void BindDeptList() { ProcessRuleBLL bll = new ProcessRuleBLL(); //绑定所属部门 List <PWorldDeptInfo> lPdi = bll.GetPWorldDepartment(); this.gvDeptList.DataSource = lPdi; gvDeptList.DataBind(); }
/// <summary> /// 当为编辑状态(edit)时绑定数据 /// </summary> private void BindData() { ProcessRuleBLL bll = new ProcessRuleBLL(); RequestNodeInfo info = bll.GetRequestNodeByNodeId(NodeID); if (info != null) { txtNodeName.Text = info.NodeName; txtExpression.Text = info.Expression; hfProcessID.Value = info.ProcessID.ToString(); } }
protected void btnSave_Click(object sender, EventArgs e) { BindRuleTable(); string xml = CreateRuleXML(); ProcessRuleBLL bll = new ProcessRuleBLL(); string ruleTableName = "Tb_" + txtGroup.Text; bll.InsertApproveRule(xml, txtRequestSPName.Text, ruleTableName, txtGroup.Text, ddlProcessType.SelectedValue); MessageBox.ShowAndClose(this.Page, "操作成功", "/Admin/ApproveRuleManage.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = bll.InsertFormula(ddlProcessType.SelectedValue, ddlGroup.SelectedValue, txtExpression.Text.Replace(" ", "").Replace("AND", "*").Replace("OR", "+").Replace("NOT", "-")); if (ret) { MessageBox.Show(this.Page, "操作成功"); } else { MessageBox.Show(this.Page, "操作失败"); } }
/// <summary> /// 绑定公式 /// </summary> private void BindFormula() { ProcessRuleBLL bll = new ProcessRuleBLL(); IList <FormulaInfo> flList = bll.GetFormulaByGroupName(ddlProcessType.SelectedValue, ddlGroup.SelectedValue); if (flList != null && flList.Count > 0) { foreach (FormulaInfo info in flList) { txtExpression.Text = info.Formula.Replace("*", "AND").Replace("+", "OR").Replace("-", "NOT"); break; } } }
/// <summary> /// 删除流程审批节点 /// </summary> /// <returns></returns> private string DeleteRequestNode() { string nodeId = HttpContext.Current.Request.Params["nodeId"]; if (!string.IsNullOrEmpty(nodeId)) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = bll.DeleteRequestNode(nodeId); if (ret) { return("1"); } } return("0"); }
/// <summary> /// 删除规则表 /// </summary> /// <param name="tableId"></param> /// <returns></returns> private string DeleteRuleTable() { string tableId = HttpContext.Current.Request.Params["tableId"]; if (!string.IsNullOrEmpty(tableId)) { ProcessRuleBLL bll = new ProcessRuleBLL(); bool ret = bll.DeleteRuleTableByID(tableId); //bool ret = true; if (ret) { return("1"); } } return("0"); }
private void BindData() { ProcessRuleBLL bll = new ProcessRuleBLL(); RequestNodeRuleInfo info = bll.GetRequestRuleByNodeID(NodeID); if (info != null) { txtDisplayName.Text = info.KeyName; txtTableName.Text = info.TableName; txtConditionExpression.Text = info.ConditionExpression; string[] express = info.ConditionExpression.Split('='); dplist.SelectedValue = express[1].Trim(); hfID.Value = info.ID.ToString(); } }
private void BindGroup() { ddlGroup.Items.Clear(); ProcessRuleBLL bll = new ProcessRuleBLL(); IList <ApproveRuleGroupInfo> argi = bll.GetApproveRuleGroupNameByProcessType(ddlProcessType.SelectedValue); if (argi != null && argi.Count > 0) { foreach (ApproveRuleGroupInfo tmp in argi) { ListItem li = new ListItem(); li.Text = tmp.GroupName; li.Value = tmp.GroupName; ddlGroup.Items.Add(li); } } }
/// <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 btnSave_Click(object sender, EventArgs e) { BindRuleTable(); string xml = CreateRuleXML(); ProcessRuleBLL bll = new ProcessRuleBLL(); bll.InsertApproveRule(xml, txtRequestSPName.Text, txtRuleTableName.Text, txtGroup.Text, ddlProcessType.SelectedValue); //重新绑定 BindProcessType(); BindGroup(); txtGroup.Text = string.Empty; txtRequestSPName.Text = string.Empty; txtRuleTableName.Text = string.Empty; MessageBox.Show(this.Page, "操作成功"); }
/// <summary> /// 绑定流程下所有的审批节点 /// </summary> private void BindNodes() { ProcessRuleBLL bll = new ProcessRuleBLL(); List <ProcessNodeInfo> pnList = bll.GetProcessNodesByProcessID(ProcessID); ddlWayBack.DataSource = pnList; ddlWayBack.DataBind(); ddlWayBack.Items.Insert(0, new ListItem()); //绑定所属部门 //List<PWorldDeptInfo> lPdi = bll.GetPWorldDepartment(); //foreach (PWorldDeptInfo pdi in lPdi) //{ // ddlDept.Items.Add(new ListItem(pdi.DepartName, pdi.DepartCode)); //} //ddlDept.Items.Insert(0, new ListItem()); }
private StringBuilder Valiedate() { if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["FilterCount"]) && !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["FilterCond"])) { string str = HttpContext.Current.Request.QueryString["FilterCond"]; int count = int.Parse(HttpContext.Current.Request.QueryString["FilterCount"]); StringBuilder ret = new StringBuilder(); str = str.Replace("AND", " AND ").Replace("OR", " OR ").Replace("NOT", " AND ").Replace("(", " ( ").Replace(")", " ) "); //格式化 string[] strArray = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in strArray) { if (StringHelper.IsInt(s)) { ret.Append(s + " = " + s); } else { ret.Append(" " + s + " "); } } string sQLValue = "select * from FilterConditionParse where "; StringBuilder builder = new StringBuilder(); //for (int i = count; i > 0; i--) //{ // if (str.ToString().Contains(i.ToString())) // { // str = str.Replace(i.ToString(), "[" + i.ToString() + "] = [" + i.ToString() + "]"); // } //} sQLValue = sQLValue + ret.ToString(); ProcessRuleBLL bll = new ProcessRuleBLL(); string str4 = bll.ValidateExpression(sQLValue); if (str4.Length == 0) { str4 = "true"; } builder.Append(str4); return(builder); } return(null); }
/// <summary> /// 绑定规则表 /// </summary> private void BindRuleTable() { ddlSelectID.Items.Clear(); ProcessRuleBLL bll = new ProcessRuleBLL(); if (ddlProcessType.Items.Count > 0 && ddlGroup.Items.Count > 0) { IList <ApproveRuleGroupInfo> argiList = bll.GetApproveTableByProcessID(ddlProcessType.SelectedValue, ddlGroup.SelectedValue); gvRuleList.DataSource = argiList; gvRuleList.DataBind(); //绑定下拉框 if (argiList != null) { foreach (ApproveRuleGroupInfo info in argiList) { ListItem li = new ListItem(); li.Text = info.OrderNo.ToString(); li.Value = info.OrderNo.ToString(); ddlSelectID.Items.Add(li); } } } }
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(); } } } }
private void ReBindRuleTable() { if (!string.IsNullOrEmpty(hfSelectedApproveNode.Value) || !string.IsNullOrEmpty(hfSelectedRequestNode.Value)) { tApproveTable.Rows.Clear(); //选择的审批节点 ProcessRuleBLL bll = new ProcessRuleBLL(); IList <ProcessNodeInfo> pnList = bll.GetApproveNodesByNodeIds(hfSelectedApproveNode.Value); //选择的申请节点 IList <RequestNodeInfo> rnList = bll.GetRequestNodesByNodeIds(hfSelectedRequestNode.Value); if (pnList != null) { TableRow trHead = new TableRow(); TableCell tcHeadFoodName = new TableCell(); TableCell tcHeadType = new TableCell(); tcHeadFoodName.Text = "发起节点"; tcHeadType.Text = "表达式"; trHead.Cells.Add(tcHeadFoodName); trHead.Cells.Add(tcHeadType); trHead.HorizontalAlign = HorizontalAlign.Center; trHead.Height = 30; //循环创建列 foreach (ProcessNodeInfo info in pnList) { TableCell tdc = new TableCell(); tdc.Text = info.NodeName; trHead.Cells.Add(tdc); } tApproveTable.Rows.Add(trHead); int rowLoop = 0; int colLoop = 1; if (rnList != null) { //循环创建行 foreach (RequestNodeInfo info in rnList) { colLoop = 1; ++rowLoop; TableRow tr = new TableRow(); TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); Label lb1 = new Label(); lb1.ID = info.NodeID.ToString(); lb1.Text = info.NodeName; Label lb2 = new Label(); lb2.ID = info.NodeID.ToString() + "_2"; lb2.Text = info.Expression; tc1.Controls.Add(lb1); tr.Cells.Add(tc1); tc2.Controls.Add(lb2); tr.Cells.Add(tc2); //添加CheckBox foreach (ProcessNodeInfo pn in pnList) { ++colLoop; TableCell tc = new TableCell(); CheckBox cb = new CheckBox(); cb.ID = "cbApprove" + rowLoop + colLoop; cb.Attributes.Add("RID", info.NodeID.ToString()); cb.Attributes.Add("PID", pn.NodeID.ToString()); cb.Attributes.Add("onclick", "checkNode(this,'" + info.NodeID.ToString() + "','" + pn.NodeID.ToString() + "')"); cb.Checked = bll.GetIsApproveByNodeIDs(info.NodeID.ToString(), pn.NodeID.ToString(), ddlGroup.SelectedValue); if (cb.Checked) { hfSelectedCheckBox.Value += info.NodeID.ToString() + ";" + pn.NodeID.ToString() + ";"; } tc.Controls.Add(cb); tr.Cells.Add(tc); } tApproveTable.Rows.Add(tr); } } } } }
/// <summary> /// 更新节点 /// </summary> /// <param name="pn"></param> /// <returns></returns> private bool UpdateProcessNode(ProcessNodeInfo pn) { ProcessRuleBLL bll = new ProcessRuleBLL(); return(bll.UpdateProcessNode(pn)); }
/// <summary> /// 创建节点 /// </summary> /// <param name="pn"></param> /// <returns></returns> private bool AddProcessNode(ProcessNodeInfo pn) { ProcessRuleBLL bll = new ProcessRuleBLL(); return(bll.InsertProcessNode(pn)); }