private async void SelectMenu() { App.Master.IsPresented = false; var vistaPrincipal = VistaPrincipal.GetInstancia(); switch (this.Pagina) { case "DescuentoPage": await App.Navigator.PushAsync(new DescuentoPage()); break; /*case "SetupPage": * await App.Navigator.PushAsync(new SetupPage()); * break;*/ /* case "ProfilePage": * vistaPrincipal.Profile = new ProfileViewModel(); * await App.Navigator.PushAsync(new ProfilePage()); * break;*/ default: //Settings.User = string.Empty; Settings.IsRemembered = false; // Settings.Token = string.Empty; // Settings.UserEmail = string.Empty; // Settings.UserPassword = string.Empty; VistaPrincipal.GetInstancia().Login = new LoginVModelo(); Application.Current.MainPage = new NavigationPage(new LoginPage()); break; } }
private async void Login() { this.IsRunning = true; this.IsEnabled = false; if (String.IsNullOrEmpty(this.Email)) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su email", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Password)) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su contraseña", "Aceptar"); return; } try { Usuario u = await apiServicio.listaUsuario(this.Email, this.Password); if (u != null) { Settings.IsRemembered = this.Recordar; VistaPrincipal.GetInstancia().Categorias = new CategoriasVModel(); await Application.Current.MainPage.Navigation.PushAsync(new CategoriasPage()); } else { if (u == null) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Email y/o Contraseña Incorrectos ", "Aceptar"); } } } catch (Exception e) { Console.WriteLine("HUBO UNA EXCEPTION EN INICIO DE SESIÓN: " + e.Message); } }
private async void Guardar() { this.IsRunning = true; this.IsEnabled = false; if (string.IsNullOrEmpty(this.Nombre)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Nombre", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Apellido)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Apellido", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Contraseña)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Contraseña", "Aceptar"); return; } if (this.Contraseña.Length < 6) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar como minimo 6 caracteres", "Aceptar"); return; } if (string.IsNullOrEmpty(this.ConfirmarContraseña)) { await Application.Current.MainPage.DisplayAlert( "Error", "La contraseña debe ser igual a la anterior", "Aceptar"); return; } if (!this.Contraseña.Equals(this.ConfirmarContraseña)) { await Application.Current.MainPage.DisplayAlert( "Error", "La contraseña no coinsiden", "Aceptar"); return; } if (string.IsNullOrEmpty(this.PaisOrigen)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su País de Origen", "Aceptar"); return; } if (string.IsNullOrEmpty(this.CiudadOrigen)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Ciudad de Origen", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Nacionalidad)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Nacionalidad", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Email)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su Email", "Aceptar"); return; } if (!RegexHelper.IsValidEmailAddress(this.Email)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar un correo verdadero", "Aceptar"); return; } var DatosUsu = new Usuario { nombreU = Nombre, apellidoU = Apellido, passwordU = Contraseña, paisOrigen = PaisOrigen, ciudadOrigen = CiudadOrigen, nacionalidad = Nacionalidad, email = Email, }; try { var connection = await this.apiServicio.ValidacionInternet(); if (!connection.respExitosa) { this.IsRunning = false; await Application.Current.MainPage.DisplayAlert("Error", connection.mensaje, "Aceptar"); return; } Usuario usua = await apiServicio.listaUsu(this.Email); if (usua != null) { this.IsRunning = false; this.isEnabled = true; await Application.Current.MainPage.DisplayAlert( "Email Existente", "Este email ya esta en uso", "Aceptar"); } else { if (usua == null) { await apiServicio.InsertarRegistro(DatosUsu); await Application.Current.MainPage.DisplayAlert( "Mensaje ", "Usuario registrado exitosamente", "Aceptar"); this.IsRunning = false; this.isEnabled = true; VistaPrincipal.GetInstancia().Login = new LoginVModelo(); await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); } } } catch (Exception e) { Console.WriteLine("HUBO UNA EXCEPTION EN registro de usuario: " + e.Message); } } //Cierre metodo Guardar
private async void Login() { this.IsRunning = true; this.IsEnabled = false; if (String.IsNullOrEmpty(this.Email)) { //this.IsRunning = false; //this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su email", "Aceptar"); return; } if (string.IsNullOrEmpty(this.Password)) { // this.IsRunning = false; //this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su contraseña", "Aceptar"); return; } try { var connection = await this.apiServicio.ValidacionInternet(); if (!connection.respExitosa) { this.IsRunning = false; await Application.Current.MainPage.DisplayAlert("Error", connection.mensaje, "Aceptar"); return; } Usuario u = await apiServicio.listaUsuario(this.Email, this.Password); if (u != null) { await Application.Current.MainPage.DisplayAlert( "Correcto", "Bienvenido", "Aceptar"); Settings.IsRemembered = this.Recordar; VistaPrincipal.GetInstancia().Categorias = new CategoriasVModel(); Application.Current.MainPage = new MasterPage(); this.IsRunning = false; this.IsEnabled = true; } else { if (u == null) { //this.IsRunning = false; //this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert( "Error", "Email y/o Contraseña Incorrectos ", "Aceptar"); } } } catch (Exception e) { Console.WriteLine("HUBO UNA EXCEPTION EN INICIO DE SESIÓN: " + e.Message); } }
private async void RecuperarClave() { VistaPrincipal.GetInstancia().Recuperacion = new RecuperarClaveVModelo(); await Application.Current.MainPage.Navigation.PushAsync(new RecuperarClavePage()); }
private async void IrRegistro() { VistaPrincipal.GetInstancia().Registros = new RegistroVModel(); await Application.Current.MainPage.Navigation.PushAsync(new RegisterPage()); }
private async void IrCategoria() { VistaPrincipal.GetInstancia().Entidades = new EntidadesVModelo(this); await App.Navigator.PushAsync(new EntidadesPage()); }
private void Cerrar() { Settings.IsRemembered = false; VistaPrincipal.GetInstancia().Login = new LoginVModelo(); Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); }
private async void IrDetalleEntidad() { VistaPrincipal.GetInstancia().detalleEntidad = new DetalleEntidadVModelo(this); await Application.Current.MainPage.Navigation.PushAsync(new DetalleEntidadPage()); }
private async void IrDetalleDireccion() { VistaPrincipal.GetInstancia().detalleDireccion = new DetalleDireccionVModelo(this); await App.Navigator.PushAsync(new DetalleDireccionPage()); }
private async void Enviar() { this.IsRunning = true; this.IsEnabled = false; if (String.IsNullOrEmpty(this.Email)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar su email", "Aceptar"); return; } if (!RegexHelper.IsValidEmailAddress(this.Email)) { await Application.Current.MainPage.DisplayAlert( "Error", "Debe ingresar un correo verdadero", "Aceptar"); return; } var connection = await this.apiServicios.ValidacionInternet(); if (!connection.respExitosa) { this.IsRunning = false; this.IsEnabled = true; await Application.Current.MainPage.DisplayAlert("Error", connection.mensaje, "Aceptar"); return; } Usuario usua = await apiServicios.listaUsu(this.Email); if (usua != null) { this.IsRunning = false; this.isEnabled = true; var url = "https://api20191121075554.azurewebsites.net/".ToString(); await apiServicios.RecuperarPass(Email, url, "api/RetornoClave", "/enviarClave"); await Application.Current.MainPage.DisplayAlert( "Mensaje", "Se ha enviado un email a su correo con su contraseña", "Aceptar"); VistaPrincipal.GetInstancia().Login = new LoginVModelo(); await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); } else { if (usua == null) { this.IsRunning = false; this.isEnabled = true; await Application.Current.MainPage.DisplayAlert( "Email Erroneo", "Este email no está registrado.", "Aceptar"); } } }
private async void IrCategoria() { VistaPrincipal.GetInstancia().Entidades = new EntidadesVModelo(this); await Application.Current.MainPage.Navigation.PushAsync(new EntidadesPage()); }
private async void IrDetalleEntidad() { VistaPrincipal.GetInstancia().detalleEntidad = new DetalleEntidadVModelo(this); await App.Navigator.PushAsync(new DetalleEntidadPage()); }