Exemplo n.º 1
0
        private async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                await App.Current.InitializeDataFromAPI();

                SummaryData = App.AppSummary;
                OnPropertyChanged(nameof(SummaryData));

                ListLocation.Clear();
                ListLocation = new ObservableCollection <CovidLocation>(App.AppLocations);

                ListCluster.Clear();
                ListCluster = new ObservableCollection <CovidCluster>(App.AppClusters);

                OnPropertyChanged(nameof(ListLocation));
                OnPropertyChanged(nameof(ListCluster));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 2
0
        public async Task AddNewLocation(string name, ListLocation listLocation)
        {
            if (listLocation == null)
            {
                listLocation = AddNewListLocation;
            }
            var list = await GetById(listLocation.Id);

            var locator = CrossGeolocator.Current;

            locator.DesiredAccuracy = 20;

            var position = await locator.GetPositionAsync(timeoutMilliseconds : 15000);

            InMemLocations.Add(new Location
            {
                Latitude  = position.Latitude.ToString(),
                Longitude = position.Longitude.ToString(),
                Name      = name,
                GpsTime   = DateTime.UtcNow
            });

            list.Locations.Add(InMemLocations[InMemLocations.Count - 1]);

            await SaveLocations();
        }
Exemplo n.º 3
0
        public async void SearchClient2(string text)
        {
            if (text != "" && text != null)
            {
                var a = listlocationAux.Where(p => p.Titulo.ToLower().Contains(text.ToLower())).ToList();
                Debug.WriteLine(a.Count());

                if (a != null)
                {
                    ListLocation.Clear();
                    Debug.WriteLine(a.Count());
                    foreach (var item in a)
                    {
                        ListLocation.Add(item);
                    }
                }
            }
            else
            {
                foreach (var item in listlocationAux)
                {
                    ListLocation.Add(item);
                }
            }
        }
Exemplo n.º 4
0
 private async void GuardarCliente()
 {
     if (MyPin != null)
     {
         // await navigationService.Navigate("CheckinClientePage");
         App.clienteseleccionado = ListLocation.Where(x => x.Titulo == MyPin.Title).FirstOrDefault();
     }
 }
        public LocationViewModel(ListLocation location, INavigation navigation)
        {
            this.navigation = navigation;

            listLocation    = location;
            locationService = new LocationInMemoryService();

            Locations = new ObservableCollection <Location>(locationService.GetAll(location).Result);
        }
Exemplo n.º 6
0
        private async void HacerCheck()
        {
            if (MyPin != null)
            {
                // await navigationService.Navigate("CheckinClientePage");
                clienteseleccionado = ListLocation.Where(x => x.Titulo == MyPin.Title).FirstOrDefault();

                await App.Navigator.PushAsync(new CheckinClientPage(clienteseleccionado));
            }
        }
Exemplo n.º 7
0
        public async Task AddNewLocationList(string nameList)
        {
            AddNewListLocation = new ListLocation();
            await Task.Delay(0);

            AddNewListLocation.Id        = Guid.NewGuid();
            AddNewListLocation.NameList  = nameList;
            AddNewListLocation.Locations = new List <Location>();
            listLocations.Add(AddNewListLocation);
            await SaveLocations();
        }
Exemplo n.º 8
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ListLocation = await _context.ListLocation.FirstOrDefaultAsync(m => m.LocationID == id);

            if (ListLocation == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 9
0
        public async Task <IEnumerable <Location> > GetAll(ListLocation listLocation)
        {
            if (listLocation != null)
            {
                Clean();
                var test = await GetById(listLocation.Id);

                for (int i = 0; i < test.Locations.Count; i++)
                {
                    InMemLocations.Add(test.Locations[i]);
                }
            }
            await Task.Delay(0);

            return(InMemLocations);
        }
Exemplo n.º 10
0
        public BindableCollection <Location> Get_AllLocation()
        {
            ListLocation.Clear();
            sql = $"SELECT * FROM DIADIEM";
            DataTable dt = Connection.GetALL_Data(sql);

            foreach (DataRow row in dt.Rows)
            {
                Location location = new Location();
                location.LocationID   = row["MADD"].ToString();
                location.TripID       = row["MACD"].ToString();
                location.Number       = row["STT"].ToString();
                location.LocationName = row["TENDD"].ToString();
                ListLocation.Add(location);
            }
            return(ListLocation);
        }
Exemplo n.º 11
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ListLocation = await _context.ListLocation.FindAsync(id);

            if (ListLocation != null)
            {
                _context.ListLocation.Remove(ListLocation);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 12
0
        public async void LoadClientes()
        {
            try
            {
                var clientes = await apiService.GetMyClient();

                Locations = new ObservableCollection <TKCustomMapPin>();
                LocationsSearch.Clear();
                ListLocation.Clear();
                clientes.Count();
                if (clientes != null && clientes.Count > 0)
                {
                    Point p = new Point(0.48, 0.96);
                    foreach (var cliente in clientes)
                    {
                        var Pincliente = new TKCustomMapPin
                        {
                            Image       = "pin.png",
                            Position    = new Xamarin.Forms.Maps.Position(cliente.Latitud, cliente.Longitud),
                            Anchor      = p,
                            Title       = "Razón Social: " + cliente.RazonSocial,
                            Subtitle    = "Dirección: " + cliente.Direccion,
                            ShowCallout = true,
                        };
                        var itemcliente = new ListRequest
                        {
                            Titulo    = "Razón Social: " + cliente.RazonSocial,
                            Subtitulo = cliente.Direccion + " " + cliente.Telefono,
                            idCliente = cliente.IdCliente,
                        };

                        Locations.Add(Pincliente);
                        ListLocation.Add(itemcliente);
                        listlocationAux.Add(itemcliente);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemplo n.º 13
0
        public async void LoadClientes()
        {
            try
            {
                var clientes = await apiService.GetAllClients();

                Locations.Clear();
                ListLocation.Clear();
                clientes.Count();
                if (clientes != null && clientes.Count > 0)
                {
                    foreach (var cliente in clientes)
                    {
                        var Pincliente = new TKCustomMapPin
                        {
                            Image    = "pin.png",
                            Position = new Xamarin.Forms.Maps.Position(cliente.Lat, cliente.Lon),
                            Title    = cliente.Nombre,
                            Subtitle = "Dirección: " + cliente.Direccion,

                            ShowCallout = true,
                        };
                        var itemcliente = new ListRequest
                        {
                            Titulo    = cliente.Nombre,
                            Subtitulo = cliente.PersonaContacto + " " + cliente.Telefono,
                        };
                        Locations.Add(Pincliente);
                        ListLocation.Add(itemcliente);
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 14
0
        public void ListLocation_Should_Call_Method(ListLocation listLocation)
        {
            _sut.List(listLocation);

            _storage.Verify(x => x.ListLocation(It.IsAny <string>()), Times.Once);
        }
Exemplo n.º 15
0
 public LocationView(ListLocation location)
 {
     InitializeComponent();
     BindingContext = new LocationViewModel(location, this.Navigation);
 }
Exemplo n.º 16
0
        public async Task <List <LocationViewModel> > List(ListLocation listLocation)
        {
            var locations = await _repository.ListLocation(listLocation.UserName);

            return(LocationViewModel.FromCoreModels(locations));
        }