コード例 #1
0
        private void btnBackToManager_Click(object sender, EventArgs e)
        {
            TrangChu frm = new TrangChu();

            frm.DangNhapNV(nv);
            frm.WindowState = FormWindowState.Maximized;
            frm.Show();
            this.Close();
        }
コード例 #2
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            if (txtUsername.TextLength <= 0)
            {
                MessageBox.Show(grbTenDangNhap.Text + " không được bỏ trống!");
                txtUsername.Focus();
            }
            else if (txtPassword.TextLength <= 0)
            {
                MessageBox.Show(grbMatKhau.Text + " không được bỏ trống!");
                txtPassword.Focus();
            }

            else
            {
                string user = txtUsername.Text.Trim();
                string pass = txtPassword.Text.Trim();

                int kt = login.ktTaiKhoan(user, pass);
                if (kt == -1)
                {
                    MessageBox.Show("Tài khoản không tồn tại");
                    return;
                }
                else if (kt == 0)
                {
                    MessageBox.Show("Mật khẩu không chính xác");
                    return;
                }
                else
                {
                    DialogResult result;
                    result = MessageBox.Show("Đăng nhập thành công", "Thông báo",
                                             MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    if (result == DialogResult.OK)
                    {
                        NHANVIEN nd = login.layND(user);
                        this.Visible = false;
                        TrangChu frm = new TrangChu();
                        frm.WindowState = FormWindowState.Maximized;
                        frm.DangNhapNV(nd);
                        frm.Show();
                    }
                }
            }
        }