public async void CheckSchedules(Object source, ElapsedEventArgs e) { var notifys = await _context.NotifyModels.ToListAsync(); var notifysScheduled = notifys.Where(n => n.IsScheduled == true).ToList(); foreach (var n in notifysScheduled) { DNSCheck.CheckDNSEntry(n, _context); } Console.WriteLine("Scheduler: Check Schedules - " + DateTime.Now); }
public void Execute() { try { if (Program.IsDebug) { Console.WriteLine("Started......"); } var projectsList = api.GetKitsuneProjectsWhoseDomainNameNotMapped(Days).Result; if (projectsList == null) { throw new Exception("Error while getting projects list."); } if (projectsList.IsError) { throw new Exception(projectsList.Message); } var domains = projectsList.DomainList; foreach (var domain in domains) { if (Program.IsDebug) { Console.WriteLine(String.Format("Domain : {0}, KitsuneUrl : {1}", domain.Domain, domain.KitsuneUrl)); } try { if (DNSCheck.CheckIfCNAMEMapped(domain.Domain, domain.KitsuneUrl)) { var result = api.KituneMapDomain(domain.CustomerId).Result; if (result.IsError) { throw new Exception("Error Mapping Domain"); } if (Program.IsDebug) { Console.WriteLine("Mapped"); } //log Log completed } else { //Not Mapped } } catch (Exception ex) { if (Program.IsDebug) { Console.WriteLine("Error:" + ex.Message); } } } if (Program.IsDebug) { Console.WriteLine("Completed...."); } } catch (Exception ex) { } }