|
| 1 | +//********************************************************************************** |
| 2 | +//* Copyright (C) 2007,2016 Hitachi Solutions,Ltd. |
| 3 | +//********************************************************************************** |
| 4 | + |
| 5 | +#region Apache License |
| 6 | +// |
| 7 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +// you may not use this file except in compliance with the License. |
| 9 | +// You may obtain a copy of the License at |
| 10 | +// |
| 11 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +// |
| 13 | +// Unless required by applicable law or agreed to in writing, software |
| 14 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +// See the License for the specific language governing permissions and |
| 17 | +// limitations under the License. |
| 18 | +// |
| 19 | +#endregion |
| 20 | + |
| 21 | +//********************************************************************************** |
| 22 | +//* クラス名 :LayerB |
| 23 | +//* クラス日本語名 :LayerB |
| 24 | +//* |
| 25 | +//* 日時 更新者 内容 |
| 26 | +//* ---------- ---------------- ------------------------------------------------- |
| 27 | +//* 11/28/2014 Supragyan Created LayerB class for AsyncProcessing Service |
| 28 | +//* 11/28/2014 Supragyan Created Insert,Update,Select method for AsyncProcessing Service |
| 29 | +//* 04/15/2015 Sandeep Did code modification of insert, update and select for AsyncProcessing Service |
| 30 | +//* 06/09/2015 Sandeep Implemented code to update stop command to all the running asynchronous task |
| 31 | +//* Modified code to reset Exception information, before starting asynchronous task |
| 32 | +//* 06/26/2015 Sandeep Implemented code to get commandID in the SelectTask method, |
| 33 | +//* to resolve unstable "Register" state, when you invoke [Abort] to AsyncTask, at this "Register" state |
| 34 | +//* 06/01/2016 Sandeep Implemented method to test the connection of specified database |
| 35 | +//* 2018/08/24 西野 大介 クラス名称の変更( ---> Aps) |
| 36 | +//********************************************************************************** |
| 37 | + |
| 38 | +using System; |
| 39 | +using System.Data; |
| 40 | + |
| 41 | +using Touryo.Infrastructure.Business.Business; |
| 42 | + |
| 43 | +namespace Touryo.Infrastructure.Business.AsyncProcessingService |
| 44 | +{ |
| 45 | + /// <summary> |
| 46 | + /// LayerB class for AsyncProcessing Service |
| 47 | + /// </summary> |
| 48 | + public class ApsLayerB : MyFcBaseLogic |
| 49 | + { |
| 50 | + #region Insert |
| 51 | + |
| 52 | + /// <summary> |
| 53 | + /// Inserts Async Parameter values to Database through LayerD |
| 54 | + /// </summary> |
| 55 | + /// <param name="parameterValue"></param> |
| 56 | + public void UOC_InsertTask(ApsParameterValue parameterValue) |
| 57 | + { |
| 58 | + // 戻り値クラスを生成して、事前に戻り値に設定しておく。 |
| 59 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 60 | + this.ReturnValue = returnValue; |
| 61 | + |
| 62 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 63 | + layerD.InsertTask(parameterValue, returnValue); |
| 64 | + } |
| 65 | + |
| 66 | + #endregion |
| 67 | + |
| 68 | + #region Update |
| 69 | + |
| 70 | + #region UpdateTaskStart |
| 71 | + |
| 72 | + /// <summary> |
| 73 | + /// Updates information in the database that the asynchronous task is started |
| 74 | + /// </summary> |
| 75 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 76 | + private void UOC_UpdateTaskStart(ApsParameterValue parameterValue) |
| 77 | + { |
| 78 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 79 | + this.ReturnValue = returnValue; |
| 80 | + |
| 81 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 82 | + layerD.UpdateTaskStart(parameterValue, returnValue); |
| 83 | + } |
| 84 | + |
| 85 | + #endregion |
| 86 | + |
| 87 | + #region UpdateTaskRetry |
| 88 | + |
| 89 | + /// <summary> |
| 90 | + /// Updates information in the database that the asynchronous task is failed and can be retried later |
| 91 | + /// </summary> |
| 92 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 93 | + private void UOC_UpdateTaskRetry(ApsParameterValue parameterValue) |
| 94 | + { |
| 95 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 96 | + this.ReturnValue = returnValue; |
| 97 | + |
| 98 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 99 | + layerD.UpdateTaskRetry(parameterValue, returnValue); |
| 100 | + } |
| 101 | + |
| 102 | + #endregion |
| 103 | + |
| 104 | + #region UpdateTaskFail |
| 105 | + |
| 106 | + /// <summary> |
| 107 | + /// Updates information in the database that the asynchronous task is failed and abort this task [status=Abort] |
| 108 | + /// </summary> |
| 109 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 110 | + private void UOC_UpdateTaskFail(ApsParameterValue parameterValue) |
| 111 | + { |
| 112 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 113 | + this.ReturnValue = returnValue; |
| 114 | + |
| 115 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 116 | + layerD.UpdateTaskFail(parameterValue, returnValue); |
| 117 | + } |
| 118 | + |
| 119 | + #endregion |
| 120 | + |
| 121 | + #region UpdateTaskSuccess |
| 122 | + |
| 123 | + /// <summary> |
| 124 | + /// Updates information in the database that the asynchronous task is completed |
| 125 | + /// </summary> |
| 126 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 127 | + private void UOC_UpdateTaskSuccess(ApsParameterValue parameterValue) |
| 128 | + { |
| 129 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 130 | + this.ReturnValue = returnValue; |
| 131 | + |
| 132 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 133 | + layerD.UpdateTaskSuccess(parameterValue, returnValue); |
| 134 | + } |
| 135 | + |
| 136 | + #endregion |
| 137 | + |
| 138 | + #region UpdateTaskProgress |
| 139 | + |
| 140 | + /// <summary> |
| 141 | + /// Updates progress rate of the asynchronous task in the database. |
| 142 | + /// </summary> |
| 143 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 144 | + private void UOC_UpdateTaskProgress(ApsParameterValue parameterValue) |
| 145 | + { |
| 146 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 147 | + this.ReturnValue = returnValue; |
| 148 | + |
| 149 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 150 | + layerD.UpdateTaskProgress(parameterValue, returnValue); |
| 151 | + } |
| 152 | + |
| 153 | + #endregion |
| 154 | + |
| 155 | + #region UpdateTaskCommand |
| 156 | + |
| 157 | + /// <summary> |
| 158 | + /// Updates command value information of a selected asynchronous task |
| 159 | + /// </summary> |
| 160 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 161 | + private void UOC_UpdateTaskCommand(ApsParameterValue parameterValue) |
| 162 | + { |
| 163 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 164 | + this.ReturnValue = returnValue; |
| 165 | + |
| 166 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 167 | + layerD.UpdateTaskCommand(parameterValue, returnValue); |
| 168 | + } |
| 169 | + |
| 170 | + #endregion |
| 171 | + |
| 172 | + #region StopAllTask |
| 173 | + |
| 174 | + /// <summary> |
| 175 | + /// Set stop command for all running asynchronous task |
| 176 | + /// </summary> |
| 177 | + /// <param name="parameterValue">Asynchronous Parameter Values</param> |
| 178 | + private void UOC_StopAllTask(ApsParameterValue parameterValue) |
| 179 | + { |
| 180 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 181 | + this.ReturnValue = returnValue; |
| 182 | + |
| 183 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 184 | + layerD.StopAllTask(parameterValue, returnValue); |
| 185 | + } |
| 186 | + |
| 187 | + #endregion |
| 188 | + |
| 189 | + #endregion |
| 190 | + |
| 191 | + #region Select |
| 192 | + |
| 193 | + #region SelectCommand |
| 194 | + |
| 195 | + /// <summary> |
| 196 | + /// Selects user command from Database through LayerD |
| 197 | + /// </summary> |
| 198 | + /// <param name="parameterValue"></param> |
| 199 | + private void UOC_SelectCommand(ApsParameterValue parameterValue) |
| 200 | + { |
| 201 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 202 | + this.ReturnValue = returnValue; |
| 203 | + |
| 204 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 205 | + layerD.SelectCommand(parameterValue, returnValue); |
| 206 | + } |
| 207 | + |
| 208 | + #endregion |
| 209 | + |
| 210 | + #region SelectTask |
| 211 | + |
| 212 | + /// <summary> |
| 213 | + /// Selects Asynchronous task from LayerD |
| 214 | + /// </summary> |
| 215 | + /// <param name="parameterValue">Async Parameter Value</param> |
| 216 | + private void UOC_SelectTask(ApsParameterValue parameterValue) |
| 217 | + { |
| 218 | + ApsReturnValue returnValue = new ApsReturnValue(); |
| 219 | + this.ReturnValue = returnValue; |
| 220 | + |
| 221 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 222 | + layerD.SelectTask(parameterValue, returnValue); |
| 223 | + |
| 224 | + DataTable dt = (DataTable)returnValue.Obj; |
| 225 | + returnValue.Obj = null; |
| 226 | + |
| 227 | + if (dt != null) |
| 228 | + { |
| 229 | + if (dt.Rows.Count != 0) |
| 230 | + { |
| 231 | + returnValue.TaskId = Convert.ToInt32(dt.Rows[0]["Id"]); |
| 232 | + returnValue.UserId = dt.Rows[0]["UserId"].ToString(); |
| 233 | + returnValue.ProcessName = dt.Rows[0]["ProcessName"].ToString(); |
| 234 | + returnValue.Data = dt.Rows[0]["Data"].ToString(); |
| 235 | + returnValue.NumberOfRetries = Convert.ToInt32(dt.Rows[0]["NumberOfRetries"]); |
| 236 | + returnValue.ReservedArea = dt.Rows[0]["ReservedArea"].ToString(); |
| 237 | + returnValue.CommandId = Convert.ToInt32(dt.Rows[0]["CommandId"]); |
| 238 | + } |
| 239 | + } |
| 240 | + } |
| 241 | + |
| 242 | + #endregion |
| 243 | + |
| 244 | + #endregion |
| 245 | + |
| 246 | + #region TestConnection |
| 247 | + |
| 248 | + /// <summary> |
| 249 | + /// Tests the connection with the specified database |
| 250 | + /// </summary> |
| 251 | + /// <param name="parameterValue">Async Parameter Value</param> |
| 252 | + private void UOC_TestConnection(ApsParameterValue parameterValue) |
| 253 | + { |
| 254 | + ApsLayerD layerD = new ApsLayerD(this.GetDam()); |
| 255 | + } |
| 256 | + |
| 257 | + #endregion |
| 258 | + } |
| 259 | +} |
0 commit comments