コード例 #1
0
ファイル: Form_Login.cs プロジェクト: tiendat07/QuanLyNhaHang
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            string tenDN   = txtUsername.Text;
            string matkhau = txtPassword.Text;

            if (string.IsNullOrEmpty(tenDN) || string.IsNullOrEmpty(matkhau))
            {
                MessageBox.Show("Please insert your username and password correctly");
            }
            else
            {
                if (employeeBLL.CheckLogin(tenDN, matkhau) == true)
                {
                    bool            isAdmin    = employeeBLL.CheckAdmin(tenDN);
                    int             employeeID = employeeBLL.GetEmployeeID(tenDN);
                    Employee        employ     = employeeBLL.FindEmployee(employeeID);
                    Form_Restaurant f          = new Form_Restaurant(isAdmin, employeeID);
                    this.Hide();
                    f.Closed += (s, args) => this.Close();
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Incorrect. Please try again !!");
                }
            }
        }