public static void SendBillNotifications() { using (INotificationRepository rep = new NotificationRepository()) { var notifications = rep.GetNotificationsToSend(); foreach (var n in notifications) { GetBillAndSendNotification(n); } } }
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(); } } } }