private void btnEndorse_Click(object sender, EventArgs e) { try { insertEndorsee(); FormHome frmHome = new FormHome(); this.Hide(); frmHome.Show(); } catch (Exception ex) { } }
private void btnLogin_Click(object sender, EventArgs e) { try { conn.Open(); MySqlCommand comm = new MySqlCommand("SELECT * FROM member_tbl WHERE membUsername = '******';", conn); MySqlDataAdapter adp = new MySqlDataAdapter(comm); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count == 1) { user = dt.Rows[0]["membUsername"].ToString(); pass = dt.Rows[0]["membPassword"].ToString(); membertype = int.Parse(dt.Rows[0]["memberType"].ToString()); } if (txtUsername.Text == "" || txtPassword.Text == "") { MessageBox.Show("The user must supply the necessary fields."); } else if (txtUsername.Text == user && txtPassword.Text == pass && membertype <= 2) { FormHome frmhome = new FormHome(); frmhome.reference_to_frmlogin = this; this.Hide(); frmhome.Show(); } else { if (txtUsername.Text != user || txtPassword.Text != pass) { MessageBox.Show("The user credentials are incorrect."); } //else if (accstatus != 0) // MessageBox.Show("The user is inactive."); } conn.Close(); } catch (Exception ex) { conn.Close(); MessageBox.Show(ex.ToString()); } }
private void btnRegister_Click(object sender, EventArgs e) { try { conn.Open(); if (reference_to_frmchooseleader.ifFormChooseLeader()) { MySqlCommand comm = new MySqlCommand("UPDATE member_tbl SET membUsername = '******', " + "membPassword = '******' WHERE memberID = " + "" + reference_to_frmchooseleader.getMemberID() + ";", conn); comm.ExecuteNonQuery(); } else if (reference_to_frmregisternewcomer.ifFormRegisterNewComer()) { MySqlCommand comm = new MySqlCommand("UPDATE member_tbl SET membUsername = '******', " + "membPassword = '******' WHERE memberID = " + "" + reference_to_frmregisternewcomer.getMemberID() + ";", conn); comm.ExecuteNonQuery(); } conn.Close(); } catch (Exception ex) { MySqlCommand comm = new MySqlCommand("UPDATE member_tbl SET membUsername = '******', " + "membPassword = '******' WHERE memberID = " + "" + reference_to_frmregisternewcomer.getMemberID() + ";", conn); comm.ExecuteNonQuery(); //MessageBox.Show(ex.ToString()); } FormHome frmhome = new FormHome(); frmhome.reference_to_frmregisterusepass = this; frmhome.reference_to_frmlogin = reference_to_frmlogin; username = txtUsername.Text; this.Hide(); frmhome.Show(); }