コード例 #1
0
        private void txtMaychu_Mk_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                string taikhoan = txtMaychu_Tk.Text;
                string matkhau  = txtMaychu_Mk.Text;

                TaiKhoanDAO.Instance.getTaikhoan = taikhoan;

                if (LoginNhanVien(taikhoan, matkhau))
                {
                    frmMayChu_Main frm = new frmMayChu_Main();
                    this.Hide();
                    frm.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Sai tài khoản hoặc mật khẩu !");
                }

                bool LoginNhanVien(string taikhoann, string matkhauu)
                {
                    return(TaiKhoanDAO.Instance.LoginNhanvien(taikhoan, matkhau));
                }

                txtMaychu_Mk.Text = "";
                txtMaychu_Tk.Text = "";
                txtMaychu_Tk.Focus();
            }
            else
            {
            }
        }
コード例 #2
0
        private void btnMaychu_Dangnhap_Click(object sender, EventArgs e)
        {
            string taikhoan = txtMaychu_Tk.Text;
            string matkhau  = txtMaychu_Mk.Text;

            TaiKhoanDAO.Instance.getTaikhoan = taikhoan;

            if (LoginNhanVien(taikhoan, matkhau))
            {
                txtMaychu_Mk.Text = "";
                txtMaychu_Tk.Text = "";
                frmMayChu_Main frm = new frmMayChu_Main();
                this.Hide();
                frm.ShowDialog();
                this.Show();
            }
            else
            {
                txtMaychu_Mk.Text = "";
                txtMaychu_Tk.Text = "";
                MessageBox.Show("Sai tài khoản hoặc mật khẩu !");
            }

            bool LoginNhanVien(string taikhoann, string matkhauu)
            {
                return(TaiKhoanDAO.Instance.LoginNhanvien(taikhoan, matkhau));
            }
        }