public static List <Usser> getLista() { string sql = "select * from APPUSER"; DataTable dt = ConnectionBD.ExecuteQuery(sql); List <Usser> lista = new List <Usser>(); foreach (DataRow fila in dt.Rows) { Usser u = new Usser(); u.IdUser = Convert.ToInt32(fila[0].ToString()); u.FullName = fila[1].ToString(); u.UserName = fila[2].ToString(); u.Password = fila[3].ToString(); u.UserType = Convert.ToBoolean(fila[4].ToString()); lista.Add(u); } return(lista); }
private void button1_Click(object sender, EventArgs e) { Usser use = (Usser)comboBox1.SelectedItem; try { if (comboBox1.SelectedValue.Equals(textBox1.Text)) { if (use.UserType is true) { Admin admin = new Admin(); admin.Show(); Hide(); } } else { MessageBox.Show("Contraseña incorrecta"); } }catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }
private void textBox1_TextChanged(object sender, EventArgs e) { Usser use = (Usser)comboBox1.SelectedItem; try { if (comboBox1.SelectedValue.Equals(textBox1.Text)) { if (use.UserType is false) { User user = new User(); user.Show(); Hide(); } } else { MessageBox.Show("Contraseña incorrecta"); } }catch (Exception ex) { MessageBox.Show("Ha ocurrido un error"); } }