private void OnRescheduleClick(object sender, EventArgs arg)
        {
            var btn  = sender as Button;
            var id   = btn.GetValue(UIUtils.TagProperty).ToString();
            var jObj = (JObject)appData.SingleOrDefault(o => (string)o["Id"] == id);

            if (jObj == null)
            {
                return;
            }
            var order = new Order(jObj);

            spinner = UIUtils.ShowSpinner(this);
            DataGate.MuaGetAvailability(order.Mua.Id, DateTime.Today, DateTime.Today.AddMonths(6), true, result =>
            {
                if (result.Code == ResponseCode.OK)
                {
                    var avail = Availibility.Parse(result.Result);
                    if (avail.DatesFrom.Count == 0)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            UIUtils.HideSpinner(this, spinner);
                            UIUtils.ShowMessage("The artist does not have free time for the next month", this);
                        });
                        return;
                    }
                    order.IsFree    = SearchHeader.IsFreeMakeoverL;
                    order.IsUpdate  = true;
                    var ap          = new AvailabilityPage(order);
                    ap.Availibility = avail;
                    ap.SelectedDate = avail.DatesFrom.First();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        this.Navigation.PushAsync(ap);
                    });
                }
                else
                {
                    UIUtils.ShowServerUnavailable(this);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    UIUtils.HideSpinner(this, spinner);
                });
            });
        }
Beispiel #2
0
        private void OnAvailabilityChange(int mode)
        {
            availabilityMode = mode;
            switch (availabilityMode)
            {
            case 1:
                timeLabel.Text     = "Available Anytime";
                AvailibilityFilter = null;
                break;

            case 2:
                timeLabel.Text     = "Available today";
                AvailibilityFilter = new Availibility()
                {
                    Mode      = AvailibilityMode.Dates,
                    DatesFrom = new List <DateTime>()
                    {
                        DateTime.Today.Add(new TimeSpan(0, 0, 0))
                    },
                    DatesTo = new List <DateTime>()
                    {
                        DateTime.Today.Add(new TimeSpan(24, 0, 0))
                    }
                };
                break;

            case 3:
                var ap = new AvailabilityPage()
                {
                    Mode         = ViewMode.SingleRange,
                    SelectedDate = DateTime.Now,
                    ButtonText   = "Select"
                };
                ap.OnFinishSelection += (o, s) =>
                {
                    AvailibilityFilter = ap.Availibility;
                    timeLabel.Text     = $"{ap.Availibility.DatesFrom[0].ToString("D", Utils.EnCulture)}\n\rFrom {ap.Availibility.DatesFrom[0].ToString("HH:mm")} To {ap.Availibility.DatesTo[0].ToString("HH:mm")}";
                };
                Navigation.PushAsync(ap);
                break;
            }
        }
Beispiel #3
0
        private void ContinueOrder(object sender, EventArgs e)
        {
            spinner = UIUtils.ShowSpinner(this);
            var id = mua.Id;

            DataGate.MuaGetAvailability(id, DateTime.Today, DateTime.Today.AddMonths(6), true, result =>
            {
                if (result.Code == ResponseCode.OK)
                {
                    var avail = Availibility.Parse(result.Result);
                    if (avail.DatesFrom.Count == 0)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            UIUtils.HideSpinner(this, spinner);
                            UIUtils.ShowMessage("The artist does not have free time for the next month", this);
                        });
                        return;
                    }
                    order.IsFree    = SearchHeader.IsFreeMakeoverL;
                    var ap          = new AvailabilityPage(order);
                    ap.Availibility = avail;
                    ap.SelectedDate = avail.DatesFrom.First();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        this.Navigation.PushAsync(ap);
                    });
                }
                else
                {
                    UIUtils.ShowServerUnavailable(this);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    UIUtils.HideSpinner(this, spinner);
                });
            });
        }
Beispiel #4
0
 private void OnAvailablilitySelect(View v)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         spinner = UIUtils.ShowSpinner(this);
     });
     DataGate.MuaGetAvailability(GlobalStorage.Settings.MuaId, DateTime.Today.AddMonths(-1), DateTime.Today.AddMonths(5), false, result =>
     {
         if (result.Code == ResponseCode.OK)
         {
             var avail = Availibility.Parse(result.Result);
             var ap    = new AvailabilityPage()
             {
                 Mode         = ViewMode.MultiRange,
                 SelectedDate = DateTime.Now,
                 Availibility = avail,
                 ButtonText   = "Save"
             };
             ap.OnFinishSelection += (o, s) =>
             {
                 SaveAvailability(ap.Availibility);
             };
             Device.BeginInvokeOnMainThread(() =>
             {
                 Navigation.PushAsync(ap);
             });
         }
         else
         {
             UIUtils.ShowServerUnavailable(this);
         }
         Device.BeginInvokeOnMainThread(() =>
         {
             UIUtils.HideSpinner(this, spinner);
         });
     });
 }