int delStep(string stepid) { WF_STEP_TPL obj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, stepid); int re = BLLTable <WF_STEP_TPL> .Factory(conn).Delete(WF_STEP_TPL.Attribute.STEP_ID, stepid); if (re > 0) { WF_CHECKER_TPL cker = new WF_CHECKER_TPL(); cker.WFID = obj.WFID; cker.PROCID = obj.PROCID; cker.STEP_ID = obj.STEP_ID; BLLTable <WF_CHECKER_TPL> .Factory(conn).Delete(cker); //WF_STEP_FORM_TPL stepf = new WF_STEP_FORM_TPL(); //stepf.WFID = obj.WFID; //stepf.PROCID = obj.PROCID; //stepf.STEP_ID = obj.STEP_ID; //BLLTable<WF_STEP_FORM_TPL>.Factory(conn).Delete(stepf); WF_STEPATH_TPL stepP = new WF_STEPATH_TPL(); stepP.WFID = obj.WFID; stepP.PROCID = obj.PROCID; stepP.STEP_ID = obj.STEP_ID; BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(stepP); stepP.STEP_ID = obj.STEP_ID; BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(stepP); } return(re); }
/// <summary> /// 删除连线 /// </summary> /// <returns></returns> private string delConnect() { WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { valObj.WFID = Common.GetReqIntValue("WFID"); valObj.STEP_ID = Common.GetReqIntValue("SourceId"); valObj.PROCID = Common.GetReqIntValue("PROCID"); valObj.NEXT_ID = Common.GetReqIntValue("TargetId"); int count = BLLTable <WF_STEPATH_TPL> .Factory(conn).Delete(valObj); if (count > 0) { return(count.ToString()); } else { return("0"); } } catch { return("-1"); } }
/// <summary> /// 添加连线 /// </summary> /// <returns></returns> private string addConnect() { string strRet = "0"; WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { valObj.WFID = Common.GetReqIntValue("WFID"); valObj.STEP_ID = Common.GetReqIntValue("SourceId"); valObj.PROCID = Common.GetReqIntValue("PROCID"); valObj.NEXT_ID = Common.GetReqIntValue("TargetId"); valObj.SOURCE_ANCHOR = Common.GetReqStrValue("SourceAnchor"); valObj.TARGET_ANCHOR = Common.GetReqStrValue("TargetAnchor"); valObj.NODE_TYPE = Common.GetReqIntValue("nodeType"); valObj.PATH_TYPE = 1; if (!BLLTable <WF_STEPATH_TPL> .Factory(conn).Exists(valObj)) { //新增节点 int count = BLLTable <WF_STEPATH_TPL> .Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); if (count > 0) { strRet = valObj.STEP_ID.ToString(); } else { strRet = "0"; } } return(strRet); } catch { return("-1"); } }
/// <summary> /// 添加连线 /// </summary> /// <returns></returns> private string addConnect() { string strRet = "0"; WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { valObj.WFID = Common.GetReqIntValue("WFID"); valObj.STEP_ID = Common.GetReqIntValue("SourceId"); valObj.PROCID = Common.GetReqIntValue("PROCID"); valObj.NEXT_ID = Common.GetReqIntValue("TargetId"); valObj.SOURCE_ANCHOR = Common.GetReqStrValue("SourceAnchor"); valObj.TARGET_ANCHOR = Common.GetReqStrValue("TargetAnchor"); valObj.NODE_TYPE = Common.GetReqIntValue("nodeType"); valObj.PATH_TYPE = 1; if (!BLLTable<WF_STEPATH_TPL>.Factory(conn).Exists(valObj)) { //新增节点 int count = BLLTable<WF_STEPATH_TPL>.Factory(conn).Insert(valObj, WF_STEPATH_TPL.Attribute.PATH_ID); if (count > 0) { strRet = valObj.STEP_ID.ToString(); } else { strRet = "0"; } } return strRet; } catch { return "-1"; } }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "�༭ "; if (!string.IsNullOrEmpty(Request["STEP_ID"])) { keyid = Request["STEP_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["WFID"])) { wfid = int.Parse(Request["WFID"]); } if (!string.IsNullOrEmpty(Request["PROCID"])) { procid = int.Parse(Request["PROCID"]); if (ViewState["PROCID"] != null) { procid = Convert.ToInt32(ViewState["PROCID"]); } } if (procid > 0) { if (wfid == 0) { WF_PROCESS_TPL pvalue = BLLTable<WF_PROCESS_TPL>.Factory(conn).GetRowData(WF_PROCESS_TPL.Attribute.PROCID, procid); title += pvalue.PROC_NAME + "-"; wfid = pvalue.WFID; } } else { if (keyid == "") { Response.Write("�Ƿ����ӣ�"); Response.End(); } } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["pathset"])) { btnSave.Enabled = false; } txtWFCID.Value = wfid.ToString(); txtPROCID.Value = procid.ToString(); txtBACK_TYPE.Items.AddRange(FormHelper.GetListItem(WF_STEP_TPL.Attribute.BACK_TYPE)); //if (txtSTEP_TYPE.Items.Count > 1) //{ // txtSTEP_TYPE.SelectedIndex = 1; //} if (!string.IsNullOrEmpty(Request["stepType"])) { txtSTEP_TYPE.Value = Request["stepType"]; txtSTEP_TYPE.Disabled = true; } try { if (keyid != "") { valObj = BLLTable<WF_STEP_TPL>.Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, keyid); title += valObj.STEP_NAME + "-" + valObj.STEP_ID; if (valObj == null) return; txtSTEP_ID.Value = Convert.ToString(valObj.STEP_ID);//Convert.ToInt32 txtSTEP_NAME.Value = Convert.ToString(valObj.STEP_NAME);//Convert.ToString txtPROCID.Value = Convert.ToString(valObj.PROCID);//Convert.ToInt32 txtWFCID.Value = valObj.WFID.ToString(); //txtSTEP_NOTE.Value = Convert.ToString(valObj.STEP_NOTE);//Convert.ToString txtSHOW_CONDITION.Value = Convert.ToString(valObj.CONDITION);//Convert.ToString txtSHOW_FORMULA.Value = Convert.ToString(valObj.FORMULAR);//Convert.ToString txtSTEP_TYPE.Value = valObj.STEP_TYPE.ToString(); txtNOTE.Value = Convert.ToString(valObj.NOTE);//Convert.ToString txtBACK_TYPE.Value = Convert.ToString(valObj.BACK_TYPE); txtWF_STEP_TPL_LIFE_TIME.Value = Convert.ToString(valObj.LIFE_TIME); wucSelStaff1.SetSelEmps(valObj.NOTICE_MBR); txtWF_STEP_TPL_ISALLOW_GOTO.Checked = valObj.ISALLOW_GOTO; ViewState["PROCID"] = valObj.PROCID; if (valObj.STEP_TYPE.ToString() == WFEnum.StepType.Activity.ToString("d")) { WF_CHECKER_TPL hhh1 = new WF_CHECKER_TPL(); hhh1.STEP_ID = valObj.STEP_ID; hhh1.WFID = valObj.WFID; hhh1.PROCID = valObj.PROCID; bool hadChecker = BLLTable<WF_CHECKER_TPL>.Exists(hhh1); WF_STEP_FORM_TPL hhh2 = new WF_STEP_FORM_TPL(); hhh2.STEP_ID = valObj.STEP_ID; hhh2.WFID = valObj.WFID; hhh2.PROCID = valObj.PROCID; bool hadCKForm = BLLTable<WF_STEP_FORM_TPL>.Exists(hhh2); WF_STEPATH_TPL hhh3 = new WF_STEPATH_TPL(); hhh3.STEP_ID = valObj.STEP_ID; hhh3.WFID = valObj.WFID; hhh3.PROCID = valObj.PROCID; hhh3.CONDITION = ""; //hhh3.Where("(WF_STEPATH_TPL.Condition<>'' and WF_STEPATH_TPL.Condition is not null)"); //bool hadCond = BLLTable<WF_STEPATH_TPL>.Exists(hhh3); WF_STEPATH_TPL val30 = new WF_STEPATH_TPL(); val30.CONDITION = ""; val30.NEXT_ID = 1; WF_STEP_TPL val31 = new WF_STEP_TPL(); val31.STEP_NAME = ""; val31.STEP_ID = 1; List<WF_STEP_TPL> list3 = BLLTable<WF_STEP_TPL>.Select(val31, new Relation(WF_STEPATH_TPL.Attribute.NEXT_ID, WF_STEP_TPL.Attribute.STEP_ID) , val30, hhh3); litMore.Text += "<dl><dt>��̽ڵ㣺</dt><dd>" + (list3.Count > 0 ? list3[0].STEP_NAME : "δ����") + "</dd></dl>"; litMore.Text += "<dl><dt>����ˣ�</dt><dd>" + (hadChecker == true ? "������" : "δ����") + "</dd></dl>"; litMore.Text += "<dl><dt>����������</dt><dd>" + (hadCKForm == true ? "������" : "δ����") + "</dd></dl>"; litMore.Text += "<dl><dt>�������</dt><dd>" + (list3.Count > 0 && list3[0].CONDITION != null ? list3[0].CONDITION : "δ����") + "</dd></dl>"; } } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["setpSetting"] != null) { btnOK.Enabled = false; //btnCloseWin.Disabled = true; btnCloseWin.Attributes["onclick"] = "window.parent.close();"; txtSTEP_TYPE.Disabled = true; } } Page.Title = title; }
protected void btnOK_Click(object sender, EventArgs e) { string gotoUrl = "WF_STEPManage.aspx"; if (Request["preUrl"] != null) { gotoUrl = Request["preUrl"]; } else { gotoUrl = "../ok.aspx"; } int Num = Convert.ToInt32(Request["hidCondNum"]); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= Num; i++) { if (!string.IsNullOrEmpty(Request["txtCond_" + i.ToString()])) { string conddata = Request["txtCond_" + i.ToString()]; if (sb.Length > 0) { sb.Append("|"); } sb.Append(conddata); } } //if (Request["open"] == null) //{ 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 upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable<WF_STEPATH_TPL>.Factory(conn).Update(upStep, cond); } if (from == "1")//显示步骤条件--无用 { WF_STEP_TPL upStep = new WF_STEP_TPL(); upStep.STEP_ID = keyid; upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable<WF_STEP_TPL>.Factory(conn).Update(upStep, WF_STEP_TPL.Attribute.STEP_ID); } else if (from == "2")//普通路径条件 { 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 upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable<WF_STEPATH_TPL>.Factory(conn).Update(upStep, cond); } else if (from == "3")//审核人条件设置 { WF_CHECKER_TPL upCh = new WF_CHECKER_TPL(); upCh.CHECKER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable<WF_CHECKER_TPL>.Factory(conn).Update(upCh, WF_CHECKER_TPL.Attribute.CHECKER_ID); } else if (from == "4")//选择过程条件 { WF_PROCESS_TPL upSet = new WF_PROCESS_TPL(); upSet.PROCID = keyid; upSet.CONDITION = sb.ToString(); if (upSet.CONDITION.Length > 1) { upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upSet.FORMULAR = ""; } BLLTable<WF_PROCESS_TPL>.Factory(conn).Update(upSet, WF_PROCESS_TPL.Attribute.PROCID); } else if (from == "5")//通知人条件设置 { WF_NOTIFIER_TPL upCh = new WF_NOTIFIER_TPL(); upCh.NOTIFIER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable<WF_NOTIFIER_TPL>.Factory(conn).Update(upCh, WF_NOTIFIER_TPL.Attribute.NOTIFIER_ID); } //else if (from == "6") //{ // WF_STEPState upSet = new WF_STEPState(); // upSet.StateID = keyid; // upSet.CONDITION = sb.ToString(); // if (upSet.CONDITION.Length > 1) // { // upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); // } // else // { // upSet.FORMULAR = ""; // } // BLLTable<WF_STEPState>.Factory(conn).Update(upSet); //} if (Request["setpSetting"] != null) { //Response.Write(Request.Url.AbsoluteUri); string randStr = StringHelperExd.GetRandomCode(6); string url = Request.Url.AbsoluteUri; if (url.IndexOf("&r=") != -1) { Regex reg = new Regex(@"&r=\w+"); url = reg.Replace(url, "&r=" + randStr); } else { url += "&r=" + randStr; } //Response.Write(url); //ScriptHelper.AlertAndGo(Page, "条件保存成功!", url); ScriptHelper.Alert(Page, "条件保存成功!"); //Response.Redirect(Request.Url.AbsoluteUri); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "if (window.opener){window.opener.returnValue = \"ok\";}else{window.returnValue = \"ok\";}window.close();", true); } //Response.Redirect(gotoUrl); //} //else//打开条件配制窗口,无论是修改还是新增条件,都只需要返回条件和公式即可 //{ // AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.returnValue=\"" + sb.ToString() + "`" + txtGongShi.Value.Trim() + "\";window.close();", false); //} }
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) { 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>.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>.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); } } preUrl = WebHelper.GetAppPath(); theme = preUrl + "Themes/" + BasePage._ThemeName; if (!IsPostBack) { string strJs = ""; WF_STEP_TPL cond = new WF_STEP_TPL(); cond.WFID = wfid; cond.PROCID = procid; List<WF_STEP_TPL> lstStep = BLLTable<WF_STEP_TPL>.Factory(conn).Select(new WF_STEP_TPL(), cond); foreach (WF_STEP_TPL step in lstStep) { if (step.STEP_TYPE == 0) { htmlText += "<div class='node node-start' type =0 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "',hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; } else if (step.STEP_TYPE == 3) { htmlText += "<div class='node node-end' type =3 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='active-end'><span>" + step.STEP_NAME + "</span></div></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle, { anchors: \"TopCenter\",uuid:\'" + step.STEP_ID + "s\' });"; } else if (step.STEP_TYPE == 2) { // htmlText += "<div class='node node-route' type =2 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='route-content'><span>" + step.STEP_NAME + "</span></div></div>"; htmlText += "<div class='node roate' type =2 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle,{ anchors: \"TopCenter\",uuid:\'" + step.STEP_ID + "s\' });"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; } else { htmlText += "<div class='node node-active' type =1 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='active-content'><span>" + step.STEP_NAME + "</span></div></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "',hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle, { anchors: \"TopCenter\" ,uuid:\'" + step.STEP_ID + "s\' });"; } strJs += "jsPlumb.draggable('" + step.STEP_ID + "');"; strJs += "doubleclick(" + step.STEP_ID + "," + step.STEP_TYPE + ");"; } WF_STEPATH_TPL condP = new WF_STEPATH_TPL(); condP.WFID = wfid; condP.PROCID = procid; List<WF_STEPATH_TPL> lstPath = BLLTable<WF_STEPATH_TPL>.Factory(conn).Select(new WF_STEPATH_TPL(), condP); foreach (WF_STEPATH_TPL path in lstPath) { //strJs += "jsPlumb.bind(\"connection\",function (connInfo, originalEvent) { connInfo.connection.setLabel(\" \")});"; strJs += "jsPlumb.connect({ uuids:[ \"" + path.STEP_ID + "e\", \"" + path.NEXT_ID + "s\"], detachable:true});"; } //{uuids:["Window2BottomCenter", "Window3TopCenter"], editable:true} //HtmlGenericControl sss = new HtmlGenericControl(); //sss.Attributes.Add("src", "/lib/StepCtr/StepCtr.js"); //sss.Attributes.Add("type", "text/javascript"); //Page.Header.Controls.AddAt(4, sss); // Response.Write("<script src=\"" + ResolveUrl("~/lib/jquery/jquery-1.11.1.min.js") + "\" type=\"text/javascript\"></script>"); // Response.Write("<script src=\"" + ResolveUrl("~/lib/StepCtr/StepCtr.js") + "\" type=\"text/javascript\"></script>"); script = "jsPlumb.ready(function () {" + strJs + "});"; // ClientScript.RegisterStartupScript(this.GetType(), "myscript", script, true); } }
protected void btnOK_Click(object sender, EventArgs e) { string gotoUrl = "WF_STEPManage.aspx"; if (Request["preUrl"] != null) { gotoUrl = Request["preUrl"]; } else { gotoUrl = "../ok.aspx"; } int Num = Convert.ToInt32(Request["hidCondNum"]); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= Num; i++) { if (!string.IsNullOrEmpty(Request["txtCond_" + i.ToString()])) { string conddata = Request["txtCond_" + i.ToString()]; if (sb.Length > 0) { sb.Append("|"); } sb.Append(conddata); } } //if (Request["open"] == null) //{ 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 upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond); } if (from == "1")//显示步骤条件--无用 { WF_STEP_TPL upStep = new WF_STEP_TPL(); upStep.STEP_ID = keyid; upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEP_TPL> .Factory(conn).Update(upStep, WF_STEP_TPL.Attribute.STEP_ID); } else if (from == "2")//普通路径条件 { 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 upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond); } else if (from == "3")//审核人条件设置 { WF_CHECKER_TPL upCh = new WF_CHECKER_TPL(); upCh.CHECKER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable <WF_CHECKER_TPL> .Factory(conn).Update(upCh, WF_CHECKER_TPL.Attribute.CHECKER_ID); } else if (from == "4")//选择过程条件 { WF_PROCESS_TPL upSet = new WF_PROCESS_TPL(); upSet.PROCID = keyid; upSet.CONDITION = sb.ToString(); if (upSet.CONDITION.Length > 1) { upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upSet.FORMULAR = ""; } BLLTable <WF_PROCESS_TPL> .Factory(conn).Update(upSet, WF_PROCESS_TPL.Attribute.PROCID); } else if (from == "5")//通知人条件设置 { WF_NOTIFIER_TPL upCh = new WF_NOTIFIER_TPL(); upCh.NOTIFIER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable <WF_NOTIFIER_TPL> .Factory(conn).Update(upCh, WF_NOTIFIER_TPL.Attribute.NOTIFIER_ID); } //else if (from == "6") //{ // WF_STEPState upSet = new WF_STEPState(); // upSet.StateID = keyid; // upSet.CONDITION = sb.ToString(); // if (upSet.CONDITION.Length > 1) // { // upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); // } // else // { // upSet.FORMULAR = ""; // } // BLLTable<WF_STEPState>.Factory(conn).Update(upSet); //} if (Request["setpSetting"] != null) { //Response.Write(Request.Url.AbsoluteUri); string randStr = StringHelperExd.GetRandomCode(6); string url = Request.Url.AbsoluteUri; if (url.IndexOf("&r=") != -1) { Regex reg = new Regex(@"&r=\w+"); url = reg.Replace(url, "&r=" + randStr); } else { url += "&r=" + randStr; } //Response.Write(url); //ScriptHelper.AlertAndGo(Page, "条件保存成功!", url); ScriptHelper.Alert(Page, "条件保存成功!"); //Response.Redirect(Request.Url.AbsoluteUri); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "if (window.opener){window.opener.returnValue = \"ok\";}else{window.returnValue = \"ok\";}window.close();", true); } //Response.Redirect(gotoUrl); //} //else//打开条件配制窗口,无论是修改还是新增条件,都只需要返回条件和公式即可 //{ // AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.returnValue=\"" + sb.ToString() + "`" + txtGongShi.Value.Trim() + "\";window.close();", false); //} }
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(); }
int delStep(string stepid) { WF_STEP_TPL obj = BLLTable<WF_STEP_TPL>.Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, stepid); int re = BLLTable<WF_STEP_TPL>.Factory(conn).Delete(WF_STEP_TPL.Attribute.STEP_ID, stepid); if (re > 0) { WF_CHECKER_TPL cker = new WF_CHECKER_TPL(); cker.WFID = obj.WFID; cker.PROCID = obj.PROCID; cker.STEP_ID = obj.STEP_ID; BLLTable<WF_CHECKER_TPL>.Factory(conn).Delete(cker); //WF_STEP_FORM_TPL stepf = new WF_STEP_FORM_TPL(); //stepf.WFID = obj.WFID; //stepf.PROCID = obj.PROCID; //stepf.STEP_ID = obj.STEP_ID; //BLLTable<WF_STEP_FORM_TPL>.Factory(conn).Delete(stepf); WF_STEPATH_TPL stepP = new WF_STEPATH_TPL(); stepP.WFID = obj.WFID; stepP.PROCID = obj.PROCID; stepP.STEP_ID = obj.STEP_ID; BLLTable<WF_STEPATH_TPL>.Factory(conn).Delete(stepP); stepP.STEP_ID = obj.STEP_ID; BLLTable<WF_STEPATH_TPL>.Factory(conn).Delete(stepP); } return re; }
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(); }
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(); }
protected void Page_Load(object sender, EventArgs e) { 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> .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> .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); } } preUrl = WebHelper.GetAppPath(); theme = preUrl + "Themes/" + BasePage._ThemeName; if (!IsPostBack) { string strJs = ""; WF_STEP_TPL cond = new WF_STEP_TPL(); cond.WFID = wfid; cond.PROCID = procid; List <WF_STEP_TPL> lstStep = BLLTable <WF_STEP_TPL> .Factory(conn).Select(new WF_STEP_TPL(), cond); foreach (WF_STEP_TPL step in lstStep) { if (step.STEP_TYPE == 0) { htmlText += "<div class='node node-start' type =0 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "',hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; } else if (step.STEP_TYPE == 3) { htmlText += "<div class='node node-end' type =3 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='active-end'><span>" + step.STEP_NAME + "</span></div></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle, { anchors: \"TopCenter\",uuid:\'" + step.STEP_ID + "s\' });"; } else if (step.STEP_TYPE == 2) { // htmlText += "<div class='node node-route' type =2 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='route-content'><span>" + step.STEP_NAME + "</span></div></div>"; htmlText += "<div class='node roate' type =2 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle,{ anchors: \"TopCenter\",uuid:\'" + step.STEP_ID + "s\' });"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; } else { htmlText += "<div class='node node-active' type =1 id='" + step.STEP_ID + "'style='left:" + step.BLOCKX + "px;top:" + step.BLOCKY + "px;' ><span>" + step.STEP_NAME + "</span><div class='active-content'><span>" + step.STEP_NAME + "</span></div></div>"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "',hollowCircle, { anchors: \"BottomCenter\",uuid:\'" + step.STEP_ID + "e\' });"; strJs += "jsPlumb.addEndpoint('" + step.STEP_ID + "', solidCircle, { anchors: \"TopCenter\" ,uuid:\'" + step.STEP_ID + "s\' });"; } strJs += "jsPlumb.draggable('" + step.STEP_ID + "');"; strJs += "doubleclick(" + step.STEP_ID + "," + step.STEP_TYPE + ");"; } WF_STEPATH_TPL condP = new WF_STEPATH_TPL(); condP.WFID = wfid; condP.PROCID = procid; List <WF_STEPATH_TPL> lstPath = BLLTable <WF_STEPATH_TPL> .Factory(conn).Select(new WF_STEPATH_TPL(), condP); foreach (WF_STEPATH_TPL path in lstPath) { //strJs += "jsPlumb.bind(\"connection\",function (connInfo, originalEvent) { connInfo.connection.setLabel(\" \")});"; strJs += "jsPlumb.connect({ uuids:[ \"" + path.STEP_ID + "e\", \"" + path.NEXT_ID + "s\"], detachable:true});"; } //{uuids:["Window2BottomCenter", "Window3TopCenter"], editable:true} //HtmlGenericControl sss = new HtmlGenericControl(); //sss.Attributes.Add("src", "/lib/StepCtr/StepCtr.js"); //sss.Attributes.Add("type", "text/javascript"); //Page.Header.Controls.AddAt(4, sss); // Response.Write("<script src=\"" + ResolveUrl("~/lib/jquery/jquery-1.11.1.min.js") + "\" type=\"text/javascript\"></script>"); // Response.Write("<script src=\"" + ResolveUrl("~/lib/StepCtr/StepCtr.js") + "\" type=\"text/javascript\"></script>"); script = "jsPlumb.ready(function () {" + strJs + "});"; // ClientScript.RegisterStartupScript(this.GetType(), "myscript", script, true); } }
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) { 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["STEP_ID"])) { keyid = Request["STEP_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["WFID"])) { wfid = int.Parse(Request["WFID"]); } if (!string.IsNullOrEmpty(Request["PROCID"])) { procid = int.Parse(Request["PROCID"]); if (ViewState["PROCID"] != null) { procid = Convert.ToInt32(ViewState["PROCID"]); } } if (procid > 0) { if (wfid == 0) { WF_PROCESS_TPL pvalue = BLLTable <WF_PROCESS_TPL> .Factory(conn).GetRowData(WF_PROCESS_TPL.Attribute.PROCID, procid); title += pvalue.PROC_NAME + "-"; wfid = pvalue.WFID; } } else { if (keyid == "") { Response.Write("非法连接!"); Response.End(); } } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["pathset"])) { btnSave.Enabled = false; } txtWFCID.Value = wfid.ToString(); txtPROCID.Value = procid.ToString(); txtBACK_TYPE.Items.AddRange(FormHelper.GetListItem(WF_STEP_TPL.Attribute.BACK_TYPE)); //if (txtSTEP_TYPE.Items.Count > 1) //{ // txtSTEP_TYPE.SelectedIndex = 1; //} if (!string.IsNullOrEmpty(Request["stepType"])) { txtSTEP_TYPE.Value = Request["stepType"]; txtSTEP_TYPE.Disabled = true; } try { if (keyid != "") { valObj = BLLTable <WF_STEP_TPL> .Factory(conn).GetRowData(WF_STEP_TPL.Attribute.STEP_ID, keyid); title += valObj.STEP_NAME + "-" + valObj.STEP_ID; if (valObj == null) { return; } txtSTEP_ID.Value = Convert.ToString(valObj.STEP_ID); //Convert.ToInt32 txtSTEP_NAME.Value = Convert.ToString(valObj.STEP_NAME); //Convert.ToString txtPROCID.Value = Convert.ToString(valObj.PROCID); //Convert.ToInt32 txtWFCID.Value = valObj.WFID.ToString(); //txtSTEP_NOTE.Value = Convert.ToString(valObj.STEP_NOTE);//Convert.ToString txtSHOW_CONDITION.Value = Convert.ToString(valObj.CONDITION); //Convert.ToString txtSHOW_FORMULA.Value = Convert.ToString(valObj.FORMULAR); //Convert.ToString txtSTEP_TYPE.Value = valObj.STEP_TYPE.ToString(); txtNOTE.Value = Convert.ToString(valObj.NOTE); //Convert.ToString txtBACK_TYPE.Value = Convert.ToString(valObj.BACK_TYPE); txtWF_STEP_TPL_LIFE_TIME.Value = Convert.ToString(valObj.LIFE_TIME); wucSelStaff1.SetSelEmps(valObj.NOTICE_MBR); txtWF_STEP_TPL_ISALLOW_GOTO.Checked = valObj.ISALLOW_GOTO; ViewState["PROCID"] = valObj.PROCID; if (valObj.STEP_TYPE.ToString() == WFEnum.StepType.Activity.ToString("d")) { WF_CHECKER_TPL hhh1 = new WF_CHECKER_TPL(); hhh1.STEP_ID = valObj.STEP_ID; hhh1.WFID = valObj.WFID; hhh1.PROCID = valObj.PROCID; bool hadChecker = BLLTable <WF_CHECKER_TPL> .Exists(hhh1); WF_STEP_FORM_TPL hhh2 = new WF_STEP_FORM_TPL(); hhh2.STEP_ID = valObj.STEP_ID; hhh2.WFID = valObj.WFID; hhh2.PROCID = valObj.PROCID; bool hadCKForm = BLLTable <WF_STEP_FORM_TPL> .Exists(hhh2); WF_STEPATH_TPL hhh3 = new WF_STEPATH_TPL(); hhh3.STEP_ID = valObj.STEP_ID; hhh3.WFID = valObj.WFID; hhh3.PROCID = valObj.PROCID; hhh3.CONDITION = ""; //hhh3.Where("(WF_STEPATH_TPL.Condition<>'' and WF_STEPATH_TPL.Condition is not null)"); //bool hadCond = BLLTable<WF_STEPATH_TPL>.Exists(hhh3); WF_STEPATH_TPL val30 = new WF_STEPATH_TPL(); val30.CONDITION = ""; val30.NEXT_ID = 1; WF_STEP_TPL val31 = new WF_STEP_TPL(); val31.STEP_NAME = ""; val31.STEP_ID = 1; List <WF_STEP_TPL> list3 = BLLTable <WF_STEP_TPL> .Select(val31, new Relation(WF_STEPATH_TPL.Attribute.NEXT_ID, WF_STEP_TPL.Attribute.STEP_ID) , val30, hhh3); litMore.Text += "<dl><dt>后继节点:</dt><dd>" + (list3.Count > 0 ? list3[0].STEP_NAME : "未配置") + "</dd></dl>"; litMore.Text += "<dl><dt>审核人:</dt><dd>" + (hadChecker == true ? "已配置" : "未配置") + "</dd></dl>"; litMore.Text += "<dl><dt>活动审批表单:</dt><dd>" + (hadCKForm == true ? "已配置" : "未配置") + "</dd></dl>"; litMore.Text += "<dl><dt>活动条件:</dt><dd>" + (list3.Count > 0 && list3[0].CONDITION != null ? list3[0].CONDITION : "未配置") + "</dd></dl>"; } } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["setpSetting"] != null) { btnOK.Enabled = false; //btnCloseWin.Disabled = true; btnCloseWin.Attributes["onclick"] = "window.parent.close();"; txtSTEP_TYPE.Disabled = true; } } Page.Title = title; }
/// <summary> /// 删除连线 /// </summary> /// <returns></returns> private string delConnect() { WF_STEPATH_TPL valObj = new WF_STEPATH_TPL(); try { valObj.WFID = Common.GetReqIntValue("WFID"); valObj.STEP_ID = Common.GetReqIntValue("SourceId"); valObj.PROCID = Common.GetReqIntValue("PROCID"); valObj.NEXT_ID = Common.GetReqIntValue("TargetId"); int count = BLLTable<WF_STEPATH_TPL>.Factory(conn).Delete(valObj); if (count > 0) { return count.ToString(); } else { return "0"; } } catch { return "-1"; } }