Beispiel #1
0
        public int InsertLocation(LocationAutoCompleteResult location)
        {
            var num = database.Insert(location);

            database.Commit();
            return(num);
        }
Beispiel #2
0
        public bool CheckIfExists(LocationAutoCompleteResult location)
        {
            var exists = database.Table <LocationAutoCompleteResult>()
                         .Where(x => x.LocalizedName == location.LocalizedName ||
                                x.Key == location.Key).Any();

            return(exists);
        }
 public void AddItem(LocationAutoCompleteResult item)
 {
     if (item.LocalizedName != null)
     {
         if (item.LocalizedName.Trim() != string.Empty)
         {
             Locations.Add(item);
         }
         else
         {
             //Note this code just removes spaces from the EditText if that is all was in them
             //DestinationName = item.LocalizedName;
         }
     }
 }
        public async void SelectLocation(LocationAutoCompleteResult selectedLocation)
        {
            if (!await locationsDatabase.CheckIfExists(selectedLocation))
            {
                await locationsDatabase.InsertLocation(selectedLocation);

                Close(this);
            }
            else
            {
                if (await dialog.Show("This location has already been added", "Location Exists", "Keep Searching", "Go Back"))
                {
                    SearchTerm = string.Empty;
                    Locations.Clear();
                }
                else
                {
                    Close(this);
                }
            }
        }
Beispiel #5
0
 public void Init(LocationAutoCompleteResult parameters)
 {
     selectedLocation = parameters;
 }
 public async Task <int> InsertLocation(LocationAutoCompleteResult location)
 {
     return(await InsertLocation(new Location(location)));
 }
        public async Task <bool> CheckIfExists(LocationAutoCompleteResult location)
        {
            var exists = await CheckIfExists(new Location(location));

            return(exists);
        }