Exemple #1
0
        /// <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"]);
                }
            }
        }
Exemple #2
0
        /// <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;
        }
Exemple #3
0
        /// <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);
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        /// <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);
        }
Exemple #6
0
        /// <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);
        }
Exemple #7
0
        /// <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);
        }
Exemple #8
0
        /// <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();
        }
Exemple #9
0
        /// <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();
        }
Exemple #10
0
        /// <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();
        }
Exemple #11
0
        /// <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();
        }
Exemple #12
0
        /// <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();
        }
Exemple #13
0
        /// <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();
        }
Exemple #14
0
        /// <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();
        }
Exemple #15
0
        /// <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();
        }
Exemple #16
0
        /// <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();
        }
Exemple #17
0
        /// <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;
        }
Exemple #18
0
        /// <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();
        }
Exemple #19
0
        /// <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;
        }
        /// <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;
        }
Exemple #21
0
        /// <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"]);
                }
            }
        }