private async Task LoadBatches(CommonDetails details) { if (helper.CheckInternetConnection(this)) { try { ServiceHelper serviceHelper = new ServiceHelper(); List <BatchCountModel> batchList = new List <BatchCountModel>(); batchList = serviceHelper.GetBatch(details.access_token, details.VenueId, details.SportId, details.CourtId); adapter = new GridBatchAdpater(this, batchList, linearProgressBar, details); grdView.SetAdapter(adapter); } catch (Exception e) { helper.AlertPopUp("Error", "Unable to retrive data the server", this); linearProgressBar.Visibility = Android.Views.ViewStates.Gone; } } else { helper.AlertPopUp("Warning", "Please enable mobile data", this); linearProgressBar.Visibility = Android.Views.ViewStates.Gone; } }
public void CheckLandingPage(CommonDetails details) { ServiceHelper serviceHelper; serviceHelper = new ServiceHelper(); List <Court> courtList = new List <Court>(); List <BatchCountModel> batchList = new List <BatchCountModel>(); courtList = serviceHelper.GetCourt(details.access_token, details.VenueId, details.SportId); if (courtList != null && courtList.Count > 0) { if (courtList.Count > 1) { var courtIntent = new Intent(context, typeof(CourtActivity)); courtIntent.PutExtra("details", JsonConvert.SerializeObject(details)); context.StartActivity(courtIntent); context.Finish(); } else { serviceHelper = new ServiceHelper(); details.CourtId = courtList[0].CourtId.ToString(); batchList = serviceHelper.GetBatch(details.access_token, details.VenueId, details.SportId, details.CourtId); var batchesIntent = new Intent(context, typeof(BatchesActivity)); batchesIntent.PutExtra("details", JsonConvert.SerializeObject(details)); context.StartActivity(batchesIntent); context.Finish(); } } else { helper.AlertPopUp("Warning", "There are no court available", context); progress.Visibility = Android.Views.ViewStates.Gone; } }
public void CheckLandingPage(CommonDetails details) { ServiceHelper serviceHelper; serviceHelper = new ServiceHelper(); List <Sport> sportList = new List <Sport>(); List <Court> courtList = new List <Court>(); List <BatchCountModel> batchList = new List <BatchCountModel>(); sportList = serviceHelper.GetSports(details.access_token, details.VenueId); if (sportList != null && sportList.Count > 0) { if (sportList.Count > 1) { var sportIntent = new Intent(this, typeof(SportActivity)); sportIntent.PutExtra("details", JsonConvert.SerializeObject(details)); this.StartActivity(sportIntent); this.Finish(); } else { serviceHelper = new ServiceHelper(); details.SportId = sportList[0].SportId.ToString(); courtList = serviceHelper.GetCourt(details.access_token, details.VenueId, details.SportId); if (courtList != null && courtList.Count > 0) { if (courtList.Count > 1) { var courtIntent = new Intent(this, typeof(CourtActivity)); courtIntent.PutExtra("details", JsonConvert.SerializeObject(details)); this.StartActivity(courtIntent); this.Finish(); } else { serviceHelper = new ServiceHelper(); details.CourtId = courtList[0].CourtId.ToString(); batchList = serviceHelper.GetBatch(details.access_token, details.VenueId, details.SportId, details.CourtId); var batchesIntent = new Intent(this, typeof(BatchesActivity)); batchesIntent.PutExtra("details", JsonConvert.SerializeObject(details)); this.StartActivity(batchesIntent); this.Finish(); } } else { helper.AlertPopUp("Warning", "There are no court available", this); } } } else { helper.AlertPopUp("Warning", "There are no sports available", this); } }