private async void HandleBooking(object sender, EventArgs e) { try { //_Description //if (_Description.Text == String.Empty) //{ // await DisplayAlert("Alert", pickTime.Time.ToString(), "ok"); //} //else //{ // await DisplayAlert("Alert", pickTime.Time.ToString(_Description.Text), "ok"); //} DateTime BeginWorkingHours = DateTime.Parse(_WorkTime.Text.Split('-')[0]); DateTime EndWorkingHours = DateTime.Parse(_WorkTime.Text.Split('-')[1]); if (pickTime.Time.Hours >= BeginWorkingHours.Hour && pickTime.Time.Hours < EndWorkingHours.Hour) { bool xx = await AppointmentController.BookAppointment(Utilities.ID, pickDate.Date.ToString("yyyy-MM-dd"), pickTime.Time, MPType, BAD.MPID, _Description.Text, _CountryCode.SelectedItem + _UserNo.Text); if (xx) { await Utilities.CreateAlertDialog("Alert", "Appointment Booked", "Okay", delegate { Navigation.PushAsync(new AppointmentHistoryPage(0, Utilities.IsMedic)); Navigation.RemovePage(this); }); } } else { await DisplayAlert("Alert", "Please book a time between the shown working hours.", "ok"); } } catch (Exception ex) { await DisplayAlert("Alert", ex.Message, "ok"); } }