Ejemplo n.º 1
0
 protected void btnFlowDeleted_Click(object sender, EventArgs e)
 {
     FlowExpressTraceLog.Init(true);
     labFlowDeleted.Text = FlowExpress.IsFlowCaseDeleted(FlowDeleted_FlowID.ucSelectedID, FlowDeleted_FlowCaseID.Text, FlowDeleted_IsRun.Checked).ToString();
     if (FlowExpressTraceLog.IsError())
     {
         labFlowDeleted.Text += "<hr>" + FlowExpressTraceLog.getFlowExpressTraceLogInfoPage();
     }
 }
Ejemplo n.º 2
0
 protected void FlowCaseValueChanged_Click(object sender, EventArgs e)
 {
     FlowExpressTraceLog.Init(true);
     FlowExpress.FlowCaseValueChangeKind tKind = (FlowExpress.FlowCaseValueChangeKind) int.Parse(FlowCaseValueChanged_ChangeKind.SelectedValue);
     labFlowCaseValueChanged.Text = FlowExpress.IsFlowCaseValueChanged(FlowCaseValueChanged_FlowID.ucSelectedID, FlowCaseValueChanged_FlowCaseID.Text, tKind, FlowCaseValueChanged_NewValues.Text.Split(','), FlowCaseValueChanged_ChkFields.Text.Split(',')).ToString();
     if (FlowExpressTraceLog.IsError())
     {
         labFlowCaseValueChanged.Text += "<hr>" + FlowExpressTraceLog.getFlowExpressTraceLogInfoPage();
     }
 }
Ejemplo n.º 3
0
    //2015.07.24 新增
    protected void btnFlowSysBtnVerify_Click(object sender, EventArgs e)
    {
        FlowExpressTraceLog.Init(true);
        FlowExpress oFlow = new FlowExpress(FlowSysBtnVerify_FlowID.ucSelectedID, FlowSysBtnVerify_FlowCaseID.Text, false, false);

        if (oFlow != null)
        {
            labFlowSysBtnVerify.Text = FlowExpress.IsFlowSysStepBtnVerify(oFlow.FlowID, oFlow.FlowCurrLastLogID, FlowSysBtnVerify_FlowSysStepBtnID.ucSelectedID, FlowSysBtnVerify_FlowCloseStepID.ucSelectedID, null, FlowSysBtnVerify_Opinion.Text).ToString();
            if (FlowExpressTraceLog.IsError())
            {
                labFlowSysBtnVerify.Text += "<hr>" + FlowExpressTraceLog.getFlowExpressTraceLogInfoPage();
            }
        }
        else
        {
            labFlowSysBtnVerify.Text = "初始 FlowExpress 物件錯誤";
        }
    }
Ejemplo n.º 4
0
    protected void IsFlowReAssign_Click(object sender, EventArgs e)
    {
        FlowExpressTraceLog.Init(true);
        if (IsFlowReAssign_ReAssignTo.Text.IsJSON())
        {
            //2017.01.25 新增改派對象可使用 JSON 格式
            labIsFlowReAssign.Text = FlowExpress.IsFlowReAssign(IsFlowReAssign_FlowID.ucSelectedID, IsFlowReAssign_FlowLogID.Text, Util.getDictionary(IsFlowReAssign_ReAssignTo.Text), IsFlowReAssign_Opinion.Text, IsFlowReAssign_IsRun.Checked).ToString();
        }
        else
        {
            labIsFlowReAssign.Text = FlowExpress.IsFlowReAssign(IsFlowReAssign_FlowID.ucSelectedID, IsFlowReAssign_FlowLogID.Text, IsFlowReAssign_ReAssignTo.Text, IsFlowReAssign_Opinion.Text, IsFlowReAssign_IsRun.Checked).ToString();
        }

        if (FlowExpressTraceLog.IsError())
        {
            labIsFlowReAssign.Text += "<hr>" + FlowExpressTraceLog.getFlowExpressTraceLogInfoPage();
        }
    }
Ejemplo n.º 5
0
    protected void btnStartVerify_Click(object sender, EventArgs e)
    {
        FlowExpress oFlow = new FlowExpress();

        labFlowVerifyMsg.Text = "";
        string strShowPopBtnJS = "";

        //取得流程意見,若為空白則補上預設值
        if (string.IsNullOrEmpty(txtFlowOpinion.ucTextData))
        {
            txtFlowOpinion.ucTextData = oFlow.FlowDefOpinion;
        }
        //取得指派對象,需將 value 中包含的項目Key移除
        AjaxControlToolkit.TabPanel TabVerify = TabVerifyContainer.ActiveTab;
        string strBtnSeqNo = TabVerify.ID.Right(2);
        Dictionary <string, string> oAssDic = new Dictionary <string, string>();

        //單選指派
        Util_ucCommSingleSelect oneVerify = (Util_ucCommSingleSelect)Util.FindControlEx(TabVerify, "oneVerify" + strBtnSeqNo);

        if (oneVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(oneVerify.ucSelectedDictionary, false));
        }
        //複選指派
        //可能是 ucCommMultiSelect 或是 ucCheckBoxList 2016.09.20
        Util_ucCommMultiSelect muiVerify = (Util_ucCommMultiSelect)Util.FindControlEx(TabVerify, "muiVerify" + strBtnSeqNo);

        if (muiVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(muiVerify.ucSelectedDictionary, false));
        }

        Util_ucCheckBoxList chkVerify = (Util_ucCheckBoxList)Util.FindControlEx(TabVerify, "chkVerify" + strBtnSeqNo);

        if (chkVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(chkVerify.ucSelectedDictionary, false));
        }


        //2014.10.20 新增
        //任意指派
        Util_ucUserPicker anyVerify = (Util_ucUserPicker)Util.FindControlEx(TabVerify, "anyVerify" + strBtnSeqNo);

        if (anyVerify.Visible && !string.IsNullOrEmpty(anyVerify.ucSelectedUserIDList))
        {
            for (int i = 0; i < anyVerify.ucSelectedUserIDList.Split(',').Count(); i++)
            {
                oAssDic.Add(anyVerify.ucSelectedUserIDList.Split(',')[i], UserInfo.findUserName(anyVerify.ucSelectedUserIDList.Split(',')[i]));
            }
        }

        //2014.11.05 新增
        //全部指派
        ListBox allVerify = (ListBox)Util.FindControlEx(TabVerify, "allVerify" + strBtnSeqNo);

        if (allVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(Util.getDictionary(allVerify.GetAllItems()), false));
        }

        //只顯示 [tabFlowVerify] 頁籤 2017.02.07
        tabCustForm.Visible      = false;
        tabFlowAttach.Visible    = false;
        tabFlowFullLog.Visible   = false;
        DivVerifyBtnArea.Visible = false;
        DivVerifyMsgArea.Visible = true;

        strShowPopBtnJS += "var oClose = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnClose');";
        strShowPopBtnJS += "if (oClose != null){oClose.style.display='';}";
        strShowPopBtnJS += "var oComplete = parent.document.getElementById('ucFlowTodoList1_ucModalPopup1_btnComplete');";
        strShowPopBtnJS += "if (oComplete != null){oComplete.style.display='';}";
        Util.setJSContent(strShowPopBtnJS);

        if (oAssDic.Count > 0)
        {
            //指派對象有值,可進行審核
            labFlowVerifyMsg.Text = "";
            Dictionary <string, string> dicBtnContext = Util.getDictionary(TabVerify.DynamicContextKey);  //取出btn參數
            string strFlowStepBtnID = dicBtnContext["FlowStepBtnID"].ToString().Trim();
            string strFlowStepBtnIsAddMultiSubFlow   = dicBtnContext["FlowStepBtnIsAddMultiSubFlow"].ToString().Trim().ToUpper();
            string strFlowStepBtnAddSubFlowID        = dicBtnContext["FlowStepBtnAddSubFlowID"].ToString().Trim();
            string strFlowStepBtnAddSubFlowStepBtnID = dicBtnContext["FlowStepBtnAddSubFlowStepBtnID"].ToString().Trim();
            string strFlowStepOpinion = txtFlowOpinion.ucTextData;

            bool IsNeedAddSubFlow    = false;
            bool IsAddSubFlowSucceed = false;

            //檢查是否有按鈕停止條件 2017.05.25 新增
            string[] oStopReasonList;
            string   strStopResonMsg;
            if (FlowExpress.IsFlowStepButtonStop(oFlow, strFlowStepBtnID, out oStopReasonList))
            {
                strStopResonMsg = string.Format(WorkRS.Resources.FlowVerifyMsg_StopVerify1, oFlow.FlowCaseHtmlInfo);
                if (!oStopReasonList.IsNullOrEmpty())
                {
                    string strStopReasonTip = string.Format(" {0} \n", WorkRS.Resources.FlowVerifyMsg_StopReasonTipTitle);
                    for (int i = 0; i < oStopReasonList.Length; i++)
                    {
                        strStopReasonTip += string.Format(" ● {0}\n", oStopReasonList[i]);
                    }
                    strStopResonMsg = string.Format("<span title=\"{0}\">{1}</span>", strStopReasonTip, strStopResonMsg);
                }
                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, strStopResonMsg);
                return;
            }

            //檢查是否有自訂審核URL
            if (!string.IsNullOrEmpty(oFlow.FlowCurrStepCustVerifyURL))
            {
                if (System.IO.File.Exists(Server.MapPath(oFlow.FlowCurrStepCustVerifyURL)))
                {
                    //==若有自訂審核URL==
                    //設定Session傳遞參數[FlowVerifyInfo]
                    dicBtnContext.Add("FlowStepAssignToList", Util.getJSON(oAssDic));
                    dicBtnContext.Add("FlowStepOpinion", strFlowStepOpinion);
                    dicBtnContext.Add("FlowVerifyJS", strShowPopBtnJS);
                    Session["FlowVerifyInfo"] = dicBtnContext;
                    //因為 Ajax Page 無法使用Server.Transfer,故 CustVerifyURL 改用 Response.Redirect()執行
                    //設定 CustVerifyURL
                    string strVerifyURL = string.Format("{0}?FlowID={1}&FlowLogID={2}", oFlow.FlowCurrStepCustVerifyURL, oFlow.FlowID, oFlow.FlowLogID);
                    for (int i = 0; i < oFlow.FlowKeyFieldList.Count(); i++)
                    {
                        if (oFlow.FlowKeyFieldList[i].ToUpper() != "_AUTONO")
                        {
                            strVerifyURL += string.Format("&{0}={1}", oFlow.FlowKeyFieldList[i], oFlow.FlowKeyValueList[i]);
                        }
                    }
                    Response.Redirect(strVerifyURL);
                }
                else
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(RS.Resources.Msg_NotExist1, oFlow.FlowCurrStepCustVerifyURL));
                }
                return;
            }

            //==無自訂審核URL==
            //處理[新增子流程]
            if (!string.IsNullOrEmpty(strFlowStepBtnAddSubFlowID) && !string.IsNullOrEmpty(strFlowStepBtnAddSubFlowStepBtnID))
            {
                //檢查是否自動新增子流程
                FlowExpress oSubFlow = new FlowExpress(strFlowStepBtnAddSubFlowID, null, false, false);
                //該子流程需符合以下條件才能自動新增:
                //01.子流程與父流程名稱不同
                //  子流程的 KeyFieldList 需只比主流程多出 _AutoNo 欄位 
                //  子流程的 KeyFieldsList 需與主流程的 KeyShowFieldList 相同
                //02.子流程與父流程名稱相同(遞迴)
                //  KeyFieldList 最後一欄需為 _AutoNo 欄位 
                if (oFlow.FlowID != strFlowStepBtnAddSubFlowID)
                {
                    //01.子流程與父流程名稱不同
                    string[] diffList = Util.getCompareList(oFlow.FlowKeyFieldList, oSubFlow.FlowKeyFieldList, Util.ListCompareMode.Diff);
                    if (diffList.Count() == 1 && diffList[0].ToUpper() == "_AUTONO")
                    {
                        if (Util.getCompareList(oFlow.FlowShowFieldList, oSubFlow.FlowShowFieldList, Util.ListCompareMode.Diff).Count() == 0)
                        {
                            IsNeedAddSubFlow = true;
                            if (strFlowStepBtnIsAddMultiSubFlow == "Y")
                            {
                                Dictionary <string, string> oTmpAss = new Dictionary <string, string>();
                                //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷)
                                IsAddSubFlowSucceed = true;
                                foreach (var pair in oAssDic)
                                {
                                    oTmpAss.Clear();
                                    oTmpAss.Add(pair.Key, pair.Value);
                                    if (IsAddSubFlowSucceed)
                                    {
                                        if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID))
                                        {
                                            IsAddSubFlowSucceed    = true;
                                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                        }
                                        else
                                        {
                                            IsAddSubFlowSucceed    = false;
                                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                //所有指派對象只產生一個子流程
                                if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID))
                                {
                                    IsAddSubFlowSucceed    = true;
                                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                }
                                else
                                {
                                    IsAddSubFlowSucceed    = false;
                                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                }
                            }
                        }
                    }
                }
                else
                {
                    //02.子流程與父流程名稱相同(遞迴)
                    if (oFlow.FlowKeyFieldList[oFlow.FlowKeyFieldList.Count() - 1].ToUpper() == "_AUTONO")
                    {
                        IsNeedAddSubFlow = true;
                        //組合子流程的 KeyValueList
                        string[] subKeyValueList = new string[oFlow.FlowKeyFieldList.Count() - 1];
                        for (int i = 0; i < subKeyValueList.Count(); i++)
                        {
                            subKeyValueList[i] = oFlow.FlowKeyValueList[i];
                        }

                        if (strFlowStepBtnIsAddMultiSubFlow == "Y")
                        {
                            Dictionary <string, string> oTmpAss = new Dictionary <string, string>();
                            //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷)
                            IsAddSubFlowSucceed = true;
                            foreach (var pair in oAssDic)
                            {
                                oTmpAss.Clear();
                                oTmpAss.Add(pair.Key, pair.Value);
                                if (IsAddSubFlowSucceed)
                                {
                                    if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID))
                                    {
                                        IsAddSubFlowSucceed    = true;
                                        labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                    }
                                    else
                                    {
                                        IsAddSubFlowSucceed    = false;
                                        labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                    }
                                }
                            }
                        }
                        else
                        {
                            //所有指派對象只產生一個子流程
                            if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinion, oFlow.FlowID, oFlow.FlowLogID))
                            {
                                IsAddSubFlowSucceed    = true;
                                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                            }
                            else
                            {
                                IsAddSubFlowSucceed    = false;
                                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                            }
                        }
                    }
                }
            }

            //處理[主流程審核]
            if (IsNeedAddSubFlow)
            {
                //需先[新增子流程]
                if (IsAddSubFlowSucceed)
                {
                    //若[新增子流程]成功
                    //當[FlowStepBtnAssignToList]有值,才執行主流程的[一般審核]  2015.08.26 優化
                    oAssDic.Clear();
                    oAssDic = Util.getDictionary(dicBtnContext["FlowStepBtnAssignToList"].ToString());
                    if (oAssDic != null && oAssDic.Count > 0)
                    {
                        if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinion))
                        {
                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                        }
                        else
                        {
                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                            //2014.11.27 顯示審核錯誤原因
                            DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID);
                            if (dtError != null && dtError.Rows.Count > 0)
                            {
                                labFlowVerifyMsg.Text += "<ul>";
                                for (int i = 0; i < dtError.Rows.Count; i++)
                                {
                                    labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim());
                                }
                                labFlowVerifyMsg.Text += "</ul>";
                            }
                        }
                    }
                }
            }
            else
            {
                //一般審核
                if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinion))
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                }
                else
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                    //2014.11.27 顯示審核錯誤原因
                    DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID);
                    if (dtError != null && dtError.Rows.Count > 0)
                    {
                        labFlowVerifyMsg.Text += "<ul>";
                        for (int i = 0; i < dtError.Rows.Count; i++)
                        {
                            labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim());
                        }
                        labFlowVerifyMsg.Text += "</ul>";
                    }
                }
            }
        }
        else
        {
            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_AssignToNotFound);
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 按下開始審核
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnStartVerify_Click(object sender, EventArgs e)
    {
        //取得 UI 指派對象
        Dictionary <string, string> oAssDic = new Dictionary <string, string>();

        //單選指派
        if (oneVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(oneVerify.ucSelectedDictionary, false));
        }
        //複選指派
        if (muiVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(muiVerify.ucSelectedDictionary, false));
        }
        if (chkVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(chkVerify.ucSelectedDictionary, false));
        }
        //任意指派
        if (anyVerify.Visible && !string.IsNullOrEmpty(anyVerify.ucSelectedUserIDList))
        {
            for (int i = 0; i < anyVerify.ucSelectedUserIDList.Split(',').Count(); i++)
            {
                oAssDic.Add(anyVerify.ucSelectedUserIDList.Split(',')[i], UserInfo.findUserName(anyVerify.ucSelectedUserIDList.Split(',')[i]));
            }
        }
        //全部指派
        if (allVerify.Visible)
        {
            oAssDic.AddRange(Util.getDictionary(Util.getDictionary(allVerify.GetAllItems()), false));
        }

        DivVerifyBtnArea.Visible = false;
        DivVerifyMsgArea.Visible = true;
        labFlowVerifyMsg.Text    = "";

        string strShowPopBtnJS = "";

        strShowPopBtnJS += "var oClose = parent.document.getElementById('ucModalPopup1_btnClose');";
        strShowPopBtnJS += "if (oClose != null){oClose.style.display='';}";
        strShowPopBtnJS += "var oComplete = parent.document.getElementById('ucModalPopup1_btnComplete');";
        strShowPopBtnJS += "if (oComplete != null){oComplete.style.display='';}";
        Util.setJSContent(strShowPopBtnJS);

        //開始判斷
        if (oAssDic.Count <= 0)
        {
            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_AssignToNotFound);  //缺少指派對象
        }
        else
        {
            //指派對象有值,可進行審核
            Dictionary <string, string> dicPara = Util.getDictionary(Request.QueryString);
            if (dicPara.IsNullOrEmpty())
            {             //缺少流程參數
                Util.setJSContent("alert('" + WorkRS.Resources.FlowFullLogMsg_FlowParaError + "');");
                return;
            }

            Dictionary <string, string> dicBtnContext = _dicBtnContext;  //取出btn參數
            FlowExpress oFlow = new FlowExpress(_dicBtnContext["FlowID"], _dicBtnContext["FlowLogID"], true, false);

            string strFlowStepBtnID = dicBtnContext["FlowStepBtnID"].ToString().Trim();
            string strFlowStepBtnIsAddMultiSubFlow   = dicBtnContext["FlowStepBtnIsAddMultiSubFlow"].ToString().Trim().ToUpper();
            string strFlowStepBtnAddSubFlowID        = dicBtnContext["FlowStepBtnAddSubFlowID"].ToString().Trim();
            string strFlowStepBtnAddSubFlowStepBtnID = dicBtnContext["FlowStepBtnAddSubFlowStepBtnID"].ToString().Trim();
            string strFlowStepOpinion       = dicBtnContext["FlowStepOpinion"].ToString().Trim();
            string strFlowStepOpinionForSQL = strFlowStepOpinion.Replace("'", "''");        //預防 FlowStepOpinion 含有單引號 2017.04.28

            bool IsNeedAddSubFlow    = false;
            bool IsAddSubFlowSucceed = false;

            //檢查是否有按鈕停止條件 2017.05.25 新增
            string[] oStopReasonList;
            string   strStopResonMsg;
            if (FlowExpress.IsFlowStepButtonStop(oFlow, strFlowStepBtnID, out oStopReasonList))
            {
                strStopResonMsg = string.Format(WorkRS.Resources.FlowVerifyMsg_StopVerify1, oFlow.FlowCaseHtmlInfo);
                if (!oStopReasonList.IsNullOrEmpty())
                {
                    string strStopReasonTip = string.Format(" {0} \n", WorkRS.Resources.FlowVerifyMsg_StopReasonTipTitle);
                    for (int i = 0; i < oStopReasonList.Length; i++)
                    {
                        strStopReasonTip += string.Format(" ● {0}\n", oStopReasonList[i]);
                    }
                    strStopResonMsg = string.Format("<span title=\"{0}\">{1}</span>", strStopReasonTip, strStopResonMsg);
                }
                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, strStopResonMsg);
                return;
            }

            //檢查是否有自訂審核URL
            if (!string.IsNullOrEmpty(oFlow.FlowCurrStepCustVerifyURL))
            {
                if (System.IO.File.Exists(Server.MapPath(oFlow.FlowCurrStepCustVerifyURL)))
                {
                    //==若有自訂審核URL==
                    //設定Session傳遞參數[FlowVerifyInfo]
                    dicBtnContext.TryAdd("FlowStepAssignToList", Util.getJSON(oAssDic));
                    dicBtnContext.TryAdd("FlowStepOpinion", strFlowStepOpinion);
                    dicBtnContext.TryAdd("FlowVerifyJS", strShowPopBtnJS);
                    Session["FlowVerifyInfo"] = dicBtnContext;

                    //因為 Ajax Page 無法使用Server.Transfer,故 CustVerifyURL 改用 Response.Redirect()執行
                    //設定 CustVerifyURL
                    string strVerifyURL = string.Format("{0}?FlowID={1}&FlowLogID={2}", oFlow.FlowCurrStepCustVerifyURL, oFlow.FlowID, oFlow.FlowLogID);
                    for (int i = 0; i < oFlow.FlowKeyFieldList.Count(); i++)
                    {
                        if (oFlow.FlowKeyFieldList[i].ToUpper() != "_AUTONO")
                        {
                            strVerifyURL += string.Format("&{0}={1}", oFlow.FlowKeyFieldList[i], oFlow.FlowKeyValueList[i]);
                        }
                    }
                    Response.Redirect(strVerifyURL);
                }
                else
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(RS.Resources.Msg_NotExist1, oFlow.FlowCurrStepCustVerifyURL));
                }
                return;
            }

            //==無自訂審核URL==
            //處理[新增子流程]
            if (!string.IsNullOrEmpty(strFlowStepBtnAddSubFlowID) && !string.IsNullOrEmpty(strFlowStepBtnAddSubFlowStepBtnID))
            {
                //檢查是否自動新增子流程
                FlowExpress oSubFlow = new FlowExpress(strFlowStepBtnAddSubFlowID, null, false, false);
                //該子流程需符合以下條件才能自動新增:
                //01.子流程與父流程名稱不同
                //  子流程的 FlowKeyFieldList 需只比主流程 FlowKeyFieldList 多出 _AutoNo 欄位 
                //  子流程的 FlowShowFieldList 需與主流程的 FlowShowFieldList 相同
                //02.子流程與父流程名稱相同(遞迴)
                //  FlowKeyFieldList 最後一欄需為 _AutoNo 欄位 
                if (oFlow.FlowID != strFlowStepBtnAddSubFlowID)
                {
                    //01.子流程與父流程名稱不同
                    string[] diffList = Util.getCompareList(oFlow.FlowKeyFieldList, oSubFlow.FlowKeyFieldList, Util.ListCompareMode.Diff);
                    if (diffList.Count() == 1 && diffList[0].ToUpper() == "_AUTONO")
                    {
                        if (Util.getCompareList(oFlow.FlowShowFieldList, oSubFlow.FlowShowFieldList, Util.ListCompareMode.Diff).Count() == 0)
                        {
                            IsNeedAddSubFlow = true;
                            if (strFlowStepBtnIsAddMultiSubFlow == "Y")
                            {
                                Dictionary <string, string> oTmpAss = new Dictionary <string, string>();
                                //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷)
                                IsAddSubFlowSucceed = true;
                                foreach (var pair in oAssDic)
                                {
                                    oTmpAss.Clear();
                                    oTmpAss.Add(pair.Key, pair.Value);
                                    if (IsAddSubFlowSucceed)
                                    {
                                        if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinionForSQL, oFlow.FlowID, oFlow.FlowLogID))
                                        {
                                            IsAddSubFlowSucceed    = true;
                                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                        }
                                        else
                                        {
                                            IsAddSubFlowSucceed    = false;
                                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                //所有指派對象只產生一個子流程
                                if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, oFlow.FlowKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinionForSQL, oFlow.FlowID, oFlow.FlowLogID))
                                {
                                    IsAddSubFlowSucceed    = true;
                                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                }
                                else
                                {
                                    IsAddSubFlowSucceed    = false;
                                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                }
                            }
                        }
                        else
                        {
                            //2017.05.03 強化錯誤訊息
                            IsAddSubFlowSucceed    = false;
                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(RS.Resources.Msg_ParaError1, "FlowShowFieldList"));
                        }
                    }
                }
                else
                {
                    //02.子流程與父流程名稱相同(遞迴)
                    if (oFlow.FlowKeyFieldList[oFlow.FlowKeyFieldList.Count() - 1].ToUpper() == "_AUTONO")
                    {
                        IsNeedAddSubFlow = true;
                        //組合子流程的 KeyValueList
                        string[] subKeyValueList = new string[oFlow.FlowKeyFieldList.Count() - 1];
                        for (int i = 0; i < subKeyValueList.Count(); i++)
                        {
                            subKeyValueList[i] = oFlow.FlowKeyValueList[i];
                        }

                        if (strFlowStepBtnIsAddMultiSubFlow == "Y")
                        {
                            Dictionary <string, string> oTmpAss = new Dictionary <string, string>();
                            //每個指派對象都產生獨立子流程(只要其中一個子流程新增失敗,就自動中斷)
                            IsAddSubFlowSucceed = true;
                            foreach (var pair in oAssDic)
                            {
                                oTmpAss.Clear();
                                oTmpAss.Add(pair.Key, pair.Value);
                                if (IsAddSubFlowSucceed)
                                {
                                    if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oTmpAss, strFlowStepOpinionForSQL, oFlow.FlowID, oFlow.FlowLogID))
                                    {
                                        IsAddSubFlowSucceed    = true;
                                        labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                                    }
                                    else
                                    {
                                        IsAddSubFlowSucceed    = false;
                                        labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                                    }
                                }
                            }
                        }
                        else
                        {
                            //所有指派對象只產生一個子流程
                            if (FlowExpress.IsFlowInsVerify(oSubFlow.FlowID, subKeyValueList, oFlow.FlowShowValueList, strFlowStepBtnAddSubFlowStepBtnID, oAssDic, strFlowStepOpinionForSQL, oFlow.FlowID, oFlow.FlowLogID))
                            {
                                IsAddSubFlowSucceed    = true;
                                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowSucceed);
                            }
                            else
                            {
                                IsAddSubFlowSucceed    = false;
                                labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, WorkRS.Resources.FlowVerifyMsg_FlowVerifyAddSubFlowError);
                            }
                        }
                    }
                }
            }

            //處理[主流程審核]
            if (IsNeedAddSubFlow)
            {
                if (IsAddSubFlowSucceed)
                {
                    //若[新增子流程]成功
                    //當[FlowStepBtnAssignToList]有值,才執行主流程的[一般審核]  2015.08.26 優化
                    oAssDic.Clear();
                    oAssDic = Util.getDictionary(dicBtnContext["FlowStepBtnAssignToList"].ToString());
                    if (oAssDic != null && oAssDic.Count > 0)
                    {
                        if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinionForSQL))
                        {
                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                        }
                        else
                        {
                            labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                            //2014.11.27 顯示審核錯誤原因
                            DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID);
                            if (dtError != null && dtError.Rows.Count > 0)
                            {
                                labFlowVerifyMsg.Text += "<ul>";
                                for (int i = 0; i < dtError.Rows.Count; i++)
                                {
                                    labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim());
                                }
                                labFlowVerifyMsg.Text += "</ul>";
                            }
                        }
                    }
                }
            }
            else
            {
                //一般審核
                if (FlowExpress.IsFlowVerify(oFlow.FlowID, oFlow.FlowLogID, strFlowStepBtnID, oAssDic, strFlowStepOpinionForSQL))
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifySucceed1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                }
                else
                {
                    labFlowVerifyMsg.Text += Util.getHtmlMessage(Util.HtmlMessageKind.Error, string.Format(WorkRS.Resources.FlowVerifyMsg_FlowVerifyError1, oFlow.FlowCaseHtmlInfo)); //2017.05.11 改顯示 FlowCaseHtmlInfo
                    //2014.11.27 顯示審核錯誤原因
                    DataTable dtError = FlowExpressTraceLog.getFlowExpressErrorLogData(oFlow.FlowID, oFlow.FlowCaseID, oFlow.FlowLogID);
                    if (dtError != null && dtError.Rows.Count > 0)
                    {
                        labFlowVerifyMsg.Text += "<ul>";
                        for (int i = 0; i < dtError.Rows.Count; i++)
                        {
                            labFlowVerifyMsg.Text += string.Format("<li style='color:gray;'>{0}</li>", dtError.Rows[i]["LogDesc"].ToString().Trim());
                        }
                        labFlowVerifyMsg.Text += "</ul>";
                    }
                }
            }
        }
    }