public void CheckUpdatesData() { cityList = db.selectTableCities(); titleCreator = new TitleCreator(); var parentObject = new List <IParentObject>(); AddDataAfterUpdate(parentObject); mAdapter = new MyAdapter(this, parentObject); mRecyclerView.SetAdapter(mAdapter); }
public void SecondTimeLoadData(string name) { cityList = db.selectTableCities(); titleCreator.Add(name); var titles = titleCreator.GetAll; parentObject.Add(titles.LastOrDefault()); mAdapter = new MyAdapter(this, parentObject); mRecyclerView.SetAdapter(mAdapter); }
private void LoadData(bool After) { if (After == true || IsDelete == true) { titleCreator = new TitleCreator(); parentObject = new List <IParentObject>(); IsDelete = false; } cityList = db.selectTableCities(); var child = db.selectTablePlace(); for (var x = 0; x < cityList.Count; x++) { titleCreator.Add(cityList[x].Name); } var titles = titleCreator.GetAll; foreach (var title in titles) { var childList = new List <object>(); var titleName = db.selectTablePlaceWhere(title); foreach (var childrenPlace in titleName) { childList.Add(new TitleChild(childrenPlace.Name)); title.ChildObjectList = childList; } parentObject.Add(title); } mAdapter = new MyAdapter(this, parentObject); mRecyclerView.SetAdapter(mAdapter); }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { if (requestCode == RequestCode) { if (resultCode == Result.Ok) { var titles = titleCreator.GetAll; cityList = db.selectTableCities(); foreach (var title in titles) { if (title.Title == data.GetStringExtra("name")) { if (title.ChildObjectList == null) { var place = new Place { Id = data.GetIntExtra("PlaceId", 1), Name = data.GetStringExtra("PlaceName"), Description = data.GetStringExtra("description"), Rating = data.GetFloatExtra("ratingText", 0), LocPlaceName = data.GetStringExtra("locationPlaceName"), LocSecondPlaceName = data.GetStringExtra("secondLocationPlaceName"), Latitude = data.GetDoubleExtra("latitude", 0), Longitude = data.GetDoubleExtra("longitude", 0), CityName = title.Title }; db.InsterIntoTablePlace(place); var childList = new List <object>(); childList.Add(new TitleChild($"{data.GetStringExtra("PlaceName")}")); title.ChildObjectList = childList; } else { var place = new Place { Id = data.GetIntExtra("PlaceId", 1), Name = data.GetStringExtra("PlaceName"), Description = data.GetStringExtra("description"), Rating = data.GetFloatExtra("ratingText", 0), LocPlaceName = data.GetStringExtra("locationPlaceName"), LocSecondPlaceName = data.GetStringExtra("secondLocationPlaceName"), Latitude = data.GetDoubleExtra("latitude", 0), Longitude = data.GetDoubleExtra("longitude", 0), CityName = title.Title }; db.InsterIntoTablePlace(place); var newChildList = title.ChildObjectList; newChildList.Add(new TitleChild($"{data.GetStringExtra("PlaceName")}")); title.ChildObjectList = newChildList; } } } mAdapter = new MyAdapter(this, parentObject); mRecyclerView.SetAdapter(mAdapter); Toast.MakeText(this, data.GetStringExtra("PlaceName"), ToastLength.Short).Show(); } } if (requestCode == RequestEditCode) { if (resultCode == Result.Ok) { LoadData(true); } } }