private void btn_back_Click(object sender, EventArgs e)
 {
     if (lg == null)
     {
         back.Show();
     }
     else
     {
         lg.Show();
     }
     this.Close();
 }
Exemplo n.º 2
0
 private void btn_login_Click(object sender, EventArgs e)
 {
     if (txt_user.Text == "admin" && txt_pass.Text == "admin123")
     {
         Admin_Dashboard admin = new Admin_Dashboard(this);
         admin.Show();
         this.Hide();
     }
     else
     {
         sql.Open();
         string username = txt_user.Text.Trim();
         try
         {
             string        query  = "Select Student_Id,Password from [dbo].[student_details] where Student_Id = " + Convert.ToInt64(username);
             SqlCommand    cmd    = new SqlCommand(query, sql);
             SqlDataReader reader = cmd.ExecuteReader();
             reader.Read();
             try
             {
                 if ((reader[0].ToString().Trim() == txt_user.Text) && (reader[1].ToString().Trim() == txt_pass.Text))
                 {
                     User_Dashboard user = new User_Dashboard(this, username);
                     user.Show();
                     this.Hide();
                 }
                 else
                 {
                     MessageBox.Show("Invalid Password");
                 }
             }
             catch
             {
                 MessageBox.Show("Invalid Username");
             }
         }
         catch
         {
             MessageBox.Show("Invalid Username or password");
         }
     }
     sql.Close();
 }
Exemplo n.º 3
0
 private void btn_back_Click(object sender, EventArgs e)
 {
     this.Close();
     back.Show();
 }