private void button1_Click(object sender, EventArgs e) { string newNombre = this.newNombre.Text; string newContrasena = this.newContrasena.Text; int newtipo = this.tipoUsuario.SelectedIndex; Usuario newUsuario = new Usuario(); newUsuario.UserName = newNombre; newUsuario.Pass = newContrasena; newUsuario.Tipo = newtipo; Service1Client try1 = new Practica2.ServiceReference4.Service1Client(); int resultado = try1.crearUsuario(newUsuario); if (resultado != -1) { MessageBox.Show("Se creo el usuario correctamente"); this.Close(); } else { MessageBox.Show("No se creo el usuario correctamente, vuelva a intentarlo"); } }
private void button1_Click(object sender, EventArgs e) { //Validar usuario string usuario = textBox1.Text; string contrasena = textBox2.Text; Practica2.ServiceReference4.Service1Client try1 = new Practica2.ServiceReference4.Service1Client(); Practica2.ServiceReference4.Usuario returnString; returnString = try1.buscarUsuario(usuario); if (returnString == null) { this.errorLabel.Text = "Usuario Invalido"; this.errorLabel.Visible = true; } else { if (returnString.Pass == contrasena) { this.logged = 1; this.usuarioActual = returnString; this.Close(); } else { this.errorLabel.Text = "Contraseña Invalida"; this.errorLabel.Visible = true; } } /*foreach(Usuario u in listaUsuarios) * { * if (u.pass == contrasena && u.user == usuario) * { * this.logged = 1; * this.usuarioActual = u; * this.Close(); * break; * * } * }*/ if (this.logged == 0) { this.errorLabel.Text = "Data Incorrecta"; this.errorLabel.Visible = true; } }
private void button1_Click(object sender, EventArgs e) { //Validar usuario string usuario = textBox1.Text; string contrasena = textBox2.Text; Practica2.ServiceReference4.Service1Client try1 =new Practica2.ServiceReference4.Service1Client(); Practica2.ServiceReference4.Usuario returnString; returnString = try1.buscarUsuario(usuario); if (returnString == null) { this.errorLabel.Text = "Usuario Invalido"; this.errorLabel.Visible = true; } else { if (returnString.Pass == contrasena) { this.logged = 1; this.usuarioActual = returnString; this.Close(); } else { this.errorLabel.Text = "Contraseña Invalida"; this.errorLabel.Visible = true; } } /*foreach(Usuario u in listaUsuarios) { if (u.pass == contrasena && u.user == usuario) { this.logged = 1; this.usuarioActual = u; this.Close(); break; } }*/ if (this.logged == 0) { this.errorLabel.Text = "Data Incorrecta"; this.errorLabel.Visible = true; } }