Exemplo n.º 1
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.º 2
0
 public Book_shelf(User_Dashboard reference, string user_info)
 {
     user = user_info;
     back = reference;
     InitializeComponent();
 }
 public Reset_password(User_Dashboard reference, string user_info)
 {
     user = user_info;
     back = reference;
     InitializeComponent();
 }
 public Contact_us_user(User_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }
 public Wishlist(User_Dashboard reference, string user_name)
 {
     user = user_name;
     back = reference;
     InitializeComponent();
 }
 public Issued_books(User_Dashboard reference, string user_info)
 {
     user = user_info;
     back = reference;
     InitializeComponent();
 }