Example #1
0
        private void FrmDatHang_FormClosing(object sender, FormClosingEventArgs e)
        {
            frmHomeQLDL ch = new frmHomeQLDL();

            this.Hide();
            ch.Show();
        }
Example #2
0
        private void setEvents()
        {
            this.btnExit.Click += (sender, e) =>
            {
                if (MessageBox.Show("Bạn muốn thoát phần mềm?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    this.Close();
                }
            };

            this.btnLogin.Click += (sender, e) =>
            {
                string username = txtUsername.Text;
                string password = txtPassword.Text;

                int statusCode = TaiKhoanServices.GetLoginStatus(username, password);

                if (statusCode == 0)
                {
                    Program.NhanVienObj = NhanVienServices.GetNhanVienDangNhap(username);

                    this.Hide();

                    frmHomeQLDL frmHomeQLDLObj = new frmHomeQLDL();
                    frmHomeQLDLObj.Show();
                }
                else
                {
                    MessageBox.Show("Đăng nhập thất bại, kiểm tra lại tài khoản, mật khẩu, hoặc kết nối!");
                }
            };
        }