static void History() { IPredixWebSocketClient _predixWebSocketClient = new PredixWebSocketClient(); Options options = new Options { IgnoreRegulationCheck = Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreRegulationCheck"]), MarkAllAsViolations = Convert.ToBoolean(ConfigurationManager.AppSettings["MarkAllAsViolations"]), RefreshLocations = Convert.ToBoolean(ConfigurationManager.AppSettings["RefreshLocations"]), SaveEvents = Convert.ToBoolean(ConfigurationManager.AppSettings["SaveEvents"]), SaveImages = Convert.ToBoolean(ConfigurationManager.AppSettings["SaveImages"]), Debug = Convert.ToBoolean(ConfigurationManager.AppSettings["Debug"]) }; foreach (var location in _locationService.GetLocationsUids()) { var inEvents = _eventService.Get(location, "PKIN", DateTime.UtcNow.AddHours(-1).ToEpoch().ToString(), DateTime.UtcNow.ToEpoch().ToString()); var outEvents = _eventService.Get(location, "PKOUT", DateTime.UtcNow.AddHours(-1).ToEpoch().ToString(), DateTime.UtcNow.ToEpoch().ToString()); inEvents.AddRange(outEvents); foreach (var evnt in inEvents) { _predixWebSocketClient.ProcessEvent(_imageService, options, new Customer() { Id = 4120, TimezoneId = "Eastern Standard Time" }, evnt); } } }
private void GetHistory() { try { IPredixWebSocketClient predixWebSocketClient = new PredixWebSocketClient(); var locations = _locationService.GetLocationsUids(); Commentary.Print($"Total Locations: {locations.Count}"); Options options = new Options { IgnoreRegulationCheck = Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreRegulationCheck"]), MarkAllAsViolations = Convert.ToBoolean(ConfigurationManager.AppSettings["MarkAllAsViolations"]), RefreshLocations = Convert.ToBoolean(ConfigurationManager.AppSettings["RefreshLocations"]), SaveEvents = Convert.ToBoolean(ConfigurationManager.AppSettings["SaveEvents"]), SaveImages = Convert.ToBoolean(ConfigurationManager.AppSettings["SaveImages"]), Debug = Convert.ToBoolean(ConfigurationManager.AppSettings["Debug"]) }; foreach (var location in locations) { var inEvents = _eventService.Get(location, "PKIN", DateTime.UtcNow.AddMinutes(-2).ToEpoch().ToString(), DateTime.UtcNow.AddSeconds(30).ToEpoch().ToString()); var outEvents = _eventService.Get(location, "PKOUT", DateTime.UtcNow.AddMinutes(-2).ToEpoch().ToString(), DateTime.UtcNow.AddSeconds(30).ToEpoch().ToString()); Commentary.Print($"location: {location}, In Events: {inEvents.Count}, Out Events: {outEvents.Count}"); inEvents.AddRange(outEvents); foreach (var evnt in inEvents) { predixWebSocketClient.ProcessEvent(_imageService, options, new Customer() { Id = 4120, TimezoneId = "Eastern Standard Time" }, evnt); } } } catch (Exception e) { Console.WriteLine(e); Commentary.Print(e.ToString()); } }