private void loginbtn_Click(object sender, EventArgs e) { if (usercmbx.SelectedValue.Equals(passwordtxt.Text)) { appusers u = (appusers)usercmbx.SelectedItem; if (u.usertype.Equals(true)) { MessageBox.Show("welcome!", "administrator", MessageBoxButtons.OK, MessageBoxIcon.Information); mainA ventana = new mainA(username); ventana.Show(); this.Hide(); } else { MessageBox.Show("welcome!", "user", MessageBoxButtons.OK, MessageBoxIcon.Information); username = u.username; mainB ventana = new mainB(username); ventana.Show(); this.Hide(); } } else { MessageBox.Show("wrong password", "HugoApp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public static List <appusers> getList() { string sql = "select * from appuser"; DataTable dt = conexion.makeconsult(sql); List <appusers> lista = new List <appusers>(); foreach (DataRow fila in dt.Rows) { appusers u = new appusers(); 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); }