Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        private async Task LoadCourt(CommonDetails details)
        {
            ServiceHelper serviceHelper = new ServiceHelper();

            if (helper.CheckInternetConnection(this))
            {
                try
                {
                    List <Court> courtList = new List <Court>();
                    courtList = serviceHelper.GetCourt(details.access_token, details.VenueId, details.SportId);


                    //linearProgressBar.Visibility = Android.Views.ViewStates.Visible;
                    //new Thread(new ThreadStart(delegate
                    //{
                    //    RunOnUiThread(async () => { await LoadCourt(); linearProgressBar.Visibility = Android.Views.ViewStates.Gone; });
                    //})).Start();


                    if (courtList != null && courtList.Count > 0)
                    {
                        courtListView.SetAdapter(new Court_ItemAdapter(this, courtList, linearProgressBar, details));
                    }

                    linearProgressBar.Visibility = Android.Views.ViewStates.Gone;
                }
                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;
            }
        }
Exemplo n.º 3
0
        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);
            }
        }