Exemplo n.º 1
0
        /// <summary>ワークフロー依頼を受付ます。</summary>
        /// <param name="workflowRequest">選択したワークフロー依頼</param>
        /// <param name="acceptanceUserId">受付ユーザID</param>
        public void AcceptWfRequest(DataRow workflowRequest, decimal acceptanceUserId)
        {
            #region チェック処理を実装

            if (workflowRequest == null)
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "workflowRequest")));
            }
            else if (!workflowRequest.Table.Columns.Contains("WorkflowControlNo"))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_FIELD_ISNT_CONTAINED,
                                                      "WorkflowControlNo", "workflowRequest")));
            }

            #endregion

            // ユーザIDからユーザ情報を取得
            string acceptanceUserInfo = Workflow.GetUserInfo(acceptanceUserId);

            // --------------------------------------------------
            // 受付(T_CurrentWorkflowのacceptance項目を更新)
            // --------------------------------------------------
            // T_CurrentWorkflowのUPDATE
            // --------------------------------------------------
            DaoT_CurrentWorkflow daoT_CurrentWorkflow = new DaoT_CurrentWorkflow(this.Dam);

            // PK
            daoT_CurrentWorkflow.PK_WorkflowControlNo = workflowRequest["WorkflowControlNo"];

            // Acceptance
            daoT_CurrentWorkflow.Set_AcceptanceDate_forUPD     = DateTime.Now;
            daoT_CurrentWorkflow.Set_AcceptanceUserId_forUPD   = acceptanceUserId;
            daoT_CurrentWorkflow.Set_AcceptanceUserInfo_forUPD = acceptanceUserInfo;

            // 受付(更新)
            daoT_CurrentWorkflow.D3_Update();

            // --------------------------------------------------
            // 履歴に移動(差戻しに対応するため)
            // --------------------------------------------------
            // T_CurrentWorkflow→T_WorkflowHistory
            // --------------------------------------------------
            CmnDao dao = new CmnDao(this.Dam);
            dao.SQLFileName = "RequestApproval_Move.sql";
            dao.SetParameter("WorkflowControlNo", workflowRequest["WorkflowControlNo"]);
            dao.ExecInsUpDel_NonQuery();
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is used to accept the workflow by different users once the workflow is accepted
        /// by updating acceptance columns of T_CurrentWorkflow and T_WorkflowHistory table with null.
        /// </summary>
        /// <param name="nextWorkflow"></param>
        /// <param name="workflowControlNo"></param>
        /// <returns></returns>
        public void SwitchPersonInCharge(DataRow nextWorkflow, string workflowControlNo)
        {
            #region チェック処理を実装

            if (nextWorkflow == null)
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "nextWorkflow")));
            }
            else if (!nextWorkflow.Table.Columns.Contains("SubSystemId"))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_FIELD_ISNT_CONTAINED,
                                                      "SubSystemId", "nextWorkflow")));
            }
            else if (string.IsNullOrEmpty(workflowControlNo))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "workflowControlNo")));
            }

            #endregion

            //Updates the acceptance information with null in T_CurrentWorkflow table for many users acceptance
            DaoT_CurrentWorkflow daoT_CurrentWorkflow = new DaoT_CurrentWorkflow(this.Dam);

            // 主キー情報
            daoT_CurrentWorkflow.PK_WorkflowControlNo = workflowControlNo;

            daoT_CurrentWorkflow.Set_AcceptanceDate_forUPD     = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserId_forUPD   = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserInfo_forUPD = DBNull.Value;

            daoT_CurrentWorkflow.D3_Update();
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method is used to terminate the workflow forecefully
        /// by updating EndDate column of T_Workflow table with enddate.
        /// </summary>
        /// <param name="nextWorkflow"></param>
        /// <param name="workflowControlNo"></param>
        /// <param name="fromUserId"></param>
        /// <param name="currentWorkflowReserveArea"></param>
        /// <returns></returns>
        public int ForcedTermination(DataRow nextWorkflow, string workflowControlNo, decimal fromUserId, string currentWorkflowReserveArea)
        {
            #region チェック処理を実装

            if (nextWorkflow == null)
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "nextWorkflow")));
            }
            else if (!nextWorkflow.Table.Columns.Contains("SubSystemId"))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_FIELD_ISNT_CONTAINED,
                                                      "SubSystemId", "nextWorkflow")));
            }
            else if (string.IsNullOrEmpty(workflowControlNo))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "workflowControlNo")));
            }

            // ユーザIDからユーザ情報を取得
            string fromUserInfo = Workflow.GetUserInfo(fromUserId);

            string toUserInfo = "";

            #endregion

            // --------------------------------------------------
            // 現在の履歴件数を取得。
            // --------------------------------------------------
            //Gets the record count from T_WorkflowHistory table
            // --------------------------------------------------
            CmnDao dao = new CmnDao(this.Dam);

            dao.SQLFileName = "RequestApproval_Count.sql";
            dao.SetParameter("WorkflowControlNo", workflowControlNo);
            int recordCount = ((int)dao.ExecSelectScalar());

            // --------------------------------------------------
            // ワークフロー承認を依頼
            // --------------------------------------------------
            // T_CurrentWorkflowのUPDATE
            // --------------------------------------------------
            DaoT_CurrentWorkflow daoT_CurrentWorkflow = new DaoT_CurrentWorkflow(this.Dam);

            // 主キー情報
            daoT_CurrentWorkflow.PK_WorkflowControlNo = workflowControlNo;

            // 履歴番号は履歴件数+1
            daoT_CurrentWorkflow.Set_HistoryNo_forUPD = recordCount + 1;

            daoT_CurrentWorkflow.Set_WfPositionId_forUPD = nextWorkflow["WfPositionId"];
            daoT_CurrentWorkflow.Set_WorkflowNo_forUPD   = nextWorkflow["WorkflowNo"];
            daoT_CurrentWorkflow.Set_FromUserId_forUPD   = fromUserId; // 実際のユーザIDを入力する。
            daoT_CurrentWorkflow.Set_FromUserInfo_forUPD = fromUserInfo;
            //Updates the ActionType with Abnormal termination
            daoT_CurrentWorkflow.Set_ActionType_forUPD = "ABEnd";

            // 上記以外は、nextWorkflow["ToUserId"]を指定する。
            daoT_CurrentWorkflow.Set_ToUserId_forUPD = nextWorkflow["ToUserId"];

            daoT_CurrentWorkflow.Set_ToUserInfo_forUPD             = toUserInfo;
            daoT_CurrentWorkflow.Set_ToUserPositionTitlesId_forUPD = nextWorkflow["ToUserPositionTitlesId"];
            daoT_CurrentWorkflow.Set_NextWfPositionId_forUPD       = nextWorkflow["NextWfPositionId"];
            daoT_CurrentWorkflow.Set_NextWorkflowNo_forUPD         = nextWorkflow["NextWorkflowNo"];
            daoT_CurrentWorkflow.Set_ReserveArea_forUPD            = currentWorkflowReserveArea;

            daoT_CurrentWorkflow.Set_StartDate_forUPD          = DateTime.Now;
            daoT_CurrentWorkflow.Set_AcceptanceDate_forUPD     = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserId_forUPD   = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserInfo_forUPD = DBNull.Value;

            daoT_CurrentWorkflow.D3_Update();

            // --------------------------------------------------
            // 完了(T_WorkflowHistoryのEndDate項目を更新)
            // --------------------------------------------------
            // T_WorkflowHistoryのUPDATE
            // --------------------------------------------------
            DaoT_WorkflowHistory daoT_WorkflowHistory = new DaoT_WorkflowHistory(this.Dam);

            // PK
            daoT_WorkflowHistory.PK_WorkflowControlNo = workflowControlNo;
            daoT_WorkflowHistory.PK_HistoryNo         = recordCount;

            //Updates the EndDate to current date for forceful termination
            daoT_WorkflowHistory.Set_EndDate_forUPD = DateTime.Now;

            daoT_WorkflowHistory.S3_Update();

            //---

            // 完了
            // --------------------------------------------------
            // 完了の場合(T_WorkflowのEndDate項目を更新)
            // --------------------------------------------------
            // T_WorkflowのUPDATE
            // --------------------------------------------------
            DaoT_Workflow daoT_Workflow = new DaoT_Workflow(this.Dam);

            // PK
            daoT_Workflow.PK_WorkflowControlNo = workflowControlNo;

            //Updates the EndDate to current date for forceful termination
            daoT_Workflow.Set_EndDate_forUPD = DateTime.Now;

            daoT_Workflow.S3_Update();

            // --------------------------------------------------
            // 履歴に移動
            // --------------------------------------------------
            // T_CurrentWorkflow→T_WorkflowHistory
            // --------------------------------------------------
            dao.SQLFileName = "RequestApproval_Move.sql";
            dao.SetParameter("WorkflowControlNo", workflowControlNo);
            dao.ExecInsUpDel_NonQuery();

            // リターン(MailTemplateId)
            if (nextWorkflow["MailTemplateId"] == DBNull.Value)
            {
                return(0);
            }
            else
            {
                return((int)nextWorkflow["MailTemplateId"]);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method TurnBack to slip iisuance UserID
        /// </summary>
        /// <param name="subsystemId"></param>
        /// <param name="workflowControlNo"></param>
        /// <param name="fromUserId"></param>
        /// <param name="toUserId"></param>
        /// <param name="currentWorkflowReserveArea"></param>
        /// <returns></returns>
        public void TurnbackSlipIssuanceUserID(string subsystemId, string workflowControlNo, decimal fromUserId, decimal?toUserId,
                                               string currentWorkflowReserveArea)
        {
            #region チェック処理を実装

            string toUserInfo = "";

            //If ToUserId is not null ans ActionType is End then getting user information
            if (toUserId.HasValue) // Endの時は不要
            {
                toUserInfo = Workflow.GetUserInfo(toUserId.Value);
            }

            #endregion

            // --------------------------------------------------
            // 現在の履歴件数を取得。
            // --------------------------------------------------
            //Gets the record count from T_WorkflowHistory table
            // --------------------------------------------------
            CmnDao dao = new CmnDao(this.Dam);

            dao.SQLFileName = "RequestApproval_Count.sql";
            dao.SetParameter("WorkflowControlNo", workflowControlNo);
            int recordCount = ((int)dao.ExecSelectScalar());

            // --------------------------------------------------
            // ワークフロー承認を依頼
            // --------------------------------------------------
            // T_CurrentWorkflowのUPDATE
            // --------------------------------------------------
            DaoT_CurrentWorkflow daoT_CurrentWorkflow = new DaoT_CurrentWorkflow(this.Dam);

            // 主キー情報
            daoT_CurrentWorkflow.PK_WorkflowControlNo = workflowControlNo;

            // 履歴番号は履歴件数+1
            daoT_CurrentWorkflow.Set_HistoryNo_forUPD = recordCount + 1;

            DaoT_WorkflowHistory daoT_WorkflowHistory = new DaoT_WorkflowHistory(this.Dam);
            //Gets the Slip issuance orignal user id
            DataTable dt = GetSlipIssuanceUserID(subsystemId, workflowControlNo);

            //Updates the T_CurrentWorkflow and T_WorkflowHistory tables data with original slip issuance user information
            daoT_CurrentWorkflow.Set_WfPositionId_forUPD = dt.Rows[0]["WfPositionId"];
            daoT_CurrentWorkflow.Set_WorkflowNo_forUPD   = dt.Rows[0]["WorkflowNo"];
            daoT_CurrentWorkflow.Set_FromUserId_forUPD   = toUserId; // 実際のユーザIDを入力する。
            daoT_CurrentWorkflow.Set_FromUserInfo_forUPD = toUserInfo;
            //Updating action type to TurnBack
            daoT_CurrentWorkflow.Set_ActionType_forUPD = "TurnBack";

            daoT_CurrentWorkflow.Set_ToUserId_forUPD = dt.Rows[0]["FromUserId"];
            // ユーザIDからユーザ情報を取得
            string fromUserInfo = Workflow.GetUserInfo(fromUserId);
            daoT_CurrentWorkflow.Set_ToUserInfo_forUPD             = fromUserInfo;
            daoT_CurrentWorkflow.Set_ToUserPositionTitlesId_forUPD = dt.Rows[0]["ToUserPositionTitlesId"];
            daoT_CurrentWorkflow.Set_NextWfPositionId_forUPD       = dt.Rows[0]["NextWfPositionId"];
            daoT_CurrentWorkflow.Set_NextWorkflowNo_forUPD         = dt.Rows[0]["NextWorkflowNo"];
            daoT_CurrentWorkflow.Set_ReserveArea_forUPD            = currentWorkflowReserveArea;

            //Updating acceptance information with null
            daoT_CurrentWorkflow.Set_ReplyDeadline_forUPD      = DBNull.Value;
            daoT_CurrentWorkflow.Set_StartDate_forUPD          = DateTime.Now;
            daoT_CurrentWorkflow.Set_AcceptanceDate_forUPD     = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserId_forUPD   = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserInfo_forUPD = DBNull.Value;
            daoT_CurrentWorkflow.D3_Update();

            // PK
            daoT_WorkflowHistory.PK_WorkflowControlNo = workflowControlNo;
            daoT_WorkflowHistory.PK_HistoryNo         = recordCount;

            // EndDate
            daoT_WorkflowHistory.Set_EndDate_forUPD = DateTime.Now;

            daoT_WorkflowHistory.S3_Update();
        }
Exemplo n.º 5
0
        /// <summary>ワークフロー承認を依頼します。</summary>
        /// <param name="nextWorkflow">選択したワークフロー承認依頼</param>
        /// <param name="workflowControlNo">ワークフロー管理番号(必須)</param>
        /// <param name="fromUserId">FromユーザID(必須)</param>
        /// <param name="toUserId">ToユーザID(TurnBack、Replyの際に必要)</param>
        /// <param name="currentWorkflowReserveArea">T_CurrentWorkflowの予備領域(任意)</param>
        /// <param name="replyDeadline">回答希望日(任意)</param>
        /// <returns>メール・テンプレートID</returns>
        public int RequestWfApproval(
            DataRow nextWorkflow, string workflowControlNo,
            decimal fromUserId, decimal?toUserId,
            string currentWorkflowReserveArea, DateTime?replyDeadline)
        {
            #region チェック処理を実装

            if (nextWorkflow == null)
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "nextWorkflow")));
            }
            else if (!nextWorkflow.Table.Columns.Contains("SubSystemId"))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_FIELD_ISNT_CONTAINED,
                                                      "SubSystemId", "nextWorkflow")));
            }
            else if (string.IsNullOrEmpty(workflowControlNo))
            {
                throw new BusinessSystemException(
                          MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[0],
                          String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR[1],
                                        String.Format(MyBusinessSystemExceptionMessage.WORKFLOW_ERROR_CHECK_EMPTY, "workflowControlNo")));
            }

            // ユーザIDからユーザ情報を取得
            string fromUserInfo = Workflow.GetUserInfo(fromUserId);

            string toUserInfo = "";

            if (toUserId.HasValue &&
                (string)nextWorkflow["ActionType"] != "End")    // Endの時は不要
            {
                toUserInfo = Workflow.GetUserInfo(toUserId.Value);
            }

            #endregion

            // --------------------------------------------------
            // 現在の履歴件数を取得。
            // --------------------------------------------------
            // T_WorkflowHistoryのCount
            // --------------------------------------------------
            CmnDao dao = new CmnDao(this.Dam);

            dao.SQLFileName = "RequestApproval_Count.sql";
            dao.SetParameter("WorkflowControlNo", workflowControlNo);
            int recordCount = ((int)dao.ExecSelectScalar());

            // --------------------------------------------------
            // ワークフロー承認を依頼
            // --------------------------------------------------
            // T_CurrentWorkflowのUPDATE
            // --------------------------------------------------
            DaoT_CurrentWorkflow daoT_CurrentWorkflow = new DaoT_CurrentWorkflow(this.Dam);

            // 主キー情報
            daoT_CurrentWorkflow.PK_WorkflowControlNo = workflowControlNo;

            // 履歴番号は履歴件数+1
            daoT_CurrentWorkflow.Set_HistoryNo_forUPD = recordCount + 1;

            daoT_CurrentWorkflow.Set_WfPositionId_forUPD = nextWorkflow["WfPositionId"];
            daoT_CurrentWorkflow.Set_WorkflowNo_forUPD   = nextWorkflow["WorkflowNo"];
            daoT_CurrentWorkflow.Set_FromUserId_forUPD   = fromUserId; // 実際のユーザIDを入力する。
            daoT_CurrentWorkflow.Set_FromUserInfo_forUPD = fromUserInfo;
            daoT_CurrentWorkflow.Set_ActionType_forUPD   = nextWorkflow["ActionType"];

            if (toUserId.HasValue &&
                ((string)nextWorkflow["ActionType"] == "TurnBack" || (string)nextWorkflow["ActionType"] == "Reply"))
            {
                // ActionTypeがTurnBack or Replyで、toUserIDがnullで無い場合、
                // 指定のtoUserIDにTurnBack or Replyする。
                daoT_CurrentWorkflow.Set_ToUserId_forUPD = toUserId;
            }
            else
            {
                // 上記以外は、nextWorkflow["ToUserId"]を指定する。
                daoT_CurrentWorkflow.Set_ToUserId_forUPD = nextWorkflow["ToUserId"];
            }

            daoT_CurrentWorkflow.Set_ToUserInfo_forUPD             = toUserInfo;
            daoT_CurrentWorkflow.Set_ToUserPositionTitlesId_forUPD = nextWorkflow["ToUserPositionTitlesId"];
            daoT_CurrentWorkflow.Set_NextWfPositionId_forUPD       = nextWorkflow["NextWfPositionId"];
            daoT_CurrentWorkflow.Set_NextWorkflowNo_forUPD         = nextWorkflow["NextWorkflowNo"];
            daoT_CurrentWorkflow.Set_ReserveArea_forUPD            = currentWorkflowReserveArea;
            //daoT_CurrentWorkflow.Set_ExclusiveKey_forUPD = "";

            if ((string)nextWorkflow["ActionType"] == "TurnBack" ||
                (string)nextWorkflow["ActionType"] == "Reply")
            {
                // ActionTypeがTurnBack or Replyの場合
                daoT_CurrentWorkflow.Set_ReplyDeadline_forUPD = DBNull.Value;
            }
            else
            {
                daoT_CurrentWorkflow.Set_ReplyDeadline_forUPD = replyDeadline;
            }

            daoT_CurrentWorkflow.Set_StartDate_forUPD          = DateTime.Now;
            daoT_CurrentWorkflow.Set_AcceptanceDate_forUPD     = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserId_forUPD   = DBNull.Value;
            daoT_CurrentWorkflow.Set_AcceptanceUserInfo_forUPD = DBNull.Value;

            daoT_CurrentWorkflow.D3_Update();

            // --------------------------------------------------
            // 完了(T_WorkflowHistoryのEndDate項目を更新)
            // --------------------------------------------------
            // T_WorkflowHistoryのUPDATE
            // --------------------------------------------------
            DaoT_WorkflowHistory daoT_WorkflowHistory = new DaoT_WorkflowHistory(this.Dam);

            // PK
            daoT_WorkflowHistory.PK_WorkflowControlNo = workflowControlNo;
            daoT_WorkflowHistory.PK_HistoryNo         = recordCount;

            // EndDate
            daoT_WorkflowHistory.Set_EndDate_forUPD = DateTime.Now;

            daoT_WorkflowHistory.S3_Update();

            //---

            // 完了
            if ((string)nextWorkflow["ActionType"] == "End")
            {
                // --------------------------------------------------
                // 完了の場合(T_WorkflowのEndDate項目を更新)
                // --------------------------------------------------
                // T_WorkflowのUPDATE
                // --------------------------------------------------
                DaoT_Workflow daoT_Workflow = new DaoT_Workflow(this.Dam);

                // PK
                daoT_Workflow.PK_WorkflowControlNo = workflowControlNo;

                // EndDate
                daoT_Workflow.Set_EndDate_forUPD = DateTime.Now;

                daoT_Workflow.S3_Update();

                // --------------------------------------------------
                // 履歴に移動
                // --------------------------------------------------
                // T_CurrentWorkflow→T_WorkflowHistory
                // --------------------------------------------------
                dao.SQLFileName = "RequestApproval_Move.sql";
                dao.SetParameter("WorkflowControlNo", workflowControlNo);
                dao.ExecInsUpDel_NonQuery();
            }

            // リターン(MailTemplateId)
            if (nextWorkflow["MailTemplateId"] == DBNull.Value)
            {
                return(0);
            }
            else
            {
                return((int)nextWorkflow["MailTemplateId"]);
            }
        }