상속: INotificationRepository, IDisposable
예제 #1
0
 public static void SendBillNotifications()
 {
     using (INotificationRepository rep = new NotificationRepository())
     {
         var notifications = rep.GetNotificationsToSend();
         foreach (var n in notifications)
         {
             GetBillAndSendNotification(n);
         }
     }
 }
예제 #2
0
 public static void UpdateBillNotifications()
 {
     using (INotificationRepository rep = new NotificationRepository())
     {
         var notifications = rep.GetNotificationsToUpdate();
         //var notifications = rep.List();
         foreach (var n in notifications)
         {
             if (n.LastVerification > DateTime.UtcNow.AddDays(-30))
             {
                 string balanceString = BillProvider.GetBillAmount(n.UserName, n.Password);
                 rep.UpdateBalance(n, balanceString);
                 rep.SaveChanges();
             }
             else
             {
                 rep.Delete(n.RowKey);
                 rep.SaveChanges();
             }
         }
     }
 }