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);
            }
        }
        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 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);
            }
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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 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);
            }
        }
        public List <NguoiMuonSach> LayToanBoNguoiMuonSach()

        {
            List <NguoiMuonSach> dsNguoiMuonSach = new List <NguoiMuonSach>();

            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "select * from NguoiMuonSach";
            command.Connection  = conn;
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                int           id          = reader.GetInt32(0);
                string        hoten       = reader.GetString(1);
                string        sodienthoai = reader.GetString(2);
                string        diachi      = reader.GetString(3);
                string        email       = reader.GetString(4);
                int           namsinh     = reader.GetInt32(5);
                NguoiMuonSach nms         = new NguoiMuonSach();
                nms.Id          = id;
                nms.HoTen       = hoten;
                nms.SoDienThoai = sodienthoai;
                nms.DiaChi      = diachi;
                nms.Email       = email;
                nms.NamSinh     = namsinh;
                dsNguoiMuonSach.Add(nms);
            }
            reader.Close();
            CloseConnection();
            return(dsNguoiMuonSach);
        }
        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();
            }
        }
        public bool ThemDocGia(NguoiMuonSach nms)
        {
            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "insert into NguoiMuonSach(HoTen,SoDienThoai,DiaChi,Email,NamSinh)values" +
                                  "(N'" + nms.HoTen + "','" + nms.SoDienThoai + "', N'" + nms.DiaChi + "', '" + nms.Email + "', '" + nms.NamSinh + "')";
            command.Connection = conn;
            int ketqua = command.ExecuteNonQuery();

            return(ketqua > 0);
        }
        public bool CapNhatDocGia(NguoiMuonSach nms)
        {
            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "Update NguoiMuonSach set HoTen=N'" + nms.HoTen + "', SoDienThoai ='" + nms.SoDienThoai + "'," +
                                  " DiaChi =N'" + nms.DiaChi + "', Email='" + nms.Email + "', NamSinh='" + nms.NamSinh + "' where ID='" + nms.Id + "'";
            command.Connection = conn;
            int ketqua = command.ExecuteNonQuery();

            return(ketqua > 0);
        }
        // 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);
            }
        }
Beispiel #12
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();
            }
        }
Beispiel #13
0
 public List <NguoiMuonSach> TimNguoiMuonTheoMa(NguoiMuonSach timten)
 {
     return(nguoimuons.TimNguoiMuonTheoMa(timten));
 }
Beispiel #14
0
 public bool CapNhatDocGia(NguoiMuonSach CapNhatDG)
 {
     return(nguoimuons.CapNhatDocGia(CapNhatDG));
 }
Beispiel #15
0
 public List <NguoiMuonSach> TimTenNguoiMuon(NguoiMuonSach timten)
 {
     return(nguoimuons.TimTenNguoiMuon(timten));
 }
Beispiel #16
0
 public bool ThemDocGia(NguoiMuonSach ThemDG)
 {
     return(nguoimuons.ThemDocGia(ThemDG));
 }
        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();
            }
        }