static void Main(string[] args) { //local var NotificationTimer Timer = new NotificationTimer(); List <Receivable> RList = new List <Receivable>(); List <NotificationUsers> NList = new List <NotificationUsers>(); List <Staff> SList = new List <Staff>(); //get timer Timer = GetNotificationTimer(); //get staff list SList = GetStaffList(); //get user notification list NList = GetUserNotificationList(); //reduce List to checked users NList = GetCheckedUsersList(NList); //get receivable list RList = GetReceivableList(); RList = GetTimedOutReceivablesList(Timer, RList); //send emails SendEmails(RList, NList, SList); Console.ReadKey(); }//end main
private static List <Receivable> GetTimedOutReceivablesList(NotificationTimer Timer, List <Receivable> RList) { Console.WriteLine("Reducing Receivable List..."); RList = new List <Receivable>(GetTimedOutReceivables(Timer, RList)); //Reduce RList to Receivables that are timed out Console.WriteLine("List Reduced"); return(RList); }
private static NotificationTimer GetNotificationTimer() { NotificationTimer Timer; Console.WriteLine("Attempting to get Notification Timer..."); Timer = NotificationTimer.GetNotificationTimer(); if (Timer != null) { Console.WriteLine("Notification Timer = SUCCESS"); }//end if else { Console.WriteLine("Notification Timer = FAILED"); }//end else return(Timer); }
//Utils public static List <Receivable> GetTimedOutReceivables(NotificationTimer NotificationTimer, List <Receivable> ReceivableList) { //local var List <Receivable> RList = new List <Receivable>(); int timeoutDays = NotificationTimer.Amount * NotificationTimer.Unit; //get total number of days before being timed out foreach (Receivable R in ReceivableList) { if (R.DateSent != default(DateTime)) { //local var double totalsdays = -1; //get total number of days totalsdays = (DateTime.Now - R.DateCreated).TotalDays; if (totalsdays >= timeoutDays) { RList.Add(R); } //end if inner } //end if outter } //end foreach return(RList); } //end GetTimedOutReceivables