private async void UpdateEditProfile() { if (CrossConnectivity.Current.IsConnected) { IsBusy = true; if (SelectedFile != null) { UploadImage(); } await UserHandler.UpdateProfile(_userProfile, (responseUpdateProfile) => { Debug.WriteLine("Success" + responseUpdateProfile.ResponseCode); NavigationHandler.GlobalNavigator.Navigation.PopAsync(); MessagingCenter.Send <ProfileViewModel>(this, "UpdateProfile"); IsBusy = false; }, (errorReponseUpdateProfile) => { NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.UpdateUnSuccess, Constants.OK_TEXT); IsBusy = false; }); } else { NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT); } }
private async void UpdateProfile() { if (IsValidPassword()) { _userProfile.PersonalInfo.Password = Password; App.Password = Password; if (SelectedFile != null) { UploadImage(); } if (CrossConnectivity.Current.IsConnected) { IsBusy = true; await UserHandler.UpdateProfile(_userProfile, (responseUpdateProfile) => { Debug.WriteLine("success in update profile page after passweord"); Debug.WriteLine("Success" + responseUpdateProfile.ResponseCode); App.CurrentApplication.GlobalViewModel = new MotherViewModel(); NavigationHandler.GlobalNavigator.Navigation.PopModalAsync(); IsBusy = false; }, (errorReponseUpdateProfile) => { NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.UpdateUnSuccess, Constants.OK_TEXT); IsBusy = false; }); } else { NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT); } } else { if (string.IsNullOrEmpty(Password) && string.IsNullOrEmpty(ConfirmPassword)) { ErrorColor = Color.Red; ValidColor = Color.Red; } else if (string.IsNullOrEmpty(Password)) { ValidColor = Color.Red; } else if (string.IsNullOrEmpty(ConfirmPassword)) { ErrorColor = Color.Red; } else { ValidColor = Color.FromRgb(97, 97, 97); ErrorColor = Color.FromRgb(97, 97, 97); } NavigationHandler.LoginNavigator.DisplayAlert(Constants.APP_NAME, Constants.PASSWORD_MISMATCH, Constants.OK_TEXT); } }
private async void UpdatePassword() { if (!string.IsNullOrEmpty(this.OldPassword) && this.OldPassword.Equals(App.Password)) { // if (!string.IsNullOrEmpty (this.OldPassword)){ if (Validator.IsPasswordMatch(Password, ConfirmPassword)) { this._userProfile.PersonalInfo.Password = Password; if (CrossConnectivity.Current.IsConnected) { IsBusy = true; await UserHandler.UpdateProfile(_userProfile, (responseUpdateProfile) => { Debug.WriteLine("Success" + responseUpdateProfile.ResponseCode); NavigationHandler.GlobalNavigator.Navigation.PopAsync(); IsBusy = false; }, (errorReponseUpdateProfile) => { NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.UpdateUnSuccess, Constants.OK_TEXT); IsBusy = false; }); } else { NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT); } } else { if (Validator.IsPasswordMatch(Password, ConfirmPassword)) { ErrorColor = Color.Red; ValidColor = Color.Red; } else if (string.IsNullOrEmpty(Password)) { ValidColor = Color.Red; } else if (string.IsNullOrEmpty(ConfirmPassword)) { ErrorColor = Color.Red; } else { ValidColor = Color.FromRgb(97, 97, 97); ErrorColor = Color.FromRgb(97, 97, 97); } NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.PASSWORD_MISMATCH, Constants.OK_TEXT); } } else { NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.OLD_PASSWORD_MISMATCH, Constants.OK_TEXT); } }