예제 #1
0
 private Dictionary <string, AttributeValue> Map(BillingAlertItem billingAlert)
 {
     return(new Dictionary <string, AttributeValue>
     {
         { IdAttribute, new AttributeValue {
               N = billingAlert.CustomerId.ToString()
           } },
         { nameof(BillingAlertItem.AlertAmountThreshold).ToLower(), new AttributeValue {
               N = billingAlert.AlertAmountThreshold.ToString()
           } },
         { nameof(BillingAlertItem.TotalBillAmount).ToLower(), new AttributeValue {
               N = billingAlert.TotalBillAmount.ToString()
           } },
         { nameof(BillingAlertItem.BillAmountLastUpdated).ToLower(), new AttributeValue {
               S = billingAlert.BillAmountLastUpdated.ToString()
           } },
         { nameof(BillingAlertItem.IsAlerted).ToLower(), new AttributeValue {
               BOOL = billingAlert.IsAlerted
           } }
     });
 }
예제 #2
0
 private bool ShouldAlert(BillingAlertItem billingAlert) => !billingAlert.IsAlerted && billingAlert.TotalBillAmount >= billingAlert.AlertAmountThreshold;
예제 #3
0
 private string DefaultAlertMessage(BillingAlertItem billingAlert) =>
 $"Your toll amount for {DateTime.Now.Month}/{DateTime.Now.Year} is ${billingAlert.TotalBillAmount} and has exceeded the threshold value of {billingAlert.AlertAmountThreshold}";