private void btn_cansel_Click(object sender, EventArgs e) { Hide(); var form = new Coordinator_Menu(); form.Show(); }
private void btn_login_Click(object sender, EventArgs e) { var conect = new SqlConnection(connection); try { conect.Open(); string sql = $"select [User].Email,[User].Password,[User].RoleId from [User] where ([User].Email = '{tb_email.Text}' )"; var adapter = new SqlDataAdapter(sql, conect); var ds = new DataSet(); adapter.Fill(ds); var row = ds.Tables[0].Rows[0].ItemArray; if (tb_password.Text == row[1].ToString()) { if (row[2].ToString() == "R") { var form = new Runner_Menu(tb_email.Text); form.Show(); this.Hide(); } if (row[2].ToString() == "A") { var form = new Coordinator_Menu(); form.Show(); this.Hide(); } if (row[2].ToString() == "C") { var form = new Administrator_Menu(); form.Show(); this.Hide(); } } } catch (Exception Error) { MessageBox.Show(Error.Message); } finally { conect.Close(); } }