private void button1_Click(object sender, EventArgs e) { if (txtbox_pass.Text == txtbox_confpass.Text) { User_db udb = new User_db(); udb.Username = txtbox_Username.Text; udb.Names = txtbox_name.Text; udb.Password = txtbox_pass.Text; udb.Usertype = combobox_usertype.Text; udb.Insertuser(udb); if (txtbox_Username.Text != "" && txtbox_name.Text != "" && txtbox_pass.Text != "") { if (combobox_usertype.Text == "Admin") { mainpage mp = new mainpage(); mp.Show(); } else if (combobox_usertype.Text == "Teacher") { Home hm = new Home(); hm.Show(); } MessageBox.Show("Signup successful!!"); } else { MessageBox.Show("Please fill all the entries....!!!"); } } }
private void btn_login_Click(object sender, EventArgs e) { User_db udb = new User_db(); if (rbtn_admin.Checked) { udb.Usertype = "Admin"; } else if (rbtn_user.Checked) { udb.Usertype = "Teacher"; } udb.Username = txtbox_username.Text; udb.Password = txtbox_password.Text; /* * * if (udb.Username == txtbox_username.Text) * { * if (udb.Password == txtbox_password.Text) * { * * } * } */ if (udb.Authenticated(udb)) { if (rbtn_admin.Checked) { mainpage ud = new mainpage(); ud.Show(); } else if (rbtn_user.Checked) { userdisplay hform = new userdisplay(); hform.Show(); } } else { MessageBox.Show("Something has gone wrong,please fill the entries again!!"); } }