//get postal code data
        async void bindChangePostalCodeData()
        {
            try
            {
                if (!CommonLib.checkconnection())

                {
                    //await DisplayAlert("", "Check your internet connection.", "Okay");

                    VoteAlertPopup.textmsg = Resx.AppResources.checkInternet;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                    return;
                }


                await Navigation.PushPopupAsync(new LoadPopup());

                // fetching detail from uder input

                string newPostalCode = newPostalCodeEntry.Text;



                var result = await CommonLib.ChangePostalCode(CommonLib.ws_MainUrl + "UpdatePostalCode?" + "Id=" + LoginDetails.userId + "&newCode=" + newPostalCode + "");

                if (result != null && result.Status != 0)
                {
                    if (LoginDetails.sessionId == result.SessionId)
                    {
                        VoteAlertPopup.textmsg = Resx.AppResources.Postalcodeupdated;
                        await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());
                    }

                    else
                    {
                        LoadPopup.CloseAllPopup();

                        VoteAlertPopup.textmsg = Resx.AppResources.yourSession;
                        await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                        App.Current.MainPage = new Views.LogInPage();
                    }
                }
                else
                {
                    LoadPopup.CloseAllPopup();
                    //await App.Current.MainPage.DisplayAlert("", result.msg, "ok");
                    VoteAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());
                }
            }
            catch (Exception ex)
            {
                LoadPopup.CloseAllPopup();
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
            finally
            {
            }
        }
示例#2
0
        private async void submitButton_Clicked(object sender, EventArgs e)
        {
            //Validation Part
            string msg = string.Empty;

            string birthOfYear = txtCreateNwAccnDOB.Text;

            string postalCode = txtCreateNwAccnPostalCode.Text;



            if (string.IsNullOrEmpty(postalCode))
            {
                msg = Resx.AppResources.validPostalCode + Environment.NewLine;
            }

            else
            {
                if (postalCode.Length < 5 || postalCode.Length > 5)
                {
                    msg = Resx.AppResources.postalcodefivedigit + Environment.NewLine;
                }
                else
                {
                    try
                    {
                        if (!CommonLib.checkconnection())
                        {
                            await App.Current.MainPage.DisplayAlert("", Resx.AppResources.checkInternet, "OK");

                            return;
                        }
                        await Navigation.PushPopupAsync(new LoadPopup());

                        string postData = "postalCode=" + postalCode;
                        var    result   = await CommonLib.GetProvince(CommonLib.ws_MainUrl + "GetProvinceName?" + postData);

                        if (result.Status == 1)
                        {
                            LoadPopup.CloseAllPopup3();
                        }
                        else
                        {
                            LoadPopup.CloseAllPopup3();
                            msg = Resx.AppResources.validPostalCode + Environment.NewLine;
                        }
                    }
                    catch (Exception ex)
                    {
                        LoadPopup.CloseAllPopup3();
                        await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
                    }
                }
            }
            if (string.IsNullOrEmpty(birthOfYear))
            {
                msg = Resx.AppResources.selectBirthYear + Environment.NewLine;
            }
            if (string.IsNullOrEmpty(genderType))
            {
                msg = Resx.AppResources.pleaseselectgender + Environment.NewLine;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                await App.Current.MainPage.DisplayAlert("", msg, "OK");

                return;
            }
            try
            {
                await Navigation.PushPopupAsync(new LoadPopup());

                var result = await CommonLib.ChangePostalCode(CommonLib.ws_MainUrl + "UpdateDobAndPostal?" + "Id=" + LoginDetails.userId + "&Code=" + postalCode + "&Dob=" + birthOfYear + "&gender=" + genderType);

                if (result.Status != 0)
                {
                    await App.Current.MainPage.DisplayAlert("", Resx.AppResources.Sucess, "OK");

                    LoadPopup.CloseAllPopup();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
        }