private void LoadSublocations(string LocationID = null) { var selectedSublocation = ""; var SublocationList = SublocationClass.DbToSubLocation(Database.SubLocations.GetTableDataFromLocations(_connection, LocationID)); assetSubLocation_.Items.Add("No " + _Names.SubLocation); foreach (SublocationClass sublocation in SublocationList) { assetSubLocation_.Items.Add(sublocation.SubLocationName); if (LocationID != null) { if (sublocation.Location_ID_Internal == LocationID) { selectedSublocation = sublocation.SubLocationName; } } if (selectedSublocation != "") { assetSubLocation_.SelectedItem = selectedSublocation; } else { assetSubLocation_.SelectedIndex = 0; } } }
private void GetData() { //instead of doing this, get all assets data from that location and send it to audit list string locationName; LocationClass LocationInfo = new LocationClass(); //gets location id internal if (assetLocation_.SelectedIndex >= 0) { locationName = assetLocation_.Items[assetLocation_.SelectedIndex]; LocationInfo = LocationClass.DbToLocation(Database.Locations.GetTableDataFromSites(_connection, _siteID), _connection).First(cm => cm.LocationName == locationName); } if (assetSubLocation_.SelectedIndex >= 1) { try { var sublocation = SublocationClass.DbToSubLocation(Database.SubLocations.GetTableData(_connection)).First(cm => cm.SubLocationName == assetSubLocation_.Items[assetSubLocation_.SelectedIndex]); Navigation.PushAsync(new AssetListPage(_connection, LocationInfo, Names_, sublocation)); } catch (Exception exc) { DependencyService.Get <IError>().SendRaygunError(exc, Application.Current.Properties["user"].ToString() ?? "unsynced", Application.Current.Properties["url"].ToString() ?? "unsynced", null); Navigation.PushAsync(new AssetListPage(_connection, LocationInfo, Names_)); } } else { Navigation.PushAsync(new AssetListPage(_connection, LocationInfo, Names_)); } }
List <SublocationClass> GetSublocations(LocationClass location_Class, string searchText = null) { var Sublocations = SublocationClass.DbToSubLocation(Database.SubLocations.GetTableDataFromLocations(_connection, location_Class.LocationIdInternal), _Names); if (String.IsNullOrWhiteSpace(searchText)) { return(Sublocations); } return(Sublocations.Where(c => c.SubLocationName.Contains(searchText)).ToList()); }
private void LoadSublocations(string LocationID = null, string SublocationName = null) { var SublocationList = SublocationClass.DbToSubLocation(Database.SubLocations.GetTableDataFromLocations(_connection, LocationID)); assetSubLocation_.Items.Add("No " + Names_.SubLocation); foreach (SublocationClass sublocation in SublocationList) { assetSubLocation_.Items.Add(sublocation.SubLocationName); } if (SublocationName != null) { assetSubLocation_.SelectedItem = SublocationName; } else { assetSubLocation_.SelectedIndex = 0; } }