示例#1
0
        public AppointmentStoreUpdate GetCallbackHours()
        {
            var list = new AppointmentStoreUpdate();

            try
            {
                var credential = DependencyService.Get <ICredentialRetriever>().GetCredential();
                var client     = new RestSharp.RestClient($"{UmbrellaApi.SCHEME}://{UmbrellaApi.API_HOST_URL}/callbackhours");
                var request    = new RestRequest(Method.POST);
                request.AddParameter("partner_id", "77514");
                request.AddHeader("umbrella-api-username", UmbrellaApi.USERNAME);
                request.AddHeader("umbrella-api-key", UmbrellaApi.PASSKEY);
                request.AddHeader("umbrella-partner-id", UmbrellaApi.PARTNER_ID);
                //   var content = response.Content;
                // List<Lead> convert = null;
                EventWaitHandle Wait        = new AutoResetEvent(false);
                var             asyncHandle = client.ExecuteAsync <AppointmentStoreUpdate>(request, response => {
                    System.Diagnostics.Debug.WriteLine("Appointment : " + response.Content);
                    try
                    {
                        var json           = response.Content.Replace("<", "");
                        JObject jo         = JObject.Parse(json);
                        var diskSpaceArray = jo.SelectToken("data", false).ToString().Replace("[", "").Replace("]", "");
                        list = JsonConvert.DeserializeObject <AppointmentStoreUpdate>(diskSpaceArray);
                        System.Diagnostics.Debug.WriteLine("list app : " + list.Fri_From);
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Appointment Error : " + e.ToString());
                    }

                    Wait.Set();
                });
                Wait.WaitOne();
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("exception" + e.Message + " " + e.InnerException);
            }

            return(list);
        }
示例#2
0
        public AppointmentsPage()
        {
            InitializeComponent();
            NavigationPage.SetBackButtonTitle(this, "");
            _appointService = new AppointmentsService();
            _appointModel   = _appointService.GetCallbackHours();
            CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
            {
                UpdateBtn.IsEnableButton = args.IsConnected ? true : false;
            };

            TimePicker11.Time = ConvertStringToTimespan(_appointModel.Mon_From);
            TimePicker12.Time = ConvertStringToTimespan(_appointModel.Mon_Till);
            TimePicker21.Time = ConvertStringToTimespan(_appointModel.Tue_From);
            TimePicker22.Time = ConvertStringToTimespan(_appointModel.Tue_Till);
            TimePicker31.Time = ConvertStringToTimespan(_appointModel.Wen_From);
            TimePicker32.Time = ConvertStringToTimespan(_appointModel.Wen_Till);
            TimePicker41.Time = ConvertStringToTimespan(_appointModel.Thur_From);
            TimePicker42.Time = ConvertStringToTimespan(_appointModel.Thur_Till);
            TimePicker51.Time = ConvertStringToTimespan(_appointModel.Fri_From);
            TimePicker52.Time = ConvertStringToTimespan(_appointModel.Fri_Till);
            TimePicker61.Time = ConvertStringToTimespan(_appointModel.Sat_From);
            TimePicker62.Time = ConvertStringToTimespan(_appointModel.Sat_Till);
            TimePicker71.Time = ConvertStringToTimespan(_appointModel.Sun_From);
            TimePicker72.Time = ConvertStringToTimespan(_appointModel.Sun_Till);

            //set min and max time
            TimePicker11.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker11.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker12.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker12.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker21.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker21.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker22.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker22.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker31.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker31.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker32.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker32.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker41.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker41.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker42.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker42.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker51.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker51.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker52.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker52.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker61.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker61.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker62.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker62.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker71.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker71.MaximumTime = new TimeSpan(22, 0, 0);
            TimePicker72.MinimumTime = new TimeSpan(8, 0, 0);
            TimePicker72.MaximumTime = new TimeSpan(22, 0, 0);
            try
            {
                MonSwitch.IsToggled = _appointModel.LabelClose1 == "yes" ? true : false;
                TueSwitch.IsToggled = _appointModel.LabelClose2 == "yes" ? true : false;
                WedSwitch.IsToggled = _appointModel.LabelClose3 == "yes" ? true : false;
                ThuSwitch.IsToggled = _appointModel.LabelClose4 == "yes" ? true : false;
                FriSwitch.IsToggled = _appointModel.LabelClose5 == "yes" ? true : false;
                SatSwitch.IsToggled = _appointModel.LabelClose6 == "yes" ? true : false;
                SunSwitch.IsToggled = _appointModel.LabelClose7 == "yes" ? true : false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("ex " + ex.InnerException + " " + ex.Message);
            }
        }