コード例 #1
0
        public SpendSummary GetTotalSpend(int supplierId)
        {
            ISupplierInvoice supplierInvoiceFactory = new SupplierInvoiceFactory();

            ISpendService spendService = supplierInvoiceFactory.GetSupplierInvoice(supplierId);

            return(spendService.GetTotalSpend());
            //return null;
        }
コード例 #2
0
ファイル: SpendService.cs プロジェクト: azsatti/CodeT
 public SpendSummary GetTotalSpend(int supplierId)
 {
     _logger.LogInformation($"Calling Total spend for {supplierId}");
     try
     {
         var supplier = _supplierService.GetById(supplierId);
         _spendService = supplier.IsExternal ? (ISpendService) new ExternalServiceWrapper(_failoverInvoiceService) : new InvoiceRepository();
         return(_spendService.GetTotalSpend(supplierId));
     }
     catch (CustomException)
     {
         _logger.LogError($"GetTotalSpend is failed to acquire data for external supplier {supplierId} from both locations.");
         return(null); // sending out null intentionally.
     }
     catch (Exception ex)
     {
         _logger.LogError($"Error occured. Error message is {ex.Message}");
         throw;
     }
 }
コード例 #3
0
 public SpendSummary Get(int id)
 {
     return(spendService.GetTotalSpend(id));
 }