public void build(string input) { MyStringUtils mySU = new MyStringUtils(); if (validate(input)) { if (input.Length < 401) { input = input.PadRight(401,' '); } try { String[] values = mySU.splitByFixedLengths(input, new int[]{1, 400}); this.resultado = values[0]; if (resultado.Equals("1")) { String[] empresaValues = values[1].Split(FIELD_SEPARATOR_CHAR); this.empresa = new Empresa(); this.empresa.Ruc=empresaValues[0]; this.empresa.Nombre=empresaValues[1]; this.empresa.Telefono=empresaValues[2]; this.empresa.Direccion=empresaValues[3]; this.empresa.Usuario=empresaValues[4]; this.empresa.Password=empresaValues[5]; } } catch (Exception ex) { // Logger.getLogger(AutenticacionEmpresaRS.class.getName()).log(Level.SEVERE, null, ex); Console.Out.WriteLine(ex.ToString()); } } }
private void btnIngresar_Click(object sender, EventArgs e) { String usuario; String password; usuario = txtUsuario.Text; password = txtPass.Text; if (usuario != null && password != null) { empresa = Comunicacion.retrieveEmpresa(usuario, password); if (empresa != null) { MessageBox.Show("Usuario Correcto"); PaginaPrincipal paginaPrincipal = PaginaPrincipal.Instance; paginaPrincipal.Show(); this.Hide(); } else { MessageBox.Show("El Usuario es incorrecto"); } } }