コード例 #1
0
ファイル: LayerB.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        /// Selects Asynchronous task from LayerD
        /// </summary>
        /// <param name="asyncParameterValue">Async Parameter Value</param>
        private void UOC_SelectTask(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();

            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());

            myDao.SelectTask(asyncParameterValue, asyncReturnValue);

            DataTable dt = (DataTable)asyncReturnValue.Obj;

            asyncReturnValue.Obj = null;

            if (dt != null)
            {
                if (dt.Rows.Count != 0)
                {
                    asyncReturnValue.TaskId          = Convert.ToInt32(dt.Rows[0]["Id"]);
                    asyncReturnValue.UserId          = dt.Rows[0]["UserId"].ToString();
                    asyncReturnValue.ProcessName     = dt.Rows[0]["ProcessName"].ToString();
                    asyncReturnValue.Data            = dt.Rows[0]["Data"].ToString();
                    asyncReturnValue.NumberOfRetries = Convert.ToInt32(dt.Rows[0]["NumberOfRetries"]);
                    asyncReturnValue.ReservedArea    = dt.Rows[0]["ReservedArea"].ToString();
                    asyncReturnValue.CommandId       = Convert.ToInt32(dt.Rows[0]["CommandId"]);
                }
            }
        }
コード例 #2
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        /// Inserts async parameter values to database
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        /// <param name="asyncReturnValue"></param>
        public void Insert(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            // 静的SQL
            filename = "AsyncProcessingServiceInsert.sql";

            //   -- ファイルから読み込む場合。
            this.SetSqlByFile2(filename);

            // パラメタ ライズド クエリのパラメタに対して、動的に値を設定する。
            this.SetParameter("P2", asyncParameterValue.UserId);
            this.SetParameter("P3", asyncParameterValue.ProcessName);
            this.SetParameter("P4", asyncParameterValue.Data);
            this.SetParameter("P5", asyncParameterValue.RegistrationDateTime);
            this.SetParameter("P6", asyncParameterValue.ExecutionStartDateTime);
            this.SetParameter("P7", asyncParameterValue.NumberOfRetries);
            this.SetParameter("P8", asyncParameterValue.CompletionDateTime);
            this.SetParameter("P9", asyncParameterValue.StatusId);
            this.SetParameter("P10", asyncParameterValue.ProgressRate);
            this.SetParameter("P11", asyncParameterValue.CommandId);
            this.SetParameter("P12", asyncParameterValue.ReservedArea);

            object obj;

            //   -- 追加(件数を確認できる)
            obj = this.ExecInsUpDel_NonQuery();

            // ↑DBアクセス-----------------------------------------------------

            // 戻り値を設定
            asyncReturnValue.Obj = obj;
        }
コード例 #3
0
ファイル: LayerB.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        /// Updates Async Parameter values to Database through LayerD 
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        private void UOC_Update(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();
            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());
            myDao.Update(asyncParameterValue, asyncReturnValue);
        }
コード例 #4
0
ファイル: LayerB.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        /// Inserts Async Parameter values to Database through LayerD 
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        public void UOC_Start(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();
            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());
            myDao.Insert(asyncParameterValue, asyncReturnValue);
        }
コード例 #5
0
ファイル: LayerB.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        /// Selects user command from Database through LayerD
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        private void UOC_SelectCommand(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();

            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());

            myDao.SelectCommand(asyncParameterValue, asyncReturnValue);
        }
コード例 #6
0
ファイル: LayerB.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  Updates information in the database that the asynchronous task is started
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        private void UOC_UpdateTaskStart(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();

            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());

            myDao.UpdateTaskStart(asyncParameterValue, asyncReturnValue);
        }
コード例 #7
0
ファイル: LayerB.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        /// Inserts Async Parameter values to Database through LayerD
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        public void UOC_InsertTask(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            // 戻り値クラスを生成して、事前に戻り地に設定しておく。
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();

            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());

            myDao.InsertTask(asyncParameterValue, asyncReturnValue);
        }
コード例 #8
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        ///  Selects user command from database
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void SelectCommand(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "SelectCommand.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecSelectScalar();
        }
コード例 #9
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        ///  Updates progress rate of the asynchronous task in the database.
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void UpdateTaskProgress(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "UpdateTaskProgress.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);
            this.SetParameter("P2", asyncParameterValue.ProgressRate);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #10
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        ///  Set stop command for all running asynchronous task.
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void StopAllTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "StopAllTask.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.StatusId);
            this.SetParameter("P2", asyncParameterValue.CommandId);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #11
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        /// Inserts async parameter values to database
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        /// <param name="asyncReturnValue"></param>
        public void InsertTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "AsyncProcessingServiceInsert.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P2", asyncParameterValue.UserId);
            this.SetParameter("P3", asyncParameterValue.ProcessName);
            this.SetParameter("P4", asyncParameterValue.Data);
            this.SetParameter("P5", asyncParameterValue.RegistrationDateTime);
            this.SetParameter("P6", DBNull.Value);
            this.SetParameter("P7", asyncParameterValue.NumberOfRetries);
            this.SetParameter("P8", DBNull.Value);
            this.SetParameter("P9", asyncParameterValue.StatusId);
            this.SetParameter("P10", asyncParameterValue.ProgressRate);
            this.SetParameter("P11", asyncParameterValue.CommandId);
            this.SetParameter("P12", asyncParameterValue.ReservedArea);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #12
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        ///  Updates information in the database that the asynchronous task is failed and abort this task [status=Abort]
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void UpdateTaskFail(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "UpdateTaskFail.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);
            this.SetParameter("P2", asyncParameterValue.CompletionDateTime);
            this.SetParameter("P3", asyncParameterValue.StatusId);
            this.SetParameter("P4", asyncParameterValue.ExceptionInfo);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #13
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  Updates progress rate of the asynchronous task in the database.
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void UpdateTaskProgress(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "UpdateTaskProgress.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);
            this.SetParameter("P2", asyncParameterValue.ProgressRate);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #14
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  Updates information in the database that the asynchronous task is failed and abort this task [status=Abort]
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void UpdateTaskFail(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "UpdateTaskFail.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);
            this.SetParameter("P2", asyncParameterValue.CompletionDateTime);
            this.SetParameter("P3", asyncParameterValue.StatusId);
            this.SetParameter("P4", asyncParameterValue.ExceptionInfo);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #15
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  Set stop command for all running asynchronous task.
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void StopAllTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "StopAllTask.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.StatusId);
            this.SetParameter("P2", asyncParameterValue.CommandId);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #16
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        /// Inserts async parameter values to database
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        /// <param name="asyncReturnValue"></param>
        public void InsertTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "AsyncProcessingServiceInsert.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P2", asyncParameterValue.UserId);
            this.SetParameter("P3", asyncParameterValue.ProcessName);
            this.SetParameter("P4", asyncParameterValue.Data);
            this.SetParameter("P5", asyncParameterValue.RegistrationDateTime);
            this.SetParameter("P6", DBNull.Value);
            this.SetParameter("P7", asyncParameterValue.NumberOfRetries);
            this.SetParameter("P8", DBNull.Value);
            this.SetParameter("P9", asyncParameterValue.StatusId);
            this.SetParameter("P10", asyncParameterValue.ProgressRate);
            this.SetParameter("P11", asyncParameterValue.CommandId);
            this.SetParameter("P12", asyncParameterValue.ReservedArea);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
コード例 #17
0
ファイル: LayerD.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        ///  To get Asynchronous Task from the database
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        /// <param name="asyncReturnValue"></param>
        public void SelectTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;
            filename = "SelectTask.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.RegistrationDateTime);
            this.SetParameter("P2", asyncParameterValue.NumberOfRetries);
            this.SetParameter("P3", (int)AsyncProcessingServiceParameterValue.AsyncStatus.Register);
            this.SetParameter("P4", (int)AsyncProcessingServiceParameterValue.AsyncStatus.AbnormalEnd);
            this.SetParameter("P7", asyncParameterValue.CompletionDateTime);

            DataTable dt = new DataTable();

            // Get Asynchronous Task from the database
            this.ExecSelectFill_DT(dt);
            asyncReturnValue.Obj = dt;
        }
コード例 #18
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  Selects user command from database
        /// </summary>
        /// <param name="asyncParameterValue">Asynchronous Parameter Values</param>
        /// <param name="asyncReturnValue">Asynchronous Return Values</param>
        public void SelectCommand(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "SelectCommand.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.TaskId);

            // Execute SQL query
            asyncReturnValue.Obj = this.ExecSelectScalar();
        }
コード例 #19
0
ファイル: LayerD.cs プロジェクト: SantoshAvaji/OpenTouryo
        /// <summary>
        ///  To get Asynchronous Task from the database
        /// </summary>
        /// <param name="asyncParameterValue"></param>
        /// <param name="asyncReturnValue"></param>
        public void SelectTask(AsyncProcessingServiceParameterValue asyncParameterValue, AsyncProcessingServiceReturnValue asyncReturnValue)
        {
            string filename = string.Empty;

            filename = "SelectTask.sql";

            // Get SQL query from file.
            this.SetSqlByFile3(filename);

            // Set SQL parameter values
            this.SetParameter("P1", asyncParameterValue.RegistrationDateTime);
            this.SetParameter("P2", asyncParameterValue.NumberOfRetries);
            this.SetParameter("P3", (int)AsyncProcessingServiceParameterValue.AsyncStatus.Register);
            this.SetParameter("P4", (int)AsyncProcessingServiceParameterValue.AsyncStatus.AbnormalEnd);
            this.SetParameter("P7", asyncParameterValue.CompletionDateTime);

            DataTable dt = new DataTable();

            // Get Asynchronous Task from the database
            this.ExecSelectFill_DT(dt);
            asyncReturnValue.Obj = dt;
        }
コード例 #20
0
        /// <summary>
        ///  Updates the selected asynchronous task based type of SQL_Update_Method_name
        /// </summary>
        /// <param name="selectedAsyncTask">Selected Asynchronous Task</param>
        /// <param name="updateTask">SQL_Update_Method_name</param>
        /// <returns></returns>
        public AsyncProcessingServiceReturnValue UpdateAsyncTask(AsyncProcessingServiceReturnValue selectedAsyncTask, string updateTask, string exceptionInfo = null)
        {
            AsyncProcessingServiceParameterValue asyncParameterValue = new AsyncProcessingServiceParameterValue("AsyncProcessingService", updateTask, updateTask, "SQL",
                                                                                        new MyUserInfo("AsyncProcessingService", "AsyncProcessingService"));
            asyncParameterValue.TaskId = selectedAsyncTask.TaskId;

            // Update databse based on task
            switch (updateTask)
            {
                case AsyncTaskUpdate.START:
                    asyncParameterValue.ExecutionStartDateTime = DateTime.Now;
                    asyncParameterValue.StatusId = (int)AsyncProcessingServiceParameterValue.AsyncStatus.Processing;
                    break;
                case AsyncTaskUpdate.RETRY:
                    if (exceptionInfo.Length > 512)
                    {
                        exceptionInfo = exceptionInfo.Substring(0, 512);
                    }
                    asyncParameterValue.NumberOfRetries = selectedAsyncTask.NumberOfRetries;
                    asyncParameterValue.CompletionDateTime = DateTime.Now;
                    asyncParameterValue.StatusId = (int)AsyncProcessingServiceParameterValue.AsyncStatus.AbnormalEnd;
                    asyncParameterValue.ExceptionInfo = exceptionInfo;
                    break;
                case AsyncTaskUpdate.FAIL:
                    if (exceptionInfo.Length > 512)
                    {
                        exceptionInfo = exceptionInfo.Substring(0, 512);
                    }
                    asyncParameterValue.CompletionDateTime = DateTime.Now;
                    asyncParameterValue.StatusId = (int)AsyncProcessingServiceParameterValue.AsyncStatus.Abort;
                    asyncParameterValue.ExceptionInfo = exceptionInfo;
                    break;
                case AsyncTaskUpdate.SUCCESS:
                    asyncParameterValue.CompletionDateTime = DateTime.Now;
                    asyncParameterValue.ProgressRate = 100;
                    asyncParameterValue.StatusId = (int)AsyncProcessingServiceParameterValue.AsyncStatus.End;
                    break;
            }
            LayerB layerB = new LayerB();
            AsyncProcessingServiceReturnValue asyncReturnValue = (AsyncProcessingServiceReturnValue)layerB.DoBusinessLogic(
                                                                      (BaseParameterValue)asyncParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted);
            return asyncReturnValue;
        }
コード例 #21
0
ファイル: LayerB.cs プロジェクト: daisukenishino/OpenTouryo
        /// <summary>
        /// Selects Asynchronous task from LayerD 
        /// </summary>
        /// <param name="asyncParameterValue">Async Parameter Value</param>
        private void UOC_SelectTask(AsyncProcessingServiceParameterValue asyncParameterValue)
        {
            AsyncProcessingServiceReturnValue asyncReturnValue = new AsyncProcessingServiceReturnValue();
            this.ReturnValue = asyncReturnValue;

            LayerD myDao = new LayerD(this.GetDam());
            myDao.SelectTask(asyncParameterValue, asyncReturnValue);

            DataTable dt = (DataTable)asyncReturnValue.Obj;
            asyncReturnValue.Obj = null;

            if (dt != null)
            {
                if (dt.Rows.Count != 0)
                {
                    asyncReturnValue.TaskId = Convert.ToInt32(dt.Rows[0]["Id"]);
                    asyncReturnValue.UserId = dt.Rows[0]["UserId"].ToString();
                    asyncReturnValue.ProcessName = dt.Rows[0]["ProcessName"].ToString();
                    asyncReturnValue.Data = dt.Rows[0]["Data"].ToString();
                    asyncReturnValue.NumberOfRetries = Convert.ToInt32(dt.Rows[0]["NumberOfRetries"]);
                    asyncReturnValue.ReservedArea = dt.Rows[0]["ReservedArea"].ToString();
                    asyncReturnValue.CommandId = Convert.ToInt32(dt.Rows[0]["CommandId"]);
                }
            }
        }