コード例 #1
0
        private async Task Updateprofile()
        {
            try
            {
                progressload.IsVisible = true;
                lblprogressstat.Text   = "Saving profile . . .";
                var user = new TBL_Users
                {
                    Id         = user_id,
                    full_name  = fullname,
                    mobile_num = mobilenum,
                    emailadd   = emailadd,
                    password   = password,
                    datereg    = datereg,
                    propic     = $"{_url}/{_imgId}.jpg",
                    picstr     = $"{_imgId}.jpg"
                };
                propic = user.propic;
                picstr = user.picstr;
                await TBL_Users.Update(user);

                progressload.IsVisible = false;
            }
            catch
            {
                progressload.IsVisible = false;
                await Navigation.PushAsync(new NoInternetPage(), true);
            }
        }
コード例 #2
0
        private async void Button_OnClicked(object sender, EventArgs e)
        {
            try
            {
                if (entryfullname.Text == null)
                {
                    await DisplayAlert("Error", "Please Enter your full name!", "Ok");

                    entryfullname.Focus();
                    return;
                }

                if (entrymobile.Text == null)
                {
                    await DisplayAlert("Error", "Please Enter your mobile number!", "Ok");

                    entrymobile.Focus();
                    return;
                }
                progresssave.IsVisible = true;
                lblprogressstat.Text   = "Saving profile . . .";
                var profile = new TBL_Users
                {
                    Id         = user_id,
                    full_name  = entryfullname.Text,
                    mobile_num = entrymobile.Text,
                    emailadd   = emailadd,
                    password   = password,
                    datereg    = datereg,
                    propic     = propic,
                    picstr     = picstr
                };
                fullname = entryfullname.Text;
                await TBL_Users.Update(profile);

                progresssave.IsVisible = false;
                await DisplayAlert("Info", "Profile information updated!", "Ok");

                await Navigation.PopAsync(true);
            }
            catch
            {
                progresssave.IsVisible = false;
                await Navigation.PushAsync(new NoInternetPage(), true);
            }
        }
コード例 #3
0
        private async void Button_OnClicked(object sender, EventArgs e)
        {
            try
            {
                var oldpass        = string.IsNullOrEmpty(entreyoldpass.Text);
                var newpass        = string.IsNullOrEmpty(entrynewpass.Text);
                var newpassconfirm = string.IsNullOrEmpty(entrynewpassconfirm.Text);
                if (oldpass || newpass || newpassconfirm)
                {
                    await DisplayAlert("Error", "Please Enter your old password and confirm your new password!", "OK");

                    return;
                }
                if (entrynewpass.Text != entrynewpassconfirm.Text)
                {
                    await DisplayAlert("Confirm password", "New Password did not match!", "OK");

                    return;
                }

                progresssave.IsVisible = true;
                lblstat.Text           = "Saving. . .";
                var users = (await MobileService.GetTable <TBL_Users>().Where(usr => usr.emailadd == lblemail.Text).ToListAsync()).FirstOrDefault();
                if (users == null)
                {
                    return;
                }
                if (users.password == entreyoldpass.Text)
                {
                    var newusersecurity = new TBL_Users
                    {
                        Id         = user_id,
                        full_name  = fullname,
                        mobile_num = mobilenum,
                        emailadd   = emailadd,
                        password   = entrynewpassconfirm.Text,
                        datereg    = datereg,
                        propic     = propic,
                        picstr     = picstr
                    };
                    await TBL_Users.Update(newusersecurity);

                    progresssave.IsVisible = false;
                    await DisplayAlert("Info", "Security setting saved!", "OK");

                    await Navigation.PopAsync(true);
                }
                else
                {
                    progresssave.IsVisible = false;
                    await DisplayAlert("Error", "Old password is incorrect!", "OK");

                    entreyoldpass.Focus();
                }
            }
            catch
            {
                progresssave.IsVisible = false;
                await Navigation.PushAsync(new NoInternetPage(), true);
            }
        }