コード例 #1
0
 /// <summary>
 /// GetTotal should return the sum of (Cost * Quantity) for each line item
 /// </summary>
 public decimal GetTotal()
 {
     if (LineItems != null && LineItems.Any())
     {
         new LogManager().Log($"Get invoice total ({InvoiceNumber}): {LineItems.Select(l => l.Cost).Sum()})");
         return(LineItems.Select(l => l.Cost).Sum());
     }
     else
     {
         new LogManager().Log($"No Items for invoice ({InvoiceNumber}))");
         return(0);
     }
 }
コード例 #2
0
 public DTO.Transaction toDto()
 {
     Enum.TryParse(TransactionType, out TransactionTypeEnum tte);
     return(new DTO.Transaction
     {
         TransactionId = TransactionId,
         TransactionType = tte,
         Status = Status,
         DeliverBefore = DeliverBefore?.ToLocalTime(),
         DeliverAfter = DeliverAfter?.ToLocalTime(),
         Priority = (PriorityEnum)Priority,
         SiteName = SiteName,
         SiteLatitude = SiteLatitude,
         SiteLongitude = SiteLongitude,
         LineItems = LineItems.Select(li => li.toDto()).ToList(),
         AssociatedClient = AssociatedClient?.toDto()
     });
 }