protected void btnCheckProc_Click(object sender, EventArgs e) { string outMsg = ""; if (WFAdmin.IsProcessDBSetOK(wfid, procid, out outMsg) && WFAdmin.IsProcessSetComp(wfid, procid, false)) { litWarn.Text = "过程配置正确!"; } else { litWarn.Text = "过程配置错误!"; } }
/// <summary> /// 删除节点 /// </summary> /// <returns></returns> private string delStep() { WF_STEP_TPL valObj = new WF_STEP_TPL(); try { int count = WFAdmin.delStep(Common.GetReqIntValue("STEP_ID")); if (count > 0) { return(count.ToString()); } else { return("0"); } } catch { return("-1"); } }
protected void btnApplyTo_Click(object sender, EventArgs e) { string outMsg = ""; if (WFAdmin.IsProcessDBSetOK(wfid, procid, out outMsg) && WFAdmin.IsProcessSetComp(wfid, procid, false)) { int re = WFAdmin.ApplyProcess(procid); if (re > 0) { litWarn.Text = "更新过程成功!"; BLLTable <WF_INFO> .Factory(conn).Update(WF_INFO.Attribute.WFID, wfid, WF_INFO.Attribute.STATUS, 1); } else { litWarn.Text = "更新过程失败!"; } } else { litWarn.Text = "过程未配置完成,不能执行此操作!"; } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Convert.ToInt32(Request["KeyID"]);//3 审核人条件 } if (!string.IsNullOrEmpty(Request["STEP_ID"])) { keyid = Convert.ToInt32(Request["STEP_ID"]);//2 普通路径条件 } if (!string.IsNullOrEmpty(Request["StepID"])) { keyid = Convert.ToInt32(Request["StepID"]); } if (keyid == 0) { Response.Write("非法连接!"); Response.End(); } if (!string.IsNullOrEmpty(Request["WFID"])) { wfid = Convert.ToInt32(Request["WFID"]); } if (!string.IsNullOrEmpty(Request["from"])) { from = Request["from"];//2 普通路径条件 3 审核人条件 } if (!IsPostBack) { //Response.Write(Request.Url.AbsoluteUri); if (wfid > 0) { var ocjWFC = BLLTable <WF_INFO> .Factory(conn).GetRowData(WF_INFO.Attribute.WFID, wfid); //afname = ocjWFC.WFName; //wfcname = ocjWFC.WFCNAME; //List<WFCondCol> lstCol = BLLTable<WFCondCol>.GetRowsList(WFCondCol.Attribute.WFName, afname); //for (int i = 0; i < lstCol.Count; i++) //{ // litCol1.Text += "<option value=\"" + lstCol[i].ColName + "\" title=\"" + lstCol[i].ColNote + "\">" + lstCol[i].ColCName + "</option>"; // litCol2.Text += "<option value=\"" + lstCol[i].ColName + "\" title=\"" + lstCol[i].ColNote + "\">" + lstCol[i].ColCName + "</option>"; // //ListItem li1 = new ListItem(lstCol[i].ColCName, lstCol[i].ColName); // //selCol1.Items.Add(li1); // //ListItem li2 = new ListItem(lstCol[i].ColCName, lstCol[i].ColName); // //selCol2.Items.Add(li2); //} string colsHtml = WFAdmin.GetSelectTbColsHtmlByWFID(wfid); //Response.Write(colsHtml + afname); litCol1.Text = colsHtml; litCol2.Text = colsHtml; } btnBack.Attributes.Add("onclick", "window.close();return false;"); string condStr = ""; string formula = ""; if (Request["setPathCond"] != null)//设置路径条件 { WF_STEPATH_TPL cond = new WF_STEPATH_TPL(); cond.STEP_ID = int.Parse(Request["StepID"]); cond.NEXT_ID = int.Parse(Request["NextID"]); WF_STEPATH_TPL Obj = BLLTable <WF_STEPATH_TPL> .Factory(conn).GetRowData(new WF_STEPATH_TPL(), cond); WF_STEP_TPL ObjStep1 = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, cond.STEP_ID); WF_STEP_TPL ObjStep = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, cond.NEXT_ID); litStep.Text = ObjStep1.STEP_NAME + " 到 " + ObjStep.STEP_NAME; if (Obj != null) { condStr = Obj.CONDITION; formula = Obj.FORMULAR; } //Response.Write(condStr); } if (keyid > 0) { if (from == "1")//步骤显示条件--无用 chx { WF_STEP_TPL Obj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, keyid); litStep.Text = Obj.STEP_NAME; if (Obj != null) { condStr = Obj.CONDITION; formula = Obj.FORMULAR; } } else if (from == "2")//普通路径条件 { //Response.Write("ddd"); WF_STEPATH_TPL cond = new WF_STEPATH_TPL(); cond.STEP_ID = keyid; cond.NEXT_ID = int.Parse(Request["NextID"]); cond.PATH_TYPE = int.Parse(Request["PATH_TYPE"]); WF_STEPATH_TPL Obj = BLLTable <WF_STEPATH_TPL> .Factory(conn).GetRowData(new WF_STEPATH_TPL(), cond); WF_STEP_TPL ObjStep1 = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, keyid); WF_STEP_TPL ObjStep = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, cond.NEXT_ID); litStep.Text = ObjStep1.STEP_NAME + " 到 " + ObjStep.STEP_NAME; if (Obj != null) { condStr = Obj.CONDITION; formula = Obj.FORMULAR; } } else if (from == "3")//审核人条件 { WF_CHECKER_TPL ObjCk = BLLTable <WF_CHECKER_TPL> .Factory(conn).GetRowData(WF_CHECKER_TPL.Attribute.CHECKER_ID, keyid); if (ObjCk != null) { litStep.Text = ObjCk.STAFF_NAME; condStr = ObjCk.CONDITION; formula = ObjCk.FORMULAR; } } else if (from == "4")//使用哪个过程条件 { WF_PROCESS_TPL recSet = BLLTable <WF_PROCESS_TPL> .Factory(conn).GetRowData(WF_PROCESS_TPL.Attribute.PROCID, keyid); litStep.Text = recSet.PROC_NAME; condStr = recSet.CONDITION; formula = recSet.FORMULAR; } else if (from == "5")//通知人条件 { WF_NOTIFIER_TPL ObjCk = BLLTable <WF_NOTIFIER_TPL> .Factory(conn).GetRowData(WF_NOTIFIER_TPL.Attribute.NOTIFIER_ID, keyid); if (ObjCk != null) { litStep.Text = ObjCk.STAFF_NAME; condStr = ObjCk.CONDITION; formula = ObjCk.FORMULAR; } } //else if (from == "6")//通知人条件 //{ // WF_STEPState recSet = BLLTable<WF_STEPState>.Factory(conn).GetRowData(WF_STEPState.Attribute.StateID, keyid); // litStep.Text = "可选状态条件"; // condStr = recSet.CONDITION; // formula = recSet.FORMULAR; //} } //Response.Write(condStr); if (!string.IsNullOrEmpty(condStr)) { string show = formula.Substring(0, 4); selIsShow.Value = show; string str = condStr; if (str.Trim() != "") { string[] arrCond = StringHelper.GetStringArray(str, '|'); condNum = arrCond.Length.ToString(); for (int i = 0; i < arrCond.Length; i++) { StringBuilder sbThml = new StringBuilder("<tr id='tr_");//show: int Num = i + 1; sbThml.Append(Num).Append("'><td><span>"); sbThml.Append(Num).Append("</span></td><td>"); sbThml.Append("<input name='txtCond_").Append(Num).Append("' readonly='readonly' type='text' value='");// sbThml.Append(arrCond[i]).Append("' title=\"").Append(createDataObj(arrCond[i])).Append("\" /></td><td>"); sbThml.Append("<a href='#' onclick='editCond(this);'>修改</a> <a href='#' onclick='delCond(this);'>删除</a></td></tr>"); litConds.Text += sbThml.ToString(); } } if (formula.Length > 5) { txtGongShi.Value = formula.Substring(5); } } } }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "管理 "; if (!string.IsNullOrEmpty(Request["WFID"])) { wfid = int.Parse(Request["WFID"]); } else { if (!string.IsNullOrEmpty(Request["PROCID"])) { procid = int.Parse(Request["PROCID"]); WF_PROCESS_TPL proc = BLLTable <WF_PROCESS_TPL> .Factory(conn).GetRowData(WF_PROCESS_TPL.Attribute.PROCID, procid); wfid = proc.WFID; title += proc.PROC_NAME + "-"; } else { Response.Write("非法连接!"); Response.End(); } } if (!string.IsNullOrEmpty(Request["PROCID"])) { procid = int.Parse(Request["PROCID"]); } else { List <WF_PROCESS_TPL> lstProc = BLLTable <WF_PROCESS_TPL> .Factory(conn).Select(WF_PROCESS_TPL.Attribute.WFID, wfid); if (lstProc.Count > 0) { procid = lstProc[0].PROCID; title += lstProc[0].PROC_NAME + "-"; } else { ScriptHelper.AlertAndGo(Page, "此流程未配置过程!", "../PROCESS/PROCESSManage.aspx?WFID=" + wfid); } } if (!IsPostBack) { #region//数据初始化 WF_STEP_TPL rule_b = new WF_STEP_TPL(); rule_b.WFID = wfid; rule_b.PROCID = procid; rule_b.STEP_TYPE = 0; WF_STEP_TPL bObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(new WF_STEP_TPL(), rule_b); if (bObj == null) { rule_b.CONDITION = ""; rule_b.FORMULAR = ""; rule_b.STEP_NAME = "开始"; BLLTable <WF_STEP_TPL> .Factory(conn).Insert(rule_b, WF_STEP_TPL.Attribute.STEP_ID); bObj = rule_b; } litB.Text = bObj.STEP_NAME; beginID = bObj.STEP_ID; WF_STEP_TPL rule_e = new WF_STEP_TPL(); rule_e.WFID = wfid; rule_e.PROCID = procid; rule_e.STEP_TYPE = 3; WF_STEP_TPL eObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(new WF_STEP_TPL(), rule_e); if (eObj == null) { rule_e.CONDITION = ""; rule_e.FORMULAR = ""; rule_e.STEP_NAME = "结束"; BLLTable <WF_STEP_TPL> .Factory(conn).Insert(rule_e, WF_STEP_TPL.Attribute.STEP_ID); eObj = rule_e; } litE.Text = eObj.STEP_NAME; endID = eObj.STEP_ID; WF_INFO wf = BLLTable <WF_INFO> .Factory(conn).GetRowData(WF_INFO.Attribute.WFID, wfid); if (wf.STATUS != "1") { btnApplyTo.Enabled = false; btnApplyProc.Disabled = true; } #endregion Dictionary <int, WF_STEP_TPL> noUseSTep = new Dictionary <int, WF_STEP_TPL>(); //流程图形设计器: litStepMap.Text = WFAdmin.ShowStepPathMap(wfid, procid, out noUseSTep); if (noUseSTep.Count > 0) { StringBuilder sbMap = new StringBuilder(); foreach (KeyValuePair <int, WF_STEP_TPL> val in noUseSTep) { string data = "{id:'" + val.Value.STEP_ID + "',name:'" + val.Value.STEP_NAME + "',type:'" + val.Value.STEP_TYPE + "'}"; sbMap.Append("<div class='step type-" + val.Value.STEP_TYPE + "' data=\"" + data + "\"><b>" + val.Value.STEP_NAME + "</b>"); sbMap.Append("</div>"); } litSteps.Text = sbMap.ToString(); } } Page.Title = title; }
protected void Page_Load(object sender, EventArgs e) { //Response.Write("111"); //Response.End(); //return; if (Request["addNewToRow"] != null) { #region//添加新节点节点---a,b和d之间插入节点c: //删除连接到节点c的路径[code1];删除原来 a,b和d之间的路径[code2];插入a,b和c之间,c和d之间的路径[code3]。 // WF_STEP_TPL valObj = new WF_STEP_TPL(); try { int wfid = Convert.ToInt32(Request["WFID"]); int procid = Convert.ToInt32(Request["PROCID"]); int steptype = 1; if (Request["STEP_TYPE"] != null) { steptype = Convert.ToInt32(Request["STEP_TYPE"]); } valObj.WFID = wfid; if (Request["STEP_NAME"] != null) { valObj.STEP_NAME = Request["STEP_NAME"]; } valObj.PROCID = procid; valObj.STEP_TYPE = steptype; valObj.NOTE = ""; valObj.CONDITION = ""; valObj.FORMULAR = ""; //新增节点,成功的话,再增加线段。 int count = BLLTable <WF_STEP_TPL> .Factory(conn).Insert(valObj, WF_STEP_TPL.Attribute.STEP_ID); if (count > 0) { int stepid = valObj.STEP_ID; #region//code1 WF_STEPATH_TPL delOld = new WF_STEPATH_TPL(); delOld.WFID = wfid; delOld.PROCID = procid; delOld.PATH_TYPE = 1; delOld.Where("(STEP_ID=" + stepid + " or NEXT_ID=" + stepid + ")"); BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(delOld); #endregion string previds = Request["PrevIDS"]; string nextids = Request["NextIDS"]; if (!string.IsNullOrEmpty(previds) && !string.IsNullOrEmpty(nextids)) { string[] arr1 = StringHelper.GetStringArray(previds, ','); string[] arr2 = StringHelper.GetStringArray(nextids, ','); if (arr2 != null && arr1 != null) { if (Request["delOld"] != null) { #region//code2 //因为再节点之间插入了新节点,所以要删除 原节点之间的路径 WF_STEPATH_TPL delObj = new WF_STEPATH_TPL(); delObj.WFID = wfid; delObj.PROCID = procid; delObj.PATH_TYPE = 1; for (int i = 0; i < arr1.Length; i++) { for (int j = 0; j < arr2.Length; j++) { delObj.STEP_ID = int.Parse(arr1[i]); delObj.NEXT_ID = int.Parse(arr2[j]); BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(delObj); } } #endregion// } } #region//code3 WF_STEPATH_TPL pathVal = new WF_STEPATH_TPL(); pathVal.WFID = wfid; pathVal.PROCID = procid; pathVal.PATH_TYPE = int.Parse(WFEnum.PathType.Normal.ToString("d")); if (arr1 != null) { for (int i = 0; i < arr1.Length; i++) { pathVal.STEP_ID = int.Parse(arr1[i]); string tp = BLLTable <WF_STEP_TPL> .Factory(conn).GetOneValue(WF_STEP_TPL.Attribute.STEP_ID, pathVal.STEP_ID, WF_STEP_TPL.Attribute.STEP_TYPE); if (!string.IsNullOrEmpty(tp)) { pathVal.NODE_TYPE = int.Parse(tp); } pathVal.NEXT_ID = stepid; if (!BLLTable <WF_STEPATH_TPL> .Exists(pathVal)) { pathVal.CONDITION = ""; pathVal.FORMULAR = ""; count += BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(pathVal, WF_STEPATH_TPL.Attribute.PATH_ID); } } } if (arr2 != null) { for (int i = 0; i < arr2.Length; i++) { pathVal.NODE_TYPE = steptype; pathVal.STEP_ID = stepid; pathVal.NEXT_ID = int.Parse(arr2[i]); if (!BLLTable <WF_STEPATH_TPL> .Exists(pathVal)) { pathVal.CONDITION = ""; pathVal.FORMULAR = ""; count += BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(pathVal, WF_STEPATH_TPL.Attribute.PATH_ID); } } } #endregion } Response.Write(stepid.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } if (Request["UpdateStepName"] != null) //更新节点名 { #region //添加节点 try { int count = BLLTable <WF_STEP_TPL> .Factory(conn).Update(WF_STEP_TPL.Attribute.STEP_ID, Request["STEP_ID"], WF_STEP_TPL.Attribute.STEP_NAME, Request["STEP_NAME"]); if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } /* * c节点移到a,b和d之间: * 删除原来连接到节点c的路径[code1]; * 如果移动c导致a,b和c之间增加了一个步骤行,既没有移动到d所在的行,则要删除原来a,b和d之间的路径[code2]。 * 插入a,b和c之间,c和d之间的路径[code3]。 */ if (Request["UpdateStepPath"] != null) //更新线段 { #region //更新节点之间的路径 WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { int count = 0; int wfid = Convert.ToInt32(Request["WFID"]); int procid = Convert.ToInt32(Request["PROCID"]); int stepid = Convert.ToInt32(Request["STEP_ID"]); valObj.PATH_TYPE = int.Parse(WFEnum.PathType.Normal.ToString("d"));; string previds = Request["PrevIDS"]; string nextids = Request["NextIDS"]; valObj.WFID = wfid; valObj.PROCID = procid; string[] arr1 = StringHelper.GetStringArray(previds, ','); string[] arr2 = StringHelper.GetStringArray(nextids, ','); if (stepid > 0) { #region//code1 WF_STEPATH_TPL delOld = new WF_STEPATH_TPL(); delOld.WFID = wfid; delOld.PROCID = procid; delOld.PATH_TYPE = int.Parse(WFEnum.PathType.Normal.ToString("d"));; delOld.Where("(STEP_ID=" + stepid + " or NEXT_ID=" + stepid + ")"); BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(delOld); #endregion if (Request["delOld"] != null) { if (arr1 != null && arr2 != null) { #region//code2 WF_STEPATH_TPL delObj = new WF_STEPATH_TPL(); delObj.WFID = wfid; delObj.PROCID = procid; delObj.PATH_TYPE = int.Parse(WFEnum.PathType.Normal.ToString("d"));; for (int i = 0; i < arr1.Length; i++) { for (int j = 0; j < arr2.Length; j++) { delObj.STEP_ID = int.Parse(arr1[i]); delObj.NEXT_ID = int.Parse(arr2[j]); BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(delObj); } } #endregion// } } #region//code3 if (arr1 != null) { for (int i = 0; i < arr1.Length; i++) { valObj.STEP_ID = int.Parse(arr1[i]); string tp = BLLTable <WF_STEP_TPL> .Factory(conn).GetOneValue(WF_STEP_TPL.Attribute.STEP_ID, valObj.STEP_ID, WF_STEP_TPL.Attribute.STEP_TYPE); if (!string.IsNullOrEmpty(tp)) { valObj.NODE_TYPE = int.Parse(tp); } valObj.NEXT_ID = stepid; if (!BLLTable <WF_STEPATH_TPL> .Exists(valObj)) { valObj.CONDITION = ""; valObj.FORMULAR = ""; count += BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); } } } if (arr2 != null) { for (int i = 0; i < arr2.Length; i++) { valObj.STEP_ID = stepid; string tp = BLLTable <WF_STEP_TPL> .Factory(conn).GetOneValue(WF_STEP_TPL.Attribute.STEP_ID, valObj.STEP_ID, WF_STEP_TPL.Attribute.STEP_TYPE); if (!string.IsNullOrEmpty(tp)) { valObj.NODE_TYPE = int.Parse(tp); } valObj.NEXT_ID = int.Parse(arr2[i]); if (!BLLTable <WF_STEPATH_TPL> .Exists(valObj)) { valObj.CONDITION = ""; valObj.FORMULAR = ""; count += BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); } } } #endregion } if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } //添加返回路径 if (Request["AddBackLine"] != null) { #region//添加返回路径 WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { int count = 0; valObj.WFID = Convert.ToInt32(Request["WFID"]); valObj.PROCID = Convert.ToInt32(Request["PROCID"]); valObj.PATH_TYPE = int.Parse(WFEnum.PathType.BackTo.ToString("d")); valObj.NEXT_ID = Convert.ToInt32(Request["NEXT_ID"]); valObj.STEP_ID = Convert.ToInt32(Request["STEP_ID"]); string tp = BLLTable <WF_STEP_TPL> .Factory(conn).GetOneValue(WF_STEP_TPL.Attribute.STEP_ID, valObj.STEP_ID, WF_STEP_TPL.Attribute.STEP_TYPE); if (!string.IsNullOrEmpty(tp)) { valObj.NODE_TYPE = int.Parse(tp); } valObj.CONDITION = ""; valObj.FORMULAR = ""; count = BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } if (Request["GetBackNextIDS"] != null) { #region//添加返回路径 WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { valObj.WFID = Convert.ToInt32(Request["WFID"]); valObj.PROCID = Convert.ToInt32(Request["PROCID"]); valObj.PATH_TYPE = int.Parse(WFEnum.PathType.BackTo.ToString("d"));; valObj.STEP_ID = Convert.ToInt32(Request["STEP_ID"]); WF_STEPATH_TPL vvv = new WF_STEPATH_TPL(); vvv.NEXT_ID = 0; List <WF_STEPATH_TPL> lst = BLLTable <WF_STEPATH_TPL> .Factory(conn).Select(vvv, valObj); //WF_STEPATH_TPL ooo = BLLTable<WF_STEPATH_TPL>.Factory(conn).GetRowData(new WF_STEPATH_TPL(WF_STEPATH_TPL.Attribute.NEXT_ID), valObj); if (lst != null) { string str = ""; for (int i = 0; i < lst.Count; i++) { str += "," + lst[i].NEXT_ID; } Response.Write(str); } else { //Response.Write("0"); } } catch { //Response.Write("-1"); } #endregion } if (Request["delLine"] != null) { #region//删除指定类型的路径 WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { int count = 0; valObj.WFID = Convert.ToInt32(Request["WFID"]); valObj.PROCID = Convert.ToInt32(Request["PROCID"]); valObj.PATH_TYPE = Convert.ToInt32(Request["PATH_TYPE"]); valObj.NEXT_ID = Convert.ToInt32(Request["NEXT_ID"]); valObj.STEP_ID = Convert.ToInt32(Request["STEP_ID"]); count = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(valObj); if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } if (Request["delStep"] != null) { #region//删除节点 WF_STEP_TPL valObj = new WF_STEP_TPL(); try { int count = WFAdmin.delStep(Convert.ToInt32(Request["STEP_ID"])); if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } if (Request["delStepInPath"] != null) { #region//图形界面里删除节点 /* * 删除a,b和d之间的节点c: * 删除原来连接到节点c的路径[code1]; * 如果c没有兄弟节点,参数PrevIDS和NextIDS不会为空,则插入a,b和d之间的路径[code2]。 */ WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { int count = 0; int wfid = Convert.ToInt32(Request["WFID"]); int procid = Convert.ToInt32(Request["PROCID"]); int stepid = Convert.ToInt32(Request["STEP_ID"]); #region//code1 WF_STEPATH_TPL delOld = new WF_STEPATH_TPL(); delOld.WFID = wfid; delOld.PROCID = procid; delOld.PATH_TYPE = 1; delOld.Where("(STEP_ID=" + stepid + " or NEXT_ID=" + stepid + ")"); count = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(delOld); #endregion string previds = Request["PrevIDS"]; string nextids = Request["NextIDS"]; if (!string.IsNullOrEmpty(previds) && !string.IsNullOrEmpty(nextids)) { valObj.WFID = wfid; valObj.PROCID = procid; string[] arr1 = StringHelper.GetStringArray(previds, ','); string[] arr2 = StringHelper.GetStringArray(nextids, ','); #region//code2 if (arr1 != null && arr2 != null) { for (int i = 0; i < arr1.Length; i++) { for (int j = 0; j < arr2.Length; j++) { valObj.STEP_ID = int.Parse(arr1[i]); string tp = BLLTable <WF_STEP_TPL> .Factory(conn).GetOneValue(WF_STEP_TPL.Attribute.STEP_ID, valObj.STEP_ID, WF_STEP_TPL.Attribute.STEP_TYPE); if (!string.IsNullOrEmpty(tp)) { valObj.NODE_TYPE = int.Parse(tp); } valObj.NEXT_ID = int.Parse(arr2[j]); valObj.PATH_TYPE = 1; if (!BLLTable <WF_STEPATH_TPL> .Exists(valObj)) { valObj.CONDITION = ""; valObj.FORMULAR = ""; count += BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); } } } } #endregion } if (count > 0) { Response.Write(count.ToString()); } else { Response.Write("0"); } } catch { Response.Write("-1"); } #endregion } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //Response.Write("ddddddd"); Response.End(); //return; if (Request["DelNodeByID"] != null) { #region//DelNodeByID WF_STEPATH_TPL ccc = new WF_STEPATH_TPL(); ccc.STEP_ID = int.Parse(Request["StepID"]); WF_STEP_TPL stepObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, ccc.STEP_ID); ccc.WFID = stepObj.WFID; ccc.PROCID = stepObj.PROCID; ccc.NEXT_ID = int.Parse(Request["DelNodeByID"]); int re = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(ccc); Response.Write("1"); #endregion } //更新入口,出口,跳转节点, if (Request["ToStepIDS"] != null) { string PATH_TYPE = ""; //更新类型 1:真出口 2:假出口 其他:入口 if (Request["PATH_TYPE"] != null) { PATH_TYPE = Convert.ToString(Request["PATH_TYPE"]); } string[] stepIds = Request["ToStepIDS"].Split(','); //删除原来的路径 string nextstepid = Request["StepID"]; WF_STEP_TPL nextstepObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, nextstepid); WF_STEPATH_TPL objdel = new WF_STEPATH_TPL(); objdel.WFID = nextstepObj.WFID; objdel.PROCID = nextstepObj.PROCID; //真出口 if (PATH_TYPE.Equals("1")) { objdel.STEP_ID = Convert.ToInt32(nextstepid); objdel.PATH_TYPE = 1; //普通 objdel.NODE_TYPE = 2; //路由 } //假出口 else if (PATH_TYPE.Equals("3")) { objdel.STEP_ID = Convert.ToInt32(nextstepid); objdel.PATH_TYPE = 3; //返回 objdel.NODE_TYPE = 2; //路由 } //入口 else { objdel.NEXT_ID = Convert.ToInt32(nextstepid); objdel.PATH_TYPE = 1; //普通 objdel.NODE_TYPE = 1; //活动 } int re = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(objdel); if (re >= 0) { //添加新的路径 foreach (string str in stepIds) { WF_STEPATH_TPL step = new WF_STEPATH_TPL(); step.WFID = nextstepObj.WFID; step.PROCID = nextstepObj.PROCID; //真出口 if (PATH_TYPE.Equals("1")) { step.STEP_ID = Convert.ToInt32(nextstepid); step.NEXT_ID = Convert.ToInt32(str); step.NODE_TYPE = 2; step.PATH_TYPE = 1; } //假出口 else if (PATH_TYPE.Equals("3")) { step.STEP_ID = Convert.ToInt32(nextstepid); step.NEXT_ID = Convert.ToInt32(str); step.NODE_TYPE = 2; step.PATH_TYPE = 3; } //入口 else { step.STEP_ID = Convert.ToInt32(str); step.NEXT_ID = Convert.ToInt32(nextstepid); step.NODE_TYPE = 1; step.PATH_TYPE = 1; } re = BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(step, WF_STEPATH_TPL.Attribute.PATH_ID); } } Response.Write(re.ToString()); } if (Request["SetNextID"] != null) { #region//SetNextID string toids = Request["SetNextID"]; string curids = Request["StepIDS"]; string[] curArr = StringHelper.GetStringArray(curids, ','); WF_STEP_TPL stepObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, curArr[0]); if (Request["ReNextID"] != null) { WF_STEPATH_TPL ccc = new WF_STEPATH_TPL(); ccc.WFID = stepObj.WFID; ccc.PROCID = stepObj.PROCID; ccc.In(WF_STEPATH_TPL.Attribute.STEP_ID, curids); int re = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(ccc); } if (!string.IsNullOrEmpty(toids)) { string[] lst = StringHelper.GetStringArray(toids, ','); for (int a = 0; a < curArr.Length; a++) { for (int i = 0; i < lst.Length; i++) { WF_STEPATH_TPL pathVal = new WF_STEPATH_TPL(); pathVal.WFID = stepObj.WFID; pathVal.PROCID = stepObj.PROCID; pathVal.STEP_ID = int.Parse(curArr[a]); pathVal.NEXT_ID = int.Parse(lst[i]); pathVal.PATH_TYPE = int.Parse(WFEnum.PathType.Normal.ToString("d")); if (!BLLTable <WF_STEPATH_TPL> .Exists(pathVal)) { pathVal.CONDITION = ""; pathVal.FORMULAR = ""; BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(pathVal, WF_STEPATH_TPL.Attribute.PATH_ID); WF_STEP_TPL uuu = new WF_STEP_TPL(); uuu.WFID = stepObj.WFID; uuu.PROCID = stepObj.PROCID; uuu.STEP_ID = pathVal.NEXT_ID; WF_STEP_TPL vvv = new WF_STEP_TPL(); vvv.IS_USE = 1; BLLTable <WF_STEP_TPL> .Factory(conn).Update(vvv, uuu); } } } } //Response.Write(re.ToString()); #endregion Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } if (Request["DelStepPath"] != null) { #region//DelStepPath string stepid = Request["DelStepPath"]; WF_STEP_TPL stepObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, stepid); WF_STEPATH_TPL ccc = new WF_STEPATH_TPL(); ccc.WFID = stepObj.WFID; ccc.PROCID = stepObj.PROCID; //ccc.NEXT_ID = int.Parse(stepid); ccc.Where("(NEXT_ID=" + stepid + " or STEP_ID=" + stepid + ")"); int re = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(ccc); WF_STEP_TPL uuu = new WF_STEP_TPL(); uuu.WFID = stepObj.WFID; uuu.PROCID = stepObj.PROCID; uuu.STEP_ID = int.Parse(stepid);; //ccc.Where("(NEXT_ID=" + stepid + " or STEP_ID=" + stepid + ")"); WF_STEP_TPL vvv = new WF_STEP_TPL(); vvv.IS_USE = 0; BLLTable <WF_STEP_TPL> .Factory(conn).Update(vvv, uuu); Response.Write(re.ToString()); #endregion } #region//在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelByKeyID"] != null) { int re = delStep(Request["DelByKeyID"]);// BLLTable<WF_STEP_TPL>.Factory(conn).Delete(WF_STEP_TPL.Attribute.STEP_ID, Request["DelSTEP_ID"]); if (re > 0) { Response.Write("{re:1,msg:''}");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("{re:0,msg:''}"); } } #endregion #region//在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelSTEP_ID"] != null) { int re = delStep(Request["DelSTEP_ID"]);// BLLTable<WF_STEP_TPL>.Factory(conn).Delete(WF_STEP_TPL.Attribute.STEP_ID, Request["DelSTEP_ID"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } #endregion #region//在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { string[] arr = StringHelper.GetStringArray(Request["DelKeyIDS"], ','); int re = 0; for (int i = 0; i < arr.Length; i++) { re += delStep(arr[i]); } //WF_STEP_TPL cond = new WF_STEP_TPL(); //cond.In(WF_STEP_TPL.Attribute.STEP_ID, Request["DelKeyIDS"]); //int re = BLLTable<WF_STEP_TPL>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } #endregion #region//验证过程是否配置正确 if (Request["checkProc"] != null) { int wfid = int.Parse(Request["WFID"]); int procid = int.Parse(Request["PROCID"]); if (WFAdmin.IsProcessSetComp(wfid, procid, false)) { Response.Write("过程配置正确!"); } else { Response.Write("过程配置错误!"); } string msg = null; if (!WFAdmin.IsProcessDBSetOK(wfid, procid, out msg)) { Response.Write(msg); } } #endregion #region//复制流程 if (Request["cloneProc"] != null) { int wfid = int.Parse(Request["WFID"]); int procid = int.Parse(Request["PROCID"]); string outMsg = ""; bool isOk = false; isOk = WFAdmin.IsProcessDBSetOK(wfid, procid, out outMsg); if (isOk == true) { isOk = WFAdmin.IsProcessSetComp(wfid, procid, false); if (isOk == false) { outMsg = "过程配置不正确!"; } } if (isOk == true) { int re = WFAdmin.CloneProcess(procid); if (re > 0) { BLLTable <WF_INFO> .Factory(conn).Update(WF_INFO.Attribute.WFID, wfid, WF_INFO.Attribute.STATUS, 1); Response.Write("ok"); } else { Response.Write("执行启动过程失败!"); } } else { Response.Write(outMsg); } } #endregion #region//启用流程 if (Request["applyProc"] != null) { int wfid = int.Parse(Request["WFID"]); int procid = int.Parse(Request["PROCID"]); string outMsg = ""; bool isOk = false; isOk = WFAdmin.IsProcessDBSetOK(wfid, procid, out outMsg); if (isOk == true) { isOk = WFAdmin.IsProcessSetComp(wfid, procid, false); if (isOk == false) { outMsg = "过程配置不正确!"; } } if (isOk == true) { int re = WFAdmin.ApplyProcess(procid); if (re > 0) { BLLTable <WF_INFO> .Factory(conn).Update(WF_INFO.Attribute.WFID, wfid, WF_INFO.Attribute.STATUS, 1); Response.Write("ok"); } else { Response.Write("应用过程失败!"); } } else { Response.Write(outMsg); } } #endregion #region//保存数据 //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { WF_STEP_TPL val = new WF_STEP_TPL(); val.STEP_ID = int.Parse(Request["FieldKeyID"]); List <AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable <WF_STEP_TPL> .Factory(conn).Update(val, WF_STEP_TPL.Attribute.STEP_ID); Response.Write("修改用户信息成功"); } #endregion #region////显示子节点 if (Request["getSubNodes"] != null) { string nodetype = Request["ntype"]; StringBuilder sb = new StringBuilder("["); string id = Request["id"]; if (nodetype == "root") { #region WF_PROCESS_TPL obj = new WF_PROCESS_TPL(); obj.WFID = int.Parse(id); WF_PROCESS_TPL val = new WF_PROCESS_TPL(); val.OrderBy(WF_PROCESS_TPL.Attribute.PROCID, Order.Asc); List <WF_PROCESS_TPL> lst = BLLTable <WF_PROCESS_TPL> .Factory(conn).Select(val, obj); if (lst.Count != null) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].PROCID); sb.Append("',pid:'").Append("0").Append("',no:").Append(lst[i].PROCID); sb.Append(",sc:").Append("0"); sb.Append(",name:'").Append(lst[i].PROC_NAME).Append("',ntype:'proc'}"); } } #endregion } if (nodetype == "proc") { #region WF_STEP_TPL obj = new WF_STEP_TPL(); obj.PROCID = int.Parse(id); obj.Where("STEP_TYPE in(1,2)"); WF_STEP_TPL val = new WF_STEP_TPL(); val.OrderBy(WF_STEP_TPL.Attribute.SORT_NUM, Order.Asc); List <WF_STEP_TPL> lst = BLLTable <WF_STEP_TPL> .Factory(conn).Select(val, obj); if (lst.Count != null) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } string type = "step"; if (lst[i].STEP_TYPE.ToString() == WFEnum.StepType.Begin.ToString("d")) { type = "begin"; } if (lst[i].STEP_TYPE.ToString() == WFEnum.StepType.End.ToString("d")) { type = "end"; } if (lst[i].STEP_TYPE.ToString() == WFEnum.StepType.Roate.ToString("d")) { type = "roate"; } sb.Append("{id:'").Append(lst[i].STEP_ID); sb.Append("',pid:'").Append("0").Append("',no:").Append(lst[i].SORT_NUM); sb.Append(",sc:").Append("0"); sb.Append(",name:'").Append(lst[i].STEP_NAME).Append("',ntype:'" + type + "'}"); } } #endregion } sb.Append("]"); Response.Write(sb.ToString()); } #endregion if (Request["deleteNode"] != null) { #region//deleteNode int re = 0; string stepid = Request["id"]; try { WF_STEP_TPL stepObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, stepid); WF_STEPATH_TPL ccc = new WF_STEPATH_TPL(); ccc.WFID = stepObj.WFID; ccc.PROCID = stepObj.PROCID; ccc.Where("(NEXT_ID=" + stepid + " or STEP_ID=" + stepid + ")"); BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(ccc); BLLTable <WF_CHECKER_TPL> .Factory(conn).Delete(WF_CHECKER_TPL.Attribute.STEP_ID, stepid); BLLTable <WF_STEP_FORM_TPL> .Factory(conn).Delete(WF_STEP_FORM_TPL.Attribute.STEP_ID, stepid); BLLTable <WF_STEPVAR_TPL> .Factory(conn).Delete(WF_STEPVAR_TPL.Attribute.STEP_ID, stepid); re = BLLTable <WF_STEP_TPL> .Factory(conn).Delete(WF_STEP_TPL.Attribute.STEP_ID, stepid); } catch { re = -1; } if (re > 0) { Response.Write("{re:1,msg:'删除节点成功!'}"); } else { Response.Write("{re:0,msg:'删除节点失败!'}"); } #endregion } Response.End(); }