Beispiel #1
0
        private void FrmQLNV_FormClosing(object sender, FormClosingEventArgs e)
        {
            frmHomeQLTT settingsForm = new frmHomeQLTT();

            this.Hide();
            settingsForm.Show();
        }
        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();

                    frmHomeQLTT frmHomeQLTTObj = new frmHomeQLTT();
                    frmHomeQLTTObj.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!");
                }
            };
        }