private void btnCapNhat_Click(object sender, EventArgs e)
        {
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.Id          = int.Parse(txtMa.Text);
            nms.HoTen       = txtTen.Text;
            nms.NamSinh     = int.Parse(txtNamSinh.Text);
            nms.SoDienThoai = txtSoDienThoai.Text;
            nms.DiaChi      = txtDiaChi.Text;
            nms.Email       = txtEmail.Text;
            NguoiMuonSachBLL nmsbll     = new NguoiMuonSachBLL();
            bool             capnhatnms = nmsbll.CapNhatDocGia(nms);

            QuanTriVien qtv = new QuanTriVien();

            qtv.DiaChi      = txtDiaChi.Text;
            qtv.Email       = txtEmail.Text;
            qtv.ID          = int.Parse(txtMa.Text);
            qtv.NamSinh     = int.Parse(txtNamSinh.Text);
            qtv.SoDienThoai = txtSoDienThoai.Text;
            qtv.HoTen       = txtTen.Text;
            QuanTriVienBLL qtvbll     = new QuanTriVienBLL();
            bool           capnhatqtv = qtvbll.ChinhSuaQuanTriVien(qtv);


            if (capnhatnms && capnhatqtv)
            {
                MessageBox.Show("Đã Thay Đổi Thành Công, Nhấn Cập Nhật Nhé ...", "Thông Báo");
                this.Close();
            }
        }
        private void HienThiPhieuUSer()
        {
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.Id = int.Parse(this.iddg);
            NguoiMuonSachBLL     nmsbll    = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach = nmsbll.TimNguoiMuonTheoMa(nms);

            foreach (NguoiMuonSach tennms in dsngmsach)
            {
                this.ten = tennms.HoTen;
            }
            PhieuMuonSachDAO pms = new PhieuMuonSachDAO();

            pms.TenNguoiMuonSach = ten;
            PhieuMuonSachBLL        pmsdgbll = new PhieuMuonSachBLL();
            List <PhieuMuonSachDAO> dsphieu  = pmsdgbll.PhieuCuaDG(pms);

            lvPhieuMuonUser.Items.Clear();
            foreach (PhieuMuonSachDAO ctpms in dsphieu)
            {
                ListViewItem lvi = new ListViewItem(ctpms.MaPhieuMuon + "");
                lvi.SubItems.Add(ctpms.TenSach);
                lvi.SubItems.Add(ctpms.TrangThai);
                lvi.SubItems.Add(ctpms.NgayMuon.ToString());
                lvi.SubItems.Add(ctpms.NgayDuKienTra.ToString());
                lvi.SubItems.Add(ctpms.NgayTraSach.ToString());
                lvPhieuMuonUser.Items.Add(lvi);
            }
        }
示例#3
0
        private void ThemMoiDG()
        {
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen       = txtTen.Text;
            nms.NamSinh     = int.Parse(txtNamSinh.Text);
            nms.SoDienThoai = txtSoDienThoai.Text;
            nms.DiaChi      = txtDiaChi.Text;
            nms.Email       = txtEmail.Text;

            NguoiMuonSachBLL nmsbll = new NguoiMuonSachBLL();
            bool             nmsnew = nmsbll.ThemDocGia(nms);

            QuanTriVien qtv = new QuanTriVien();

            qtv.HoTen       = txtTen.Text;
            qtv.NamSinh     = int.Parse(txtNamSinh.Text);
            qtv.TenDangNhap = txtTenDangNhap.Text;
            qtv.SoDienThoai = txtSoDienThoai.Text;
            qtv.Email       = txtEmail.Text;
            qtv.DiaChi      = txtDiaChi.Text;
            qtv.MatKhau     = txtPass.Text;
            qtv.KeyRestore  = "123";
            qtv.Quyen       = "User";

            QuanTriVienBLL qtvbll = new QuanTriVienBLL();
            bool           qtvnew = qtvbll.ThemQuanTriVien(qtv);

            if (nmsnew && qtvnew)
            {
                MessageBox.Show("Nhấn Nút Cập Nhật Nhé.", "Thông Báo");
                this.Close();
            }
        }
        private void btnTimMa_Click(object sender, EventArgs e)
        {
            errorTimMa.SetError(txtTimMa, "");
            if (txtTimMa.Text == "")
            {
                errorTimMa.SetError(txtTimMa, "Vui lòng nhập mã càn tìm");
                return;
            }
            errorIntTimMa.SetError(txtTimMa, "");
            if (!txtTimMa.Text.All(char.IsDigit))
            {
                errorTimMa.SetError(txtTimMa, "Mã là số");
                return;
            }
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.Id = int.Parse(txtTimMa.Text);

            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.TimNguoiMuonTheoMa(nms);

            lvNguoiMuonSachDS.Items.Clear();
            foreach (NguoiMuonSach nmsbll in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nmsbll.Id + "");
                lvi.SubItems.Add(nmsbll.HoTen);
                lvi.SubItems.Add(nmsbll.SoDienThoai);
                //lvi.SubItems.Add(nms.BieuHien);
                lvi.SubItems.Add(nmsbll.DiaChi);
                lvi.SubItems.Add(nmsbll.Email);
                lvi.SubItems.Add(nmsbll.NamSinh + "");
                lvNguoiMuonSachDS.Items.Add(lvi);
            }
        }
        private void DangKyUser()
        {
            QuanTriVien qtvien = new QuanTriVien();

            qtvien.HoTen       = txtTen.Text;
            qtvien.NamSinh     = int.Parse(txtNamSinh.Text);
            qtvien.TenDangNhap = txtTenDangNhap.Text;
            qtvien.SoDienThoai = txtSoDienThoai.Text;
            qtvien.Email       = txtEmail.Text;
            qtvien.DiaChi      = txtDiaChi.Text;
            qtvien.MatKhau     = txtMatKhau1.Text;
            qtvien.KeyRestore  = "resetpassword";
            qtvien.Quyen       = "User";

            QuanTriVienBLL qtvbbl    = new QuanTriVienBLL();
            bool           qtvienbll = qtvbbl.DangKy(qtvien);

            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen       = txtTen.Text;
            nms.SoDienThoai = txtSoDienThoai.Text;
            nms.DiaChi      = txtDiaChi.Text;
            nms.Email       = txtEmail.Text;
            nms.NamSinh     = int.Parse(txtNamSinh.Text);

            NguoiMuonSachBLL nmsbll = new NguoiMuonSachBLL();
            bool             nmsnew = nmsbll.ThemDocGia(nms);

            if (qtvienbll && nmsnew)
            {
                MessageBox.Show("Đăng Ký Thành Công", "Thông Báo");
                this.Close();
            }
        }
        private void btnTimTen_Click(object sender, EventArgs e)
        {
            errorTimTen.SetError(txtTimMa, "");
            if (txtTimTen.Text == "")
            {
                errorTimTen.SetError(txtTimTen, "Vui lòng nhập tên càn tìm");
                return;
            }
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen = txtTimTen.Text;

            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.TimTenNguoiMuon(nms);

            lvNguoiMuonSachDS.Items.Clear();
            foreach (NguoiMuonSach nmsbll in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nmsbll.Id + "");
                lvi.SubItems.Add(nmsbll.HoTen);
                lvi.SubItems.Add(nmsbll.SoDienThoai);
                //lvi.SubItems.Add(nms.BieuHien);
                lvi.SubItems.Add(nmsbll.DiaChi);
                lvi.SubItems.Add(nmsbll.Email);
                lvi.SubItems.Add(nmsbll.NamSinh + "");
                lvNguoiMuonSachDS.Items.Add(lvi);
            }
        }
示例#7
0
        private void btnTimTenDocGia_Click(object sender, EventArgs e)
        {
            /*errorTimDocGia.SetError(txtTimTenNMS, "");
             * if(txtTimTenNMS.Text=="")
             * {
             *  errorTimDocGia.SetError(txtTimTenNMS, "Nhập Tên Đọc Giả Cần Tìm");
             *  return;
             * }
             */

            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen = txtTimTenNMS.Text;

            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.TimTenNguoiMuon(nms);

            lvPMSTDocGia.Items.Clear();
            foreach (NguoiMuonSach nmsbll in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nmsbll.Id + "");
                lvi.SubItems.Add(nmsbll.HoTen);

                lvPMSTDocGia.Items.Add(lvi);
            }
        }
        private void HienThiDSDocGia()
        {
            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.LayToanBoNguoiMuonSach();

            lvCMTCDSDG.Items.Clear();
            foreach (NguoiMuonSach nms in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nms.Id + "");
                lvi.SubItems.Add(nms.HoTen);
                lvCMTCDSDG.Items.Add(lvi);
            }
        }
        // End tab chờ đọc giả nhận sách

        // Start tab cho đọc giả mượn tại chỗ
        private void btnCMTCTimTenDG_Click(object sender, EventArgs e)
        {
            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen = txtCMTCTimTenDG.Text;

            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.TimTenNguoiMuon(nms);

            lvCMTCDSDG.Items.Clear();
            foreach (NguoiMuonSach nmsbll in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nmsbll.Id + "");
                lvi.SubItems.Add(nmsbll.HoTen);
                lvCMTCDSDG.Items.Add(lvi);
            }
        }
        private void HienThiNguoiMuonSachDS()
        {
            NguoiMuonSachBLL     ngmsachbll = new NguoiMuonSachBLL();
            List <NguoiMuonSach> dsngmsach  = ngmsachbll.LayToanBoNguoiMuonSach();

            lvNguoiMuonSachDS.Items.Clear();
            foreach (NguoiMuonSach nms in dsngmsach)
            {
                ListViewItem lvi = new ListViewItem(nms.Id + "");
                lvi.SubItems.Add(nms.HoTen);
                lvi.SubItems.Add(nms.SoDienThoai);
                //lvi.SubItems.Add(nms.BieuHien);
                lvi.SubItems.Add(nms.DiaChi);
                lvi.SubItems.Add(nms.Email);
                lvi.SubItems.Add(nms.NamSinh + "");
                lvNguoiMuonSachDS.Items.Add(lvi);
            }
        }
示例#11
0
        private void ThayDoiThongTin()
        {
            QuanTriVien qtv = new QuanTriVien();

            qtv.TenDangNhap = txtAccount.Text;
            qtv.DiaChi      = txtDiaChi.Text;
            qtv.Email       = txtEmail.Text;
            qtv.ID          = int.Parse(txtMa.Text);
            qtv.NamSinh     = int.Parse(txtNamSinh.Text);
            qtv.SoDienThoai = txtSoDienThoai.Text;
            qtv.HoTen       = txtTen.Text;
            if (txtQuyen.Text == "Thủ Thư")
            {
                this.quyen = "Admin";
            }
            else
            {
                this.quyen = "User";
            }
            qtv.Quyen = this.quyen;

            QuanTriVienBLL qtvbll     = new QuanTriVienBLL();
            bool           capnhatqtv = qtvbll.ChinhSuaQuanTriVien(qtv);

            NguoiMuonSach nms = new NguoiMuonSach();

            nms.Id          = int.Parse(txtMa.Text);
            nms.HoTen       = txtTen.Text;
            nms.NamSinh     = int.Parse(txtNamSinh.Text);
            nms.SoDienThoai = txtSoDienThoai.Text;
            nms.DiaChi      = txtDiaChi.Text;
            nms.Email       = txtEmail.Text;

            NguoiMuonSachBLL nmsbll     = new NguoiMuonSachBLL();
            bool             capnhatnms = nmsbll.CapNhatDocGia(nms);

            if (capnhatqtv && capnhatnms)
            {
                MessageBox.Show("Đã thay đổi thông tin \n Nhấn nút cập nhật nhé.", "Thông Báo");
                this.Close();
            }
        }
        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            errorHoTen.SetError(txtTen, "");
            if (txtTen.Text == "")
            {
                errorHoTen.SetError(txtTen, "Xin Nhập Tên:");
                return;
            }
            errorNamSinh.SetError(txtNamSinh, "");
            if (txtNamSinh.Text == "")
            {
                errorNamSinh.SetError(txtNamSinh, "Xin Nhập Năm Sinh:");
                return;
            }
            errorEmail.SetError(txtAccount, "");
            if (txtAccount.Text == "")
            {
                errorEmail.SetError(txtAccount, "Xin Nhập Tên Đăng Nhập:");
                return;
            }
            errorSoDienThoai.SetError(txtSoDienThoai, "");
            if (txtSoDienThoai.Text == "")
            {
                errorSoDienThoai.SetError(txtSoDienThoai, "Xin Nhập Số Điện Thoại:");
                return;
            }
            errorTenDangNhap.SetError(txtEmail, "");
            if (txtEmail.Text == "")
            {
                errorTenDangNhap.SetError(txtEmail, "Xin Nhập Email:");
                return;
            }
            errorDiaChi.SetError(txtDiaChi, "");
            if (txtDiaChi.Text == "")
            {
                errorDiaChi.SetError(txtDiaChi, "Xin Nhập Địa Chỉ:");
                return;
            }
            errorMatKhau1.SetError(txtMatKhau1, "");
            if (txtMatKhau1.Text == "")
            {
                errorMatKhau1.SetError(txtMatKhau1, "Xin Nhập Mật Khẩu:");
                return;
            }

            /*
             * errorKey1.SetError(txtKey1, "");
             * if (txtKey1.Text == "")
             * {
             *  errorKey1.SetError(txtKey1, "Xin Nhập Key Restore Mật Khẩu:");
             *  return;
             * }*/

            errorQuyen.SetError(txtQuyen, "");
            if (txtQuyen.Text == "")
            {
                errorQuyen.SetError(txtQuyen, "Chọn Quyền Cho Nhân Viên");
                return;
            }
            errorIntNamSinh.SetError(txtNamSinh, "");
            if (!txtNamSinh.Text.All(char.IsDigit))
            {
                errorIntNamSinh.SetError(txtNamSinh, "Năm Sinh Là Số ");
                return;
            }
            QuanTriVien qtv = new QuanTriVien();

            qtv.HoTen       = txtTen.Text;
            qtv.NamSinh     = int.Parse(txtNamSinh.Text);
            qtv.TenDangNhap = txtAccount.Text;
            qtv.SoDienThoai = txtSoDienThoai.Text;
            qtv.Email       = txtEmail.Text;
            qtv.DiaChi      = txtDiaChi.Text;
            qtv.MatKhau     = txtMatKhau1.Text;
            qtv.KeyRestore  = txtKey1.Text;
            qtv.Quyen       = txtQuyen.Text;

            QuanTriVienBLL qtvbll = new QuanTriVienBLL();
            bool           qtvnew = qtvbll.ThemQuanTriVien(qtv);

            NguoiMuonSach nms = new NguoiMuonSach();

            nms.HoTen       = txtTen.Text;
            nms.NamSinh     = int.Parse(txtNamSinh.Text);
            nms.SoDienThoai = txtSoDienThoai.Text;
            nms.DiaChi      = txtDiaChi.Text;
            nms.Email       = txtEmail.Text;

            NguoiMuonSachBLL nmsbll = new NguoiMuonSachBLL();
            bool             nmsnew = nmsbll.ThemDocGia(nms);

            if (qtvnew & nmsnew)
            {
                MessageBox.Show("Thêm Thành Công", "Thông báo");
                this.Close();
            }
        }