private async void ValidateUser_Clicked(object sender, EventArgs e) { DataContracts.Model.User pUser = this.BindingContext as DataContracts.Model.User; if (pUser != null && !string.IsNullOrEmpty(pUser.HaciendaUsername) && !string.IsNullOrEmpty(pUser.HaciendaPassword) && pUser.HaciendaCryptographicPIN != null && File != null) { App.ShowLoading(true, "Validando Usuario"); pUser.HaciendaCryptographicFile = File; pUser.HaciendaUserValidation = true; UserValidationRequest vRequest = new UserValidationRequest { User = pUser, SSOT = App.SSOT }; var vClient = new ValidateUserWithHacienda(); var vResponse = await vClient.GetDataAsync(vRequest); var json = JsonConvert.SerializeObject(vRequest); if (vResponse != null) { if (vResponse.IsSuccessful) { DependencyService.Get <Abstraction.DependencyServices.ISharedPreferences>().SaveString(App.ActualUserDBKey, Newtonsoft.Json.JsonConvert.SerializeObject(pUser)); App.ActualUser = pUser; App.ShowLoading(false); await Navigation.PopUpAllModals(); await Toasts.ToastRunner.ShowSuccessToast("", "Validación Exitosa"); } else { App.ShowLoading(false); await DisplayAlert("", vResponse.UserMessage, "Ok"); } } else { App.ShowLoading(false); await DisplayAlert("", "Existe un problema al contactar el servidor. Revise su conexión", "Ok"); } } else { await DisplayAlert("", "Falta un dato por llenar", "Ok"); } }
public HaciendaRegistration(DataContracts.Model.User pClient) { InitializeComponent(); this.BindingContext = pClient; }