private void button4_Click(object sender, EventArgs e) { StudentHome mp = new StudentHome(Convert.ToString(studentID)); this.Hide(); mp.Show(); }
private void button4_Click(object sender, EventArgs e) { StudentHome mp = new StudentHome(sID); this.Hide(); mp.Show(); }
private void button1_Click(object sender, EventArgs e) { // this.Hide(); // Form2 ss = new Form2(); // ss.Show(); try { password = PasswordText.Text.Trim(); // string DecryptedPassword = Decrypt(password); //SqlConnection con = new SqlConnection(@"Data Source=LAPTOP-UDPCMQEF;Initial Catalog=LibraryManagementSystem;Integrated Security=True"); //con.Open(); //string query = "select person_id,email,password,person_type from Person where email= '" + txtusername.Text.Trim() + "'and password = '******'"; // SqlCommand cmd = new SqlCommand(cmdText: ); //DataSet ds = new DataSet(); SqlDataAdapter adp = new SqlDataAdapter(); adp.SelectCommand = new SqlCommand(); adp.SelectCommand = sm.selectData("select person_id,email,password,person_type from Person where email= '" + txtusername.Text.Trim() + "'and password = '******'"); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count == 1) { string status = ""; studentID = dt.Rows[0][0].ToString(); status = dt.Rows[0][3].ToString(); if (status == "admin") { AdminHome adminHome = new AdminHome(); this.Hide(); adminHome.Show(); } else if (status == "Active") { StudentHome mp = new StudentHome(studentID); this.Hide(); mp.Show(); } } else { MessageBox.Show("Check your username and password"); //AdminHome adminHome = new AdminHome(); //this.Hide(); //adminHome.Show(); //MainPage mp = new MainPage(studentID); //this.Hide(); //mp.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }