示例#1
0
        private async void OnbtnChangeAddress(object sender, EventArgs e)
        {
            var AddLine1  = txtAddress1.Text;
            var AddLine2  = txtAddress2.Text;
            var CityTown  = txtCityTown.Text;
            var StateArea = txtStateArea.Text;
            var PostCode  = txtPostcode.Text;
            var Country   = ddlCountry.Items[ddlCountry.SelectedIndex];

            string Status = "Fail";
            string Msg    = "Technical Error";

            if (AddLine1 == "")
            {
                await DisplayAlert("Validation Error", "Address Line 1 cannot be blank", "Re-try");

                return;
            }

            if (CityTown == "")
            {
                await DisplayAlert("Validation Error", "City / Town cannot be blank", "Re-try");

                return;
            }

            //if (Country == "")
            //{
            //    await DisplayAlert("Validation Error", "Country cannot be blank", "Re-try");
            //    return;
            //}

            dsLogin = new F4HApp.dataservice.DSLogin();
            string result = await dsLogin.UpdateMemberDetails(App.MemberID, AddLine1, AddLine2, "", CityTown, StateArea, PostCode, Country);

            RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", ""));

            Status = m.Status.ToString();
            Msg    = m.Msg;


            if (Status == "Success")
            {
                await DisplayAlert("Food4Health", "Contact Address updated successfully", "Done");

                txtAddress1.Text         = "";
                txtAddress2.Text         = "";
                txtCityTown.Text         = "";
                txtStateArea.Text        = "";
                txtPostcode.Text         = "";
                ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf("KENYA");
            }
            else
            {
                await DisplayAlert("Food4Health Error", "Technical Error", "Re-try");
            }
        }