Beispiel #1
0
        private async void _Fund_Clicked(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(_Amount.Text) || !String.IsNullOrEmpty(_Amount.Text))
            {
                Dictionary <int, String[]> Data = new Dictionary <int, string[]>
                {
                    { 0, new String[] { "user_id", Utilities.ID.ToString() } },
                    { 1, new String[] { "amount", _Amount.Text } }
                };

                try
                {
                    String ResponseJson = await TransactionController.FundAccount(Utilities.PostDataEncoder(Data));

                    var DecodedJson = JObject.Parse(ResponseJson);

                    if (Convert.ToBoolean(DecodedJson["status"]))
                    {
                        //return to previous page after user closes the alert dialog
                        await Utilities.CreateAlertDialog("Alert", DecodedJson["message"].ToString(), "Ok", delegate
                        {
                            Navigation.PopAsync();
                        });
                    }
                    else
                    {
                        await DisplayAlert("Alert", DecodedJson["message"].ToString(), "Ok");
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Alert", ex.Message, "Ok");
                }
            }
        }
        private async void _SignUp_Clicked(object sender, EventArgs e)
        {
            Dictionary <int, String[]> KeyValues = new Dictionary <int, string[]>();
            bool IsCompleted = false;

            try
            {
                KeyValues.Add(0, new String[] { "full_name", _FullName.Text });
                KeyValues.Add(1, new String[] { "gender", (_Gender.SelectedItem.Equals("Male")) ? "m" : "f" });
                KeyValues.Add(2, new String[] { "phone", GD.Phone });
                KeyValues.Add(3, new String[] { "address", _HomeAddress.Text });
                KeyValues.Add(4, new String[] { "dob", _DOB.Date.ToString("yyyy-MM-dd") });
                KeyValues.Add(5, new String[] { "password", GD.Password });
                KeyValues.Add(6, new String[] { "username", _Username.Text });
                if (!String.IsNullOrEmpty(GD.Email))
                {
                    KeyValues.Add(7, new String[] { "email", GD.Email });
                }
                KeyValues.Add(8, new String[] { "blood_group", _BloodGroup.SelectedItem.ToString() });
                KeyValues.Add(9, new String[] { "is_medic", "0" });

                IsCompleted = true;
            }
            catch
            {
                await DisplayAlert("Alert", "Please Fill All Fields", "Okay");
            }

            if (IsCompleted)
            {
                FormUrlEncodedContent Data = Utilities.PostDataEncoder(KeyValues);
                try
                {
                    //get the result of the signup 0 = status, 1 = message
                    var Result = await SignUpController.SignUp(Data);

                    if (Convert.ToBoolean(Result[0]))
                    {
                        await Utilities.CreateAlertDialog("Alert", Result[1].ToString(), "Ok", delegate
                        {
                            Navigation.PushAsync(new LoginPage());
                            Navigation.RemovePage(this);
                        });
                    }
                    else
                    {
                        await DisplayAlert("Alert", Result[1].ToString(), "Okay");
                    }
                }
                catch (System.Net.WebException WebEx)
                {
                    await DisplayAlert("Alert", "Unable to connect to the server, Please check the internet connection. ", "Okay");
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Alert", "UPDP Error, Please Contact Admin " + ex.Message, "Okay");
                }
            }
        }
Beispiel #3
0
        private async void _SubmitReview_Clicked(object sender, EventArgs e)
        {
            bool Result = await MedicalPractitionerController.PostReview(_ReviewMessage.Text, StarCounter, MedicID, _Title.Text);

            if (Result)
            {
                await Utilities.CreateAlertDialog("Alert", "Rating submitted.", "Ok", delegate
                {
                    Navigation.PopAsync();
                });
            }
            else
            {
                await DisplayAlert("Alert", "Rating failed to submit.", "Ok");
            }
        }
Beispiel #4
0
        private async void _Submit_Clicked(object sender, EventArgs e)
        {
            bool Saved = await MedicalRecordController.PostMedicalRecords(_RecordContent.Text, _RecordTitle.Text, ID, UserRecordType);

            if (Saved)
            {
                await Utilities.CreateAlertDialog("Alert", "Record Saved", "Ok", delegate
                {
                    Navigation.PopAsync();
                });
            }
            else
            {
                await DisplayAlert("Alert", "Failed to save record.", "Ok");
            }
        }
        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");
            }
        }