예제 #1
0
    /// <summary>
    /// 結案後HROverTimeLog的Flag解除
    /// </summary>
    /// <param name="FlowCaseID">FlowCaseID</param>
    /// <param name="AD">A事先/D事後</param>
    /// <param name="sb">回傳SQL語法,統一給TryCatchIsFlowVerify執行</param>
    public static void CloseHROverTimeLog(string FlowCaseID, string AD, ref CommandHelper sb)
    {
        //AD = ADTable(AD);  //HROverTimeLogAD不要加
        DataTable dt = HROverTimeLogAD(FlowCaseID, AD);

        FlowUtility.ChangeFlowFlag(FlowCaseID, dt.Rows[0]["FlowCode"].ToString(), dt.Rows[0]["FlowSN"].ToString(), dt.Rows[0]["SignIDComp"].ToString(), dt.Rows[0]["SignID"].ToString(), "0", ref sb);
    }
    private void DoRelease()
    {
        if (Session["FlowVerifyInfo"] != null)
        {
            DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
            CommandHelper sb = db.CreateCommandHelper();
            DbConnection  cn = db.OpenConnection();
            DbTransaction tx = cn.BeginTransaction();
            try
            {
                //永豐流程相關資料
                FlowExpress oFlow = new FlowExpress("OnBizReqAppd_ITRD", Request["FlowLogID"], true);

                //預設下關審核人,因為只有一關所以是結案人,即為本關審核人
                Dictionary <string, string> oVerifyInfo = (Dictionary <string, string>)Session["FlowVerifyInfo"];
                Session["FlowVerifyInfo"] = null;
                Util.setJSContent(oVerifyInfo["FlowVerifyJS"]);
                Dictionary <string, string> oAssDic = Util.getDictionary(oVerifyInfo["FlowStepAssignToList"]);

                //審核資料
                string    strFlowCustDB   = oFlow.FlowID;
                string    strReason       = oFlow.FlowDefOpinion;
                string [] FlowList        = oFlow.FlowKeyValueList;
                string    rowCompID       = FlowList[0];
                string    rowEmpID        = FlowList[1];
                string    rowWriteDate    = FlowList[2];
                string    rowFormSeq      = FlowList[3];
                string    rowFlowCaseID   = oFlow.getFlowCaseID(oFlow.FlowLogID);
                string    rowFlowLogID    = oFlow.FlowLogID;
                string    btnAct          = "";
                string    strOBFormStatus = "";
                string    HRLogStatus     = "";

                if (oVerifyInfo["FlowStepBtnID"].ToString() == "btnClose") //核准
                {
                    btnAct          = "btnClose";
                    strOBFormStatus = "3";
                    HRLogStatus     = "2";
                }
                else if (oVerifyInfo["FlowStepBtnID"].ToString() == "btnReject") //駁回
                {
                    btnAct          = "btnReject";
                    strOBFormStatus = "4";
                    HRLogStatus     = "3";
                }
                else //有問題
                {
                    ShowError("永豐流程按鈕錯誤");
                    return;
                }

                //審核SQL字串
                OnBizReqAppdOperationSql.UpdateVisitForm(rowCompID, rowEmpID, rowWriteDate, rowFormSeq, strOBFormStatus, strReason, ref sb);
                OnBizReqAppdOperationSql.UpdateHROverTimeLog(rowFlowCaseID, HRLogStatus, ref sb);
                FlowUtility.ChangeFlowFlag(rowFlowCaseID, "OB01", "0001", UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb);

                /*******************************/
                //sb.Append("我是來製造錯誤的~☆");  //測試用
                //labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed);
                //return;
                /*******************************/

                //先執行SQL,if(永豐流程成功)則Commit,else則RollBack。
                db.ExecuteNonQuery(sb.BuildCommand(), tx);
                if (FlowExpress.IsFlowVerify(strFlowCustDB, rowFlowLogID, btnAct, oAssDic, strReason))
                {
                    tx.Commit();
                    labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed);
                }
                else
                {
                    ShowError("永豐流程執行失敗");
                }
            }
            catch (Exception ex)
            {
                tx.Rollback();
                ShowError("SQL語法出現錯誤,\n" + ex.Message);
            }
        }
        else
        {
            //參數錯誤
            labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError);
        }
    }
예제 #3
0
    /// <summary>
    /// 審核
    /// </summary>
    private void DoRelease()
    {
        DbHelper      db                    = new DbHelper(_attendantDBName);
        CommandHelper sb                    = db.CreateCommandHelper();
        DbConnection  cn                    = db.OpenConnection();
        DbTransaction tx                    = cn.BeginTransaction();
        FlowExpress   oFlow                 = new FlowExpress("OnBizReqAppd_ITRD");
        string        FlowCustDB            = oFlow.FlowID;
        Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(UserInfo.getUserInfo().UserID, UserInfo.getUserInfo().CompID);

        try
        {
            for (int introw = 0; introw < gvCheckVisitForm.Rows.Count; introw++)
            {
                CheckBox objchk = (CheckBox)gvCheckVisitForm.Rows[introw].FindControl("chkChoiced");


                if (objchk.Checked == true)
                {
                    RadioButton rdoApp        = (RadioButton)gvCheckVisitForm.Rows[introw].FindControl("rbnApproved");
                    RadioButton rdoRej        = (RadioButton)gvCheckVisitForm.Rows[introw].FindControl("rbnReject");
                    TextBox     txtReson      = (TextBox)gvCheckVisitForm.Rows[introw].FindControl("txtReson");
                    string      rowCompID     = gvCheckVisitForm.DataKeys[introw].Values["CompID"].ToString();
                    string      rowEmpID      = gvCheckVisitForm.DataKeys[introw].Values["EmpID"].ToString();
                    string      rowWriteDate  = gvCheckVisitForm.DataKeys[introw].Values["WriteDate"].ToString();
                    string      rowFormSeq    = gvCheckVisitForm.DataKeys[introw].Values["FormSeq"].ToString();
                    string      rowFlowCaseID = gvCheckVisitForm.DataKeys[introw].Values["FlowCaseID"].ToString();
                    string      rowFlowLogID  = gvCheckVisitForm.DataKeys[introw].Values["FlowLogID"].ToString();
                    string      btnAct        = "";
                    string      OBFormStatus  = "";
                    string      HRLogStatus   = "";
                    if (rdoApp.Checked == true)
                    {
                        btnAct       = "btnClose";
                        OBFormStatus = "3";
                        HRLogStatus  = "2";
                    }
                    else if (rdoRej.Checked == true)
                    {
                        btnAct       = "btnReject";
                        OBFormStatus = "4";
                        HRLogStatus  = "3";
                    }

                    OnBizReqAppdOperationSql.UpdateVisitForm(rowCompID, rowEmpID, rowWriteDate, rowFormSeq, OBFormStatus, txtReson.Text.ToString(), ref sb);
                    OnBizReqAppdOperationSql.UpdateHROverTimeLog(rowFlowCaseID, HRLogStatus, ref sb);
                    FlowUtility.ChangeFlowFlag(rowFlowCaseID, "OB01", "0001", UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb);


                    //先執行SQL,if(永豐流程成功)則Commit,else則RollBack。 //20170613 leo modify
                    db.ExecuteNonQuery(sb.BuildCommand(), tx);
                    if (FlowExpress.IsFlowVerify(FlowCustDB, rowFlowLogID, btnAct, oAssDic, txtReson.Text.ToString()))
                    {
                        tx.Commit();
                        Util.MsgBox("審核成功!");
                    }
                    else
                    {
                        throw new Exception("審核失敗!");
                    }
                }
            }
        }
        catch (Exception ex)
        {
            tx.Rollback();
            Util.MsgBox(ex.Message);
        }
    }
예제 #4
0
    public static bool PunchAppdOperation_SaveData(Punch_Confirm_Remedy_Bean model, Dictionary <string, string> oAssDic, string btnName, string FlowStepOpinion, out long seccessCount, out string msg, string flowCode = "", string flowSN = "", string flowSeq = "", string FlowLogBatNo = "", string FlowLogID = "", Dictionary <string, string> toUserData = null)
    {
        seccessCount = 0;
        msg          = "";
        Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean();

        try
        {
            FlowExpress flow         = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID, false);
            string      strFlowLogID = flow.FlowCurrLastLogID;
            //string strFlowLogID=PunchUpdate.getFlowLogID(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID);
            //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID);
            //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), strFlowLogID);
            DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
            CommandHelper sb = db.CreateCommandHelper();
            DbConnection  cn = db.OpenConnection();
            DbTransaction tx = cn.BeginTransaction();

            Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
            {
                FlowCaseID       = model.FlowCaseID,
                CompID           = model.CompID,
                EmpID            = model.EmpID,
                EmpName          = model.EmpName,
                DutyDate         = model.DutyDate,
                DutyTime         = model.DutyTime,
                PunchDate        = model.PunchDate,
                PunchTime        = model.PunchTime,
                PunchConfirmSeq  = model.PunchConfirmSeq,
                DeptID           = model.DeptID,
                DeptName         = model.DeptName,
                OrganID          = model.OrganID,
                OrganName        = model.OrganName,
                FlowOrganID      = model.FlowOrganID,
                FlowOrganName    = model.FlowOrganName,
                ConfirmStatus    = model.ConfirmStatus,
                PunchRemedySeq   = model.PunchRemedySeq,
                RemedyReasonID   = model.RemedyReasonID,
                RemedyReasonCN   = model.RemedyReasonCN,
                RemedyPunchTime  = model.RemedyPunchTime,
                AbnormalFlag     = model.AbnormalFlag,
                AbnormalReasonID = model.AbnormalReasonID,
                AbnormalReasonCN = model.AbnormalReasonCN,
                AbnormalDesc     = model.AbnormalDesc,

                Remedy_MAFT10_FLAG      = model.Remedy_MAFT10_FLAG,
                Remedy_AbnormalFlag     = model.Remedy_AbnormalFlag,
                Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID,
                Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN,
                Remedy_AbnormalDesc     = model.Remedy_AbnormalDesc,
                LastChgComp             = model.LastChgComp,
                LastChgID   = model.LastChgID,
                LastChgDate = model.LastChgDate,
                //Remedy
                RemedyPunchFlag = model.RemedyPunchFlag,
                BatchFlag       = model.BatchFlag,
                PORemedyStatus  = model.PORemedyStatus,
                RejectReason    = model.RejectReason,
                RejectReasonCN  = model.RejectReasonCN,
                ValidDateTime   = model.ValidDateTime,
                ValidCompID     = model.ValidCompID,
                ValidID         = model.ValidID,
                ValidName       = model.ValidName
            };
            try
            {
                SqlCommand.PunchAppdOperation_UpdatePunchRemedyLog(dataBean, ref sb);
                SqlCommand.PunchAppdOperation_UpdatePunchConfirm(dataBean, ref sb); //內部判定結案or駁回
                SqlCommand.PunchAppdOperation_UpdateHROtherFlowLog(dataBean.FlowCaseID, dataBean.ConfirmStatus == "4" ? "3" : "2", ref sb);

                if (dataBean.PORemedyStatus == "2")//沒結案(送簽中)
                {
                    OBFlowUtility.InsertHROtherFlowLogCommand(dataBean.FlowCaseID, CustVerify.addone(FlowLogBatNo), CustVerify.FlowLogIDadd(FlowLogID), "P", dataBean.EmpID, dataBean.OrganID, dataBean.FlowOrganID, UserInfo.getUserInfo().UserID, flowCode, flowSN, CustVerify.addone(flowSeq), toUserData["SignLine"], toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb);
                }
                else if (dataBean.PORemedyStatus == "3" || dataBean.PORemedyStatus == "4")//結案
                {
                    FlowUtility.ChangeFlowFlag(dataBean.FlowCaseID, flowCode, flowSN, UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb);
                }
                //======(test錯誤的存在)=======
                //sb.Append("test錯誤的存在");
                msg = "注定失敗";
                return(false);

                //======(test錯誤的存在)=======
                seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制
                if (seccessCount > 0)
                {
                    if (FlowExpress.IsFlowVerify(flow.FlowID, flow.FlowCurrLastLogID, btnName, oAssDic, FlowStepOpinion))
                    {
                        tx.Commit(); //成功Transaction直接Commit
                    }
                    else
                    {
                        tx.Rollback(); //失敗Transaction Rollback
                        msg = "永豐流程寫入失敗";
                    }
                }
                else
                {
                    tx.Rollback(); //失敗Transaction Rollback
                    msg = "審核失敗,更新0筆資料";
                }
            }
            catch (Exception ex)
            {
                tx.Rollback(); //失敗Transaction Rollback
                msg = ex.Message;
                throw ex;
            }
        }
        catch (Exception ex)
        {
            //tx.Rollback(); //失敗Transaction Rollback
            msg = ex.Message;
            return(false);
        }
        return(true);
    }