示例#1
0
        private void btnThoat_Click(object sender, EventArgs e)
        {
            bll.XoaPhieuMuonTam();
            fMainForUser f = new fMainForUser();

            f.FormClosed += new FormClosedEventHandler(fMainForUser);
            f.Show();
            this.Close();
        }
示例#2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            check = true;
            string userName = txtTenDangNhap.Text;
            string pass     = txtMatKhau.Text;
            bool   Pk       = true;

            if (radioAdmin.Checked)
            {
                Pk = true;
            }
            else if (radioUser.Checked)
            {
                Pk = false;
            }
            else
            {
                MessageBox.Show("Hãy chọn quyền đăng nhập.");
                check = false;
            }
            if (check)
            {
                if (bul.GetTableInforLogin(userName, pass, Pk).Rows.Count > 0 && Pk == true)
                {
                    bul.InsertInforLoginTo_TMP_TABLE(userName, pass, Pk);
                    fMainForAdmin f = new fMainForAdmin();
                    txtMatKhau.Clear();
                    txtTenDangNhap.Clear();
                    radioAdmin.Checked = false;
                    radioUser.Checked  = false;
                    f.ShowDialog();
                }
                else if (bul.GetTableInforLogin(userName, pass, Pk).Rows.Count > 0 && Pk == false)
                {
                    bul.InsertInforLoginTo_TMP_TABLE(userName, pass, Pk);
                    fMainForUser f = new fMainForUser();
                    txtMatKhau.Clear();
                    txtTenDangNhap.Clear();
                    radioAdmin.Checked = false;
                    radioUser.Checked  = false;
                    f.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Đăng Nhập không thành công\nXem lại thông tin tài khoản");
                    txtMatKhau.Clear();
                    txtTenDangNhap.Clear();
                    radioAdmin.Checked = false;
                    radioUser.Checked  = false;
                }
            }
        }