Beispiel #1
0
        /// <summary>
        /// Selects Asynchronous task from LayerD
        /// </summary>
        /// <param name="parameterValue">Async Parameter Value</param>
        private void UOC_SelectTask(ApsParameterValue parameterValue)
        {
            ApsReturnValue returnValue = new ApsReturnValue();

            this.ReturnValue = returnValue;

            ApsLayerD layerD = new ApsLayerD(this.GetDam());

            layerD.SelectTask(parameterValue, returnValue);

            DataTable dt = (DataTable)returnValue.Obj;

            returnValue.Obj = null;

            if (dt != null)
            {
                if (dt.Rows.Count != 0)
                {
                    returnValue.TaskId          = Convert.ToInt32(dt.Rows[0]["Id"]);
                    returnValue.UserId          = dt.Rows[0]["UserId"].ToString();
                    returnValue.ProcessName     = dt.Rows[0]["ProcessName"].ToString();
                    returnValue.Data            = dt.Rows[0]["Data"].ToString();
                    returnValue.NumberOfRetries = Convert.ToInt32(dt.Rows[0]["NumberOfRetries"]);
                    returnValue.ReservedArea    = dt.Rows[0]["ReservedArea"].ToString();
                    returnValue.CommandId       = Convert.ToInt32(dt.Rows[0]["CommandId"]);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Inserts async parameter values to database
        /// </summary>
        /// <param name="parameterValue"></param>
        /// <param name="returnValue"></param>
        public void InsertTask(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "AsyncProcessingServiceInsert.sql";

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

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

            // Execute SQL query
            returnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
Beispiel #3
0
        /// <summary>
        ///  Updates information in the database that the asynchronous task is failed and can be retried later
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        private void UOC_UpdateTaskRetry(ApsParameterValue parameterValue)
        {
            ApsReturnValue returnValue = new ApsReturnValue();

            this.ReturnValue = returnValue;

            ApsLayerD layerD = new ApsLayerD(this.GetDam());

            layerD.UpdateTaskRetry(parameterValue, returnValue);
        }
Beispiel #4
0
        /// <summary>
        /// Selects user command from Database through LayerD
        /// </summary>
        /// <param name="parameterValue"></param>
        private void UOC_SelectCommand(ApsParameterValue parameterValue)
        {
            ApsReturnValue returnValue = new ApsReturnValue();

            this.ReturnValue = returnValue;

            ApsLayerD layerD = new ApsLayerD(this.GetDam());

            layerD.SelectCommand(parameterValue, returnValue);
        }
Beispiel #5
0
        /// <summary>
        ///  Set stop command for all running asynchronous task
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        private void UOC_StopAllTask(ApsParameterValue parameterValue)
        {
            ApsReturnValue returnValue = new ApsReturnValue();

            this.ReturnValue = returnValue;

            ApsLayerD layerD = new ApsLayerD(this.GetDam());

            layerD.StopAllTask(parameterValue, returnValue);
        }
Beispiel #6
0
        /// <summary>
        /// Inserts Async Parameter values to Database through LayerD
        /// </summary>
        /// <param name="parameterValue"></param>
        public void UOC_InsertTask(ApsParameterValue parameterValue)
        {
            // 戻り値クラスを生成して、事前に戻り値に設定しておく。
            ApsReturnValue returnValue = new ApsReturnValue();

            this.ReturnValue = returnValue;

            ApsLayerD layerD = new ApsLayerD(this.GetDam());

            layerD.InsertTask(parameterValue, returnValue);
        }
        /// <summary>
        ///  Updates the command of selected task
        /// </summary>
        /// <param name="taskID">Task ID</param>
        /// <param name="commandId">Command ID</param>
        /// <param name="returnValue">user parameter value</param>
        /// <param name="dam">BaseDam</param>
        public static void UpdateTaskCommand(int taskID, int commandId, ApsReturnValue returnValue, BaseDam dam)
        {
            // Sets parameters of AsyncProcessingServiceParameterValue to update the command of selected task.
            ApsParameterValue parameterValue = new ApsParameterValue(
                "AsyncProcessingService", "UpdateTaskCommand", "UpdateTaskCommand", "SQL",
                new MyUserInfo("AsyncProcessingService", "AsyncProcessingService"));

            parameterValue.TaskId    = taskID;
            parameterValue.CommandId = commandId;

            // Calls data access part of asynchronous processing service.
            ApsLayerD layerD = new ApsLayerD(dam);

            layerD.UpdateTaskCommand(parameterValue, returnValue);
        }
Beispiel #8
0
        /// <summary>
        ///  Selects user command from database
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        /// <param name="returnValue">Asynchronous Return Values</param>
        public void SelectCommand(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "SelectCommand.sql";

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

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

            // Execute SQL query
            returnValue.Obj = this.ExecSelectScalar();
        }
        /// <summary>
        ///  Updates the progress rate in the database.
        /// </summary>
        /// <param name="taskID">asynchronous task id</param>
        /// <param name="returnValue">ApsReturnValue</param>
        /// <param name="progressRate">progress rate</param>
        /// <param name="dam">BaseDam</param>
        public static void UpdateProgressRate(int taskID, ApsReturnValue returnValue, decimal progressRate, BaseDam dam)
        {
            // Sets parameters of AsyncProcessingServiceParameterValue to Update progress rate
            ApsParameterValue parameterValue = new ApsParameterValue(
                "AsyncProcessingService", "UpdateTaskProgress", "UpdateTaskProgress", "SQL",
                new MyUserInfo("AsyncProcessingService", "AsyncProcessingService"));

            parameterValue.TaskId       = taskID;
            parameterValue.ProgressRate = progressRate;

            // Calls data access part of asynchronous processing service.
            ApsLayerD layerD = new ApsLayerD(dam);

            layerD.UpdateTaskProgress(parameterValue, returnValue);
        }
        /// <summary>Get command information from database. </summary>
        /// <param name="taskID">asynchronous task id</param>
        /// <param name="returnValue">asynchronous return value</param>
        /// <param name="dam">BaseDam</param>
        public static void GetCommandValue(int taskID, ApsReturnValue returnValue, BaseDam dam)
        {
            // Sets parameters of AsyncProcessingServiceParameterValue to get command value.
            ApsParameterValue parameterValue = new ApsParameterValue(
                "AsyncProcessingService", "SelectCommand", "SelectCommand", "SQL",
                new MyUserInfo("AsyncProcessingService", "AsyncProcessingService"));

            parameterValue.TaskId = taskID;

            // Calls data access part of asynchronous processing service.
            ApsLayerD layerD = new ApsLayerD(dam);

            layerD.SelectCommand(parameterValue, returnValue);
            returnValue.CommandId = (int)returnValue.Obj;
        }
Beispiel #11
0
        /// <summary>
        ///  Set stop command for all running asynchronous task.
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        /// <param name="returnValue">Asynchronous Return Values</param>
        public void StopAllTask(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "StopAllTask.sql";

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

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

            // Execute SQL query
            returnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
Beispiel #12
0
        /// <summary>
        ///  Updates progress rate of the asynchronous task in the database.
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        /// <param name="returnValue">Asynchronous Return Values</param>
        public void UpdateTaskProgress(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "UpdateTaskProgress.sql";

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

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

            // Execute SQL query
            returnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
Beispiel #13
0
        /// <summary>
        ///  Updates information in the database that the asynchronous task is failed and abort this task [status=Abort]
        /// </summary>
        /// <param name="parameterValue">Asynchronous Parameter Values</param>
        /// <param name="returnValue">Asynchronous Return Values</param>
        public void UpdateTaskFail(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "UpdateTaskFail.sql";

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

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

            // Execute SQL query
            returnValue.Obj = this.ExecInsUpDel_NonQuery();
        }
Beispiel #14
0
        /// <summary>
        ///  To get Asynchronous Task from the database
        /// </summary>
        /// <param name="parameterValue"></param>
        /// <param name="returnValue"></param>
        public void SelectTask(ApsParameterValue parameterValue, ApsReturnValue returnValue)
        {
            string filename = string.Empty;

            filename = "SelectTask.sql";

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

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

            DataTable dt = new DataTable();

            // Get Asynchronous Task from the database
            this.ExecSelectFill_DT(dt);
            returnValue.Obj = dt;
        }
Beispiel #15
0
 /// <summary>
 /// Tests the connection with the specified database
 /// </summary>
 /// <param name="parameterValue">Async Parameter Value</param>
 private void UOC_TestConnection(ApsParameterValue parameterValue)
 {
     ApsLayerD layerD = new ApsLayerD(this.GetDam());
 }