Example #1
0
        public AppointmentBookingPage()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            _apiServices = new RestApi();
            _objBookAppointmentRequestModel  = new BookAppointmentRequestModel();
            _objBookAppointmentResponseModel = new BookAppointmentResponseModel();
            _objDepartmentListRequestModel   = new DepartmentListRequestModel();
            _objDepartmentListResponseModel  = new DepartmentListResponseModel();
            _objDoctorListRequestModel       = new DoctorListRequestModel();
            _objDoctorListResponseModel      = new DoctorListResponseModel();
            _objReason4VisitResponseModel    = new Reason4VisitResponseModel();
            _objHeaderModel          = new HeaderModel();
            _objHeaderModel.OTPToken = Settings.TokenCode;

            _baseurlDeptList = Settings.Url + Domain.DepartmentApiConstant;
            _baseUrlDocList  = Settings.Url + Domain.DoctorDetailApiConstant;
            _reason4VisitUrl = Settings.Url + Domain.GetReasonForVisitApiConstant;

            GetReason4Visit();
            listDoctorListByDept.ItemSelected += ListDoctorListByDept_ItemSelected;
        }
Example #2
0
        private async void btnLoadDoctor_Clicked(object sender, EventArgs e)
        {
            try
            {
                var Reason4Visit = VisitingReason;
                var Illness      = illNessAutoSuggestion.Text;

                //string[] splitvalue1 = x.Split('{');
                //string[] splitvalue2 = splitvalue1[1].Split('}');
                //string final = splitvalue2[0];
                if (string.IsNullOrEmpty(Reason4Visit) || string.IsNullOrEmpty(Illness))
                {
                    DependencyService.Get <IToast>().ShowToast("Please Sleect Reason For Visit And Illness First!");
                }
                else
                {
                    // string x = illNessAutoSuggestion.SelectedValue.ToString();
                    await Navigation.PushPopupAsync(new LoadingPopPage());

                    int DeptIds = illNessAutoSuggestion.SelectedIndex;
                    if (DeptIds != -1)
                    {
                        shiftstarttime = AppointmentTime.Time;
                        BookingDate    = dateOfAppointment.Date;
                        _objDoctorListRequestModel.DepartmentId       = Convert.ToInt64(illNessAutoSuggestion.SelectedValue.ToString());
                        _objDoctorListRequestModel.ScheduleStartShift = shiftstarttime;
                        _objDoctorListRequestModel.ScheduleDate       = BookingDate;
                        _objDoctorListResponseModel = await _apiServices.DoctorListByDepartmentAsync(new Get_API_Url().DoctorDetailListApi(_baseUrlDocList), true, _objHeaderModel, _objDoctorListRequestModel);

                        var _result = _objDoctorListResponseModel.Response;
                        if (_result.StatusCode == 200)
                        {
                            if (_result.DoctorByDepartmentList.Count > 0)
                            {
                                listDoctorListByDept.ItemsSource = _result.DoctorByDepartmentList;
                                await Navigation.PopAllPopupAsync();
                            }
                            else
                            {
                                DependencyService.Get <IToast>().ShowToast("Their is not any doctor available at this time slot please select another time !");
                                await Navigation.PopAllPopupAsync();
                            }
                        }
                        else
                        {
                            await Navigation.PopAllPopupAsync();

                            DependencyService.Get <IToast>().ShowToast(_result.Message);
                        }
                    }
                    else
                    {
                        DependencyService.Get <IToast>().ShowToast("Please Select a Valid Illness from the Illness Autosuggestion!");
                        await Navigation.PopAllPopupAsync();
                    }
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IToast>().ShowToast("Something Went Wrong please try Again or check your Internet Connection!!");
                await Navigation.PopAllPopupAsync();

                var msg = ex.Message;
            }
        }