Example #1
0
        private async void ReverseGeocodeOnDoubleClick(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            RemovePins();

            if (GeocoderViewModel.AddressToPos)
            {
                GeocoderViewModel.AddressToPos = false;
                GeocodingMode.InverseContent();
            }

            var mousePosition = e.GetPosition(this);
            var pinLocation   = DisplayedMap.ViewportPointToLocation(mousePosition);

            var newPin = new Pushpin {
                Location = pinLocation
            };

            _pins.Add(newPin);
            DisplayedMap.Children.Add(newPin);

            GeocoderViewModel.Location = $"{pinLocation.Latitude} {pinLocation.Longitude}";

            await GeocoderViewModel.Geocode();
        }
Example #2
0
        private async void GeocodeOnClick(object sender, RoutedEventArgs e)
        {
            RemovePins();
            var addresses = await GeocoderViewModel.Geocode();

            if (addresses == null)
            {
                ShowErrorDialog();
                return;
            }
            AddPins(addresses);
        }
Example #3
0
        // GET: Employee/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var customer = context.Customers.Where(c => c.Id == id).Single();

            GeocoderViewModel code = new GeocoderViewModel();

            string address = code.FormatAddress(customer);

            var latLng = await GetLongLatFromApi(address);

            code.customer = customer;
            code.lat      = latLng[0];
            code.lng      = latLng[1];
            code.address  = address;

            return(View(code));
        }
Example #4
0
        private async void GeocodeOnEnterKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter || !GeocoderViewModel.CanGeocode)
            {
                return;
            }

            RemovePins();
            var addresses = await GeocoderViewModel.Geocode();

            if (addresses == null)
            {
                ShowErrorDialog();
                return;
            }
            AddPins(addresses);
        }
Example #5
0
        public async Task <ActionResult> Pickups()
        {
            string userId         = User.Identity.GetUserId();
            var    employee       = context.Employees.Where(e => e.ApplicationId == userId).Single();
            var    employeeZip    = employee.zipCode;
            var    customersInZip = context.Customers.Where(c => c.zip == employeeZip).ToList();

            ResetPastPickups(customersInZip);

            DateTime  thisDay = DateTime.Today;
            DayOfWeek today   = thisDay.DayOfWeek;

            var todaysCustomers = customersInZip.Where(c => c.pickupDay == today || c.oneTimePickup == thisDay).ToList();

            var todaysAvailableCustomers = todaysCustomers.Where(c => (thisDay < c.startBreak || c.startBreak == null) || (thisDay > c.endBreak || c.endBreak == null)).ToList();
            var todayRemaining           = todaysAvailableCustomers.Where(c => c.confirmed == false).ToList();

            // make viewbag to get latLongs for wholeLsit
            // send viewbags to view and loop through

            List <GeocoderViewModel> codeViewList = new List <GeocoderViewModel>();

            foreach (Customer cust in todayRemaining)
            {
                GeocoderViewModel code    = new GeocoderViewModel();
                string            address = code.FormatAddress(cust);
                var latLng = await GetLongLatFromApi(address);

                code.customer = cust;
                code.lat      = latLng[0];
                code.lng      = latLng[1];
                code.address  = address;
                codeViewList.Add(code);
            }

            return(View(codeViewList));
        }