private async void btnIngresar_click(object sender, EventArgs e) { waitActivityIndicator.IsRunning = true; bntIngresar.IsEnabled = false; try { string input = txtPassword.Text; string encryptedPass; MD5 md5 = MD5.Create(); byte[] inputBytes = Encoding.ASCII.GetBytes(input); byte[] hash = md5.ComputeHash(inputBytes); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); } encryptedPass = sb.ToString(); UseManager manager = new UseManager(); var result = await manager.userLogin(txtUsuario.Text.ToString(), encryptedPass); if (result.Count() > 0) { foreach (var nuser in result) { servidor = nuser.id_servidor; acceso = nuser.id_acceso; usuario = nuser.id; } //await Navigation.PushAsync(new Principal(servidor, acceso, usuario)); await Navigation.PushAsync(new SplashPage(servidor, acceso, usuario)); } else { await DisplayAlert("Error", "Usuario o Contraseña Incorrectos", "Accept", "Cancel"); } } catch (Exception e1) { await DisplayAlert("Error de Conexion", "Conexion al Servidor no alcanzada. Trate de nuevo", "Accept", "Cancel"); Console.WriteLine(e1.Message.ToString()); } waitActivityIndicator.IsRunning = false; bntIngresar.IsEnabled = true; }
private async void info(string mtr) { try { UseManager manager = new UseManager(); var result = await manager.userLogin(mtr); if (result != null) { lst_alumno.ItemsSource = result; } }catch (Exception e1) { } }
public async void ing() { string mtr = txt_matricula.Text; try { UseManager manager = new UseManager(); var result = await manager.userLogin(txt_matricula.Text.ToString()); if (result.Count() > 0) { await Navigation.PushAsync(new InfoAlumno(mtr)); } else { await DisplayAlert("Error", "Matricula No encontrada", "Aceptar"); } } catch (Exception e1) { } }