protected override void Initialize(HttpControllerContext controllerContext) { try { base.Initialize(controllerContext); LicencjatContext context = new LicencjatContext(); DomainManager = new EntityDomainManager <Currencies>(context, Request); } catch (Exception ex) { var temp = ex; } }
private static List <Currencies> tab;//wszystkie elementy tabeli w liscie public static async void PeriodicWork() { DateTime presentDate = DateTime.UtcNow; try { presentDate = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(presentDate, "Central European Standard Time"); } catch (Exception e) { var t = e.Message; } DateTime docDate; try { docDate = PrepareData.GetDocumentDate(url_tableA); } catch (Exception ex) { throw ex; } var licContext = new LicencjatContext(); tab = licContext.AllCurrencies.ToList(); var timeWindow = new DateTime(presentDate.Year, presentDate.Month, presentDate.Day, 12, 30, 00); //12, 30, 00 var noon = new DateTime(presentDate.Year, presentDate.Month, presentDate.Day, 12, 00, 00); //12, 00, 00 CultureInfo.CurrentCulture = new CultureInfo("en-US"); if (presentDate.CompareTo(noon) < 0) { isSent = false; } if (docDate.Day == presentDate.Day && presentDate.CompareTo(timeWindow) < 0 && presentDate.CompareTo(noon) >= 0 && isSent == false) { if (tab.Count != 0) { await SelectUsersAndSendPush(); } isSent = true; } }