Example #1
0
 public async Task <BillingInvoiceResult> GetAsync(string SessionKey,
                                                   BillingInvoiceSearch searchOption,
                                                   string connectionId)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var notifier = hubContext.CreateNotifier(connectionId);
         var result = await billingInvoiceProcessor.GetAsync(searchOption, token);
         notifier?.UpdateState();
         return new BillingInvoiceResult
         {
             ProcessResult = new ProcessResult {
                 Result = true
             },
             BillingInvoices = result.ToList(),
         };
     }, logger, connectionId));
 }
Example #2
0
 public async Task<CollationsResult> CollateAsync(string SessionKey, CollationSearch CollationSearch, string connectionId)
     => await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var notifier = hubContext.CreateNotifier(connectionId);
         try
         {
             var result = (await collationProcessor.CollateAsync(CollationSearch, token, notifier)).ToList();
             return new CollationsResult
             {
                 ProcessResult = new ProcessResult { Result = true },
                 Collation = result,
             };
         }
         catch (Exception) // cancellation
         {
             notifier?.Abort();
             throw;
         }
     }, logger, connectionId);
Example #3
0
 public async Task <CollectionSchedulesResult> GetAsync(string SessionKey, CollectionScheduleSearch SearchOption, string connectionId)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var notifier = hubContext.CreateNotifier(connectionId);
         var result = await collectionScheduleProcessor.GetAsync(SearchOption, token, notifier);
         return new CollectionSchedulesResult
         {
             ProcessResult = new ProcessResult {
                 Result = true,
             },
             CollectionSchedules = new List <CollectionSchedule>(result),
         };
     }, logger, connectionId));
 }
 public async Task <MatchingHistorysResult> GetAsync(string SessionKey, MatchingHistorySearch MatchingHistorySearch, string connectionId)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var notifier = hubContext.CreateNotifier(connectionId);
         var result = (await matchingHistorySearchProcessor.GetAsync(MatchingHistorySearch, token, notifier)).ToList();
         return new MatchingHistorysResult
         {
             ProcessResult = new ProcessResult {
                 Result = true
             },
             MatchingHistorys = result,
         };
     }, logger, connectionId));
 }
Example #5
0
 public async Task <BillingAgingListsResult> GetAsync(string SessionKey, BillingAgingListSearch searchOption, string connectionId)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var notifier = hubContext.CreateNotifier(connectionId);
         var result = await billingAgingListProcessor.GetAsync(searchOption, notifier, token);
         return new BillingAgingListsResult
         {
             ProcessResult = new ProcessResult {
                 Result = true
             },
             BillingAgingLists = new List <BillingAgingList>(result),
         };
     }, logger, connectionId));
 }
Example #6
0
 /// <summary>
 /// キャンセル処理を内包する wrapper method
 /// TODO:適切なメソッド名
 /// cancellation token のテストを実施する
 /// </summary>
 /// <typeparam name="TResult"></typeparam>
 /// <param name="context"></param>
 /// <param name="connectionId"></param>
 /// <param name="handler"></param>
 /// <returns></returns>
 public static async Task <TResult> DoAsync <TResult>(
     this IHubContext context,
     string connectionId,
     Func <IProgressNotifier, CancellationToken, Task <TResult> > handler)
 {
     try
     {
         var source = CreateCancellationTokenSource();
         Hubs.ProgressHub.AddCancellationTokenSource(connectionId, source);
         var notifier = context.CreateNotifier(connectionId);
         return(await handler(notifier, source.Token));
     }
     //catch (Exception) // logging は middleware で行うので、 catch 句自体不要
     //{
     //    throw;
     //}
     finally
     {
         Hubs.ProgressHub.RemoveCancellationTokenSource(connectionId);
     }
 }