Exemple #1
0
        public async Task AddCityDialog_OnDialogClose(Map_AddCity map_AddCity)
        {
            this.RestaurantSearches    = map_AddCity.RestaurantSearches;
            this.MuseumSearches        = map_AddCity.MuseumSearches;
            map_AddCity.City.CityOrder = this.Cities.Count;
            map_AddCity.City.UserId    = await LocalStorageManagerService.GetPermanentItemAsync("UserId");

            this.Cities.Add(map_AddCity.City);
            if (this.MuseumSearches.Count == 0 && this.RestaurantSearches.Count == 0)
            {
                var serializedCities = JsonConvert.SerializeObject(this.Cities);
                await LocalStorageManagerService.DeletePermanentItemAsync("Cities");

                await LocalStorageManagerService.SavePermanentItemAsync("Cities", serializedCities);
            }
            if (this.MuseumSearches.Count == 0 && map_AddCity.City.NeedsMuseum)
            {
                if (this.RestaurantSearches.Count == 0 && map_AddCity.City.NeedsRestaurant)
                {
                    ShowUnSuccessAlert("Sorry! We couldn't find any restaurants, nor any museums in your area");
                }
                else
                {
                    ShowUnSuccessAlert("Sorry! We couldn't find any museums in your area");
                }
            }
            else
            if (this.RestaurantSearches.Count == 0 && map_AddCity.City.NeedsRestaurant)
            {
                ShowUnSuccessAlert("Sorry! We couldn't find any restaurants in your area");
            }
            ShowSuccessAlert("The city was successfully added to the route!");
        }
Exemple #2
0
        protected async Task HandleValidSubmit()
        {
            this.City.Location = Location;

            Map_AddCity map_AddCity = new Map_AddCity();

            if (this.City.NeedsMuseum)
            {
                map_AddCity.MuseumSearches = (await GoogleDataService.TextSearch(MuseumType + "Museum", this.City.Location)).results;
            }
            if (this.City.NeedsRestaurant)
            {
                map_AddCity.RestaurantSearches = (await GoogleDataService.TextSearch(RestaurantType + "Restaurant", this.City.Location)).results;
            }

            map_AddCity.City = this.City;

            await CloseEventCallBack.InvokeAsync(map_AddCity);//we can send even the save employee here

            ShowDialog = false;
            _autocompleteInitialized = false;
            StateHasChanged();
        }