Esempio n. 1
0
        static void Main(string[] args)
        {
            Options options = new Options();
            var     result  = Parser.Default.ParseArguments <Options>(args);

            switch (result.Tag)
            {
            case ParserResultType.Parsed:
                var parsed = (Parsed <Options>)result;
                options = parsed.Value;
                Commentary.Print(
                    $"\nRefresh Location = {options.RefreshLocations}\nIgnore Regulation Check = {options.IgnoreRegulationCheck}\nSave Events = {options.SaveEvents}\nSave Images= {options.SaveImages}\nMark All As Violations= {options.MarkAllAsViolations}");
                break;

            case ParserResultType.NotParsed:
                var notParsed = (NotParsed <Options>)result;
                var errors    = notParsed.Errors;
                foreach (var error in errors)
                {
                    Commentary.Print($"{error}");
                }
                return;
            }

            Init();
            // History();
            var             locationType = "PARKING_ZONE";
            int             pagesize     = 50;
            List <Boundary> boundaries   = _locationService.GetBoundaries();

            foreach (var boundary in boundaries)
            {
                Commentary.Print($"BBOX: {boundary.Range}");
                Commentary.Print($"Location Type: {locationType}");
                if (options.RefreshLocations)
                {
                    Commentary.Print($"Calling Get All Locations by BBOX & Location Type");
                    var locations = _locationService.All(boundary.Range, locationType, pagesize);
                    Commentary.Print($"Total Locations: {locations.Count}");

                    _locationService.Details(locations.Select(x => x.LocationUid).Distinct().ToList());
                }

                _eventService.GetByBoundaryAsync(boundary.Range, "PKIN", "PKOUT", _imageService, options,
                                                 new Customer()
                {
                    Id = boundary.CustomerId, TimezoneId = "Eastern Standard Time"
                });
            }

            Commentary.Print($"Completed. Please enter a key to exit");
        }
Esempio n. 2
0
        private void OpenSocket()
        {
            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"])
            };

            Commentary.Print(
                $"\nRefresh Location = {options.RefreshLocations}");
            Commentary.Print(
                $"\nIgnore Regulation Check = {options.IgnoreRegulationCheck}");
            Commentary.Print(
                $"\nSave Events = {options.SaveEvents}");
            Commentary.Print(
                $"\nSave Images= {options.SaveImages}");
            Commentary.Print(
                $"\nMark All As Violations= {options.MarkAllAsViolations}");
            var             locationType = "PARKING_ZONE";
            int             pagesize     = 50;
            List <Boundary> boundaries   = _locationService.GetBoundaries();

            foreach (var boundary in boundaries)
            {
                Commentary.Print($"BBOX: {boundary.Range}");
                Commentary.Print($"Location Type: {locationType}");
                if (options.RefreshLocations)
                {
                    Commentary.Print($"Calling Get All Locations by BBOX & Location Type");
                    var locations = _locationService.All(boundary.Range, locationType, pagesize);
                    Commentary.Print($"Total Locations: {locations.Count}");

                    _locationService.Details(locations.Select(x => x.LocationUid).Distinct().ToList());
                }

                _eventService.GetByBoundaryAsync(boundary.Range, "PKIN", "PKOUT", _imageService, options, new Customer {
                    Id = boundary.CustomerId, TimezoneId = "Eastern Standard Time"
                });
            }

            Commentary.Print($"Completed. Please enter a key to exit");
        }