Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        if (!string.IsNullOrEmpty(Request["DEL_RECID"]))
        {
            int recid = int.Parse(Request["DEL_RECID"]);

            WF_FORMBASE objVal = BLLTable <WF_FORMBASE> .Factory(conn).GetRowData(WF_FORMBASE.Attribute.RECID, recid);

            WFRecordInfo recObj = new WFRecordInfo(objVal, true);
            if (objVal != null)
            {
                int wfid = objVal.WFID;
                // Dictionary<string, FormField> dicObj = WFRecord.GetFormFieldDicByRecID(wfid, recid);
                if (objVal.STATUS == "0")
                {
                    recObj.DeleteByRecID(wfid, recid);
                    if (preUrl == "")
                    {
                        preUrl = "FormList.aspx?WFID=" + wfid + "&Mine=" + StringHelperExd.GetRandomCode(6);
                    }
                    else
                    {
                        if (preUrl.IndexOf("&r=") != -1)
                        {
                            preUrl = preUrl.Replace("&r=", "&r=" + StringHelperExd.GetRandomCode(3));
                        }
                        else
                        {
                            if (preUrl.IndexOf("?") != -1)
                            {
                                preUrl += "&r=" + StringHelperExd.GetRandomCode(6);
                            }
                            else
                            {
                                preUrl += "?r=" + StringHelperExd.GetRandomCode(6);
                            }
                        }
                    }
                    Response.Redirect(preUrl);
                    //ScriptHelper.AlertAndGo(Page, "删除成功!", preUrl);
                }
                else
                {
                    if (userBase.UserType == "1")
                    {
                        recObj.DeleteByRecID(wfid, recid);
                        if (preUrl == "")
                        {
                            preUrl = "FormList.aspx?WFID=" + wfid + "&Mine=" + StringHelperExd.GetRandomCode(6);
                        }
                        else
                        {
                            if (preUrl.IndexOf("&r=") != -1)
                            {
                                preUrl = preUrl.Replace("&r=", "&r=" + StringHelperExd.GetRandomCode(3));
                            }
                            else
                            {
                                if (preUrl.IndexOf("?") != -1)
                                {
                                    preUrl += "&r=" + StringHelperExd.GetRandomCode(6);
                                }
                                else
                                {
                                    preUrl += "?r=" + StringHelperExd.GetRandomCode(6);
                                }
                            }
                        }
                        Response.Redirect(preUrl);
                        //ScriptHelper.AlertAndGo(Page, "删除成功!", preUrl);
                    }
                    else
                    {
                        Response.Write("<h3>已经在审批中,不能删除!<a href='" + preUrl + "'>返回</a></h3>");
                    }
                }
            }
            else
            {
                ScriptHelper.AlertAndGo(Page, "该记录不存在或已被删除!", preUrl);
            }
        }

        #endregion

        if (Request["GetRECNO"] != null)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Write(WFRecordInfo.GetRECNO(Request["DEPT_ID"]));
            Response.End();
        }
        if (Request["showlog"] != null)
        {
            #region
            WF_CHECK_LOG ccc = new WF_CHECK_LOG();
            ccc.WFID    = int.Parse(Request["WFID"]);
            ccc.PROCID  = int.Parse(Request["PROCID"]);
            ccc.STEP_ID = int.Parse(Request["StepID"]);
            ccc.RECID   = int.Parse(Request["RECID"]);
            WF_CHECK_LOG log = BLLTable <WF_CHECK_LOG> .Factory(conn).GetRowData(ccc);

            if (log != null)
            {
                try
                {
                    StringBuilder sb = new StringBuilder();
                    string[]      a  = StringHelper.GetStringArray(log.RESULTS, '|');
                    string[]      b  = StringHelper.GetStringArray(log.CHECKERS, '|');
                    string[]      c  = StringHelper.GetStringArray(log.CHECK_TIMES, '|');
                    string[]      d  = null;
                    string[]      f  = null;
                    if (!string.IsNullOrEmpty(log.NOTES))
                    {
                        d = StringHelper.GetStringArray(log.NOTES, '|');
                    }
                    if (!string.IsNullOrEmpty(log.ANNEX_FILE))
                    {
                        f = StringHelper.GetStringArray(log.ANNEX_FILE, '|');
                    }
                    for (int i = 0; i < a.Length; i++)
                    {
                        string mbr = "", entrust = "";

                        if (b[i].IndexOf(":") >= 0)
                        {
                            mbr     = b[i].Split(':')[0];
                            entrust = b[i].Split(':')[1];
                        }
                        else
                        {
                            mbr = b[i];
                        }
                        sb.Append("<div class='l-row'><p><span>" + mbr + "</span><b>" + WFEnum.GetLogResult(a[i]) + "</b>");
                        sb.Append("<span>" + entrust + "</span>");
                        sb.Append("<label>" + c[i] + "</label></p>");
                        if (d != null && d.Length > i)
                        {
                            sb.Append("<p>" + d[i] + "</p>");
                        }
                        else
                        {
                            sb.Append("<p>无</p>");
                        }
                        if (f != null)
                        {
                            if (!string.IsNullOrEmpty(f[i]))
                            {
                                sb.Append("<p>附件:");
                                string[] lstAnnex = f[i].Split(',');
                                foreach (string strAnnex in lstAnnex)
                                {
                                    sb.Append("<a href='" + WebHelper.GetAppPath() + strAnnex + "' target='_blank'>" + strAnnex.Substring(strAnnex.LastIndexOf("/") + 1) + "</a></br>");
                                }
                                sb.Append("</p>");
                            }
                        }
                        sb.Append("</div>");
                    }
                    Response.Write(sb.ToString());
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
            else
            {
                Response.Write("<div class='l-row'><p>无审批记录</p></div>");
            }

            #endregion
        }

        if (Request["selVal"] != null)
        {
            //获取父下拉框选中的ITEM_ID
            V_TF_F_COLUMN_ITEM objVC = new V_TF_F_COLUMN_ITEM();
            objVC.COLUMN_ID = Convert.ToInt32(Request["Pcolumnid"]);
            objVC.VALUE     = Request["selVal"];

            V_TF_F_COLUMN_ITEM objI = BLLTable <V_TF_F_COLUMN_ITEM> .GetRowData(objVC);

            //获取子下拉框的内容项
            if (objI != null)
            {
                V_TF_F_COLUMN_ITEM objV = new V_TF_F_COLUMN_ITEM();
                objV.Distinct = true;
                objV.VALUE    = "";
                objV.TEXT     = "";

                objVC           = new V_TF_F_COLUMN_ITEM();
                objVC.COLUMN_ID = Convert.ToInt32(Request["columnid"]);
                objVC.DROP_REAL = Convert.ToString(objI.ITEM_ID);

                List <V_TF_F_COLUMN_ITEM> lstv = BLLTable <V_TF_F_COLUMN_ITEM> .Select(objV, objVC);

                if (lstv.Count > 0)
                {
                    Response.Write("{\"list\":" + JsonUtil.getJsonStr <V_TF_F_COLUMN_ITEM>(lstv) + ",\"first\":\"" + lstv[0].ITEM_ID + "\"}");
                }
                else
                {
                    Response.Write("{\"list\":\"\",\"first\":\"\"}");
                }
            }
        }

        Response.End();
    }
Пример #2
0
    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);
        //}
    }