示例#1
0
文件: Login.cs 项目: Jazzel/LMS
        private void login_btn_Click(object sender, EventArgs e)
        {
            USER userData  = data.USERS.Where(find => find.USERNAME == username_txt.Text && find.PASSWORD == password_txt.Text).FirstOrDefault();
            USER userData1 = data.USERS.Where(find => find.EMAIL == username_txt.Text && find.PASSWORD == password_txt.Text).FirstOrDefault();

            if (userData != null)
            {
                if (userData.ROLE == "admin")
                {
                    MetroMessageBox.Show(this, "Welcome admin " + userData.NAME + " !!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (userData1.ROLE == "admin")
                {
                    MetroMessageBox.Show(this, "Welcome admin " + userData.NAME + " !!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                Admin_Dashboard dash = new Admin_Dashboard();
                this.Hide();
                dash.Show();
            }

            else
            {
                MetroMessageBox.Show(this, "Couldn't find your account !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#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();
 }
 public Book_details(Admin_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }
示例#4
0
 public Order_book(Admin_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }
 public Contact_us_admin(Admin_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }
示例#6
0
 public Add_user_template(Admin_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }
示例#7
0
 public User_list(Admin_Dashboard reference)
 {
     back = reference;
     InitializeComponent();
 }