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); } }
private void btnTHTimMaP_Click(object sender, EventArgs e) { if (txtTHTimMaP.Text == "") { HienThiDSTatCaPhieu(); } else { errIntMaPhieu.SetError(txtTHTimMaP, ""); if (!txtTHTimMaP.Text.All(char.IsDigit)) { errIntMaPhieu.SetError(txtTHTimMaP, "Mã Phiếu là số"); return; } PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.MaPhieuMuon = int.Parse(txtTHTimMaP.Text); PhieuMuonSachBLL phieumsBLL = new PhieuMuonSachBLL(); List <PhieuMuonSachDAO> dsphieumuon = phieumsBLL.TimPhieuTheoMa(pms); lvTHDSP.Items.Clear(); foreach (PhieuMuonSachDAO pmsBLL in dsphieumuon) { ListViewItem lvi = new ListViewItem(pmsBLL.MaPhieuMuon + ""); lvi.SubItems.Add(pmsBLL.TenNguoiMuonSach); lvi.SubItems.Add(pmsBLL.TrangThai); lvi.SubItems.Add(pmsBLL.NgayMuon.ToString()); lvi.SubItems.Add(pmsBLL.NgayDuKienTra.ToString()); lvi.SubItems.Add(pmsBLL.NgayTraSach.ToString()); lvi.SubItems.Add(pmsBLL.TenSach); lvTHDSP.Items.Add(lvi); } } LoadText(); }
private void lvNguoiMuonSachDS_SelectedIndexChanged(object sender, EventArgs e) { if (lvNguoiMuonSachDS.SelectedItems.Count > 0) { ListViewItem lvi = lvNguoiMuonSachDS.SelectedItems[0]; string ma = lvi.SubItems[0].Text; string hoten = lvi.SubItems[1].Text; string sodienthoai = lvi.SubItems[2].Text; string diachi = lvi.SubItems[3].Text; string email = lvi.SubItems[4].Text; string namsinh = lvi.SubItems[5].Text; txtNMSMa.Text = ma; TxtNMSTen.Text = hoten; TxtNMSSoDienThoai.Text = sodienthoai; TxtNMSDiaChi.Text = diachi; TxtNMSEmail.Text = email; TxtNMSNamSinh.Text = namsinh; PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.TenNguoiMuonSach = TxtNMSTen.Text; PhieuMuonSachBLL phieumsBLL = new PhieuMuonSachBLL(); List <PhieuMuonSachDAO> dsphieumuon = phieumsBLL.TimPhieuChuaDongTheoTen(pms); lvDSPhieuMuonMo.Items.Clear(); foreach (PhieuMuonSachDAO pmsBLL in dsphieumuon) { ListViewItem lvii = new ListViewItem(pmsBLL.MaPhieuMuon + ""); lvii.SubItems.Add(pmsBLL.NgayMuon.ToString()); lvii.SubItems.Add(pmsBLL.NgayDuKienTra.ToString()); lvDSPhieuMuonMo.Items.Add(lvii); } } }
private void btnTimTheoTen_Click(object sender, EventArgs e) { errorTimTenDocGia.SetError(txtTimPhieuTheoTen, ""); if (txtTimPhieuTheoTen.Text == "") { errorTimTenDocGia.SetError(txtTimPhieuTheoTen, "Nhập Tên Đọc Giả Của Phiếu Cần Tìm"); return; } PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.TenNguoiMuonSach = txtTimPhieuTheoTen.Text; PhieuMuonSachBLL phieumsBLL = new PhieuMuonSachBLL(); List <PhieuMuonSachDAO> dsphieumuon = phieumsBLL.TimPhieuTheoten(pms); lvDSPhieuMuon.Items.Clear(); foreach (PhieuMuonSachDAO pmsBLL in dsphieumuon) { ListViewItem lvi = new ListViewItem(pmsBLL.MaPhieuMuon + ""); lvi.SubItems.Add(pmsBLL.TenNguoiMuonSach); lvi.SubItems.Add(pmsBLL.TenSach); lvi.SubItems.Add(pmsBLL.NgayMuon.ToString()); lvi.SubItems.Add(pmsBLL.NgayDuKienTra.ToString()); lvi.SubItems.Add(pmsBLL.NgayTraSach.ToString()); lvDSPhieuMuon.Items.Add(lvi); } txtTimMaPhieu.Text = ""; }
private void btnTimTheoMa_Click(object sender, EventArgs e) { errorTimMaPhieu.SetError(txtTimMaPhieu, ""); if (txtTimMaPhieu.Text == "") { errorTimMaPhieu.SetError(txtTimMaPhieu, "Nhập Mã Phiếu Muốn Tìm"); return; } errorIntMaPhieu.SetError(txtTimMaPhieu, ""); if (!txtTimMaPhieu.Text.All(char.IsDigit)) { errorIntMaPhieu.SetError(txtTimMaPhieu, "Mã Phiếu là số"); return; } PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.MaPhieuMuon = int.Parse(txtTimMaPhieu.Text); PhieuMuonSachBLL phieumsBLL = new PhieuMuonSachBLL(); List <PhieuMuonSachDAO> dsphieumuon = phieumsBLL.TimPhieuTheoMa(pms); lvDSPhieuMuon.Items.Clear(); foreach (PhieuMuonSachDAO pmsBLL in dsphieumuon) { ListViewItem lvi = new ListViewItem(pmsBLL.MaPhieuMuon + ""); lvi.SubItems.Add(pmsBLL.TenNguoiMuonSach); lvi.SubItems.Add(pmsBLL.TenSach); lvi.SubItems.Add(pmsBLL.NgayMuon.ToString()); lvi.SubItems.Add(pmsBLL.NgayDuKienTra.ToString()); lvi.SubItems.Add(pmsBLL.NgayTraSach.ToString()); lvDSPhieuMuon.Items.Add(lvi); } txtTimPhieuTheoTen.Text = ""; }
private void btnTimThoiGianTao_Click(object sender, EventArgs e) { errorNgay.SetError(txtTimNgay, ""); if (!txtTimNgay.Text.All(char.IsDigit) && txtTimNgay.Text != "") { errorNgay.SetError(txtTimNgay, "Xin Nhập Ngày"); return; } errorNgay.SetError(txtTimNgay, ""); if (txtTimNgay.Text == "") { errorNgay.SetError(txtTimNgay, "Xin Nhập Ngày"); return; } errorThang.SetError(txtTimThang, ""); if (!txtTimThang.Text.All(char.IsDigit) && txtTimThang.Text != "") { errorThang.SetError(txtTimThang, "Xin Nhập Tháng"); return; } errorThang.SetError(txtTimThang, ""); if (txtTimThang.Text == "") { errorThang.SetError(txtTimThang, "Xin Nhập Tháng"); return; } errorNam.SetError(txtTimNam, ""); if (!txtTimNam.Text.All(char.IsDigit) && txtTimNam.Text != "") { errorNam.SetError(txtTimNam, "Xin Nhập Năm"); return; } errorNam.SetError(txtTimNam, ""); if (txtTimNam.Text == "") { errorNam.SetError(txtTimNam, "Xin Nhập Năm"); return; } PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.ngay = int.Parse(txtTimNgay.Text); pms.thang = int.Parse(txtTimThang.Text); pms.nam = int.Parse(txtTimNam.Text); PhieuMuonSachBLL phieumsBLL = new PhieuMuonSachBLL(); List <PhieuMuonSachDAO> dsphieumuon = phieumsBLL.TimphieuTheoNgay(pms); lvDSPhieuMuon.Items.Clear(); foreach (PhieuMuonSachDAO pmsBLL in dsphieumuon) { ListViewItem lvi = new ListViewItem(pmsBLL.MaPhieuMuon + ""); lvi.SubItems.Add(pmsBLL.TenNguoiMuonSach); lvi.SubItems.Add(pmsBLL.TenSach); lvi.SubItems.Add(pmsBLL.NgayMuon.ToString()); lvi.SubItems.Add(pmsBLL.NgayDuKienTra.ToString()); lvi.SubItems.Add(pmsBLL.NgayTraSach.ToString()); lvDSPhieuMuon.Items.Add(lvi); } }
public List <PhieuMuonSachDAO> LayPhieuChoDuyetVaDoiDG() { List <PhieuMuonSachDAO> dsPhieuMuon = new List <PhieuMuonSachDAO>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.CommandText = "select pms.PhieuId, nms.HoTen,s.TenSach,pms.NgayMuon,pms.NgayDuKienTra,pms.NgayTraSach,pms.TrangThai " + "from PhieuMuonSach pms, NguoiMuonSach nms, Sach s " + "where nms.Id = pms.NguoiMuonSachId and s.Id = pms.SachId and pms.TrangThai<>N'Đã Trả Sách' and pms.TrangThai<>N'Sách bị lỗi' " + "and pms.TrangThai<>N'Sách lỗi đã được xử lý' and pms.TrangThai<>N'Đọc giả không đến' and pms.TrangThai<>N'Chưa Trả Sách'" + " ORDER BY pms.PhieuId DESC"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idphieu = reader.GetInt32(0); string tennguoimuon = reader.GetString(1); string tensach = reader.GetString(2); DateTime ngaymuon = reader.GetDateTime(3); DateTime ngaydukientra = reader.GetDateTime(4); DateTime?ngaytra; if (reader.IsDBNull(5)) { ngaytra = (DateTime?)null; } else { ngaytra = reader.GetDateTime(5); } string trangthai = reader.GetString(6); PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.MaPhieuMuon = idphieu; pms.TenNguoiMuonSach = tennguoimuon; pms.TenSach = tensach; pms.NgayMuon = ngaymuon; pms.NgayDuKienTra = ngaydukientra; pms.NgayTraSach = ngaytra; pms.TrangThai = trangthai; dsPhieuMuon.Add(pms); } reader.Close(); CloseConnection(); return(dsPhieuMuon); }
public List <PhieuMuonSachDAO> LayPhieuDangMo() { List <PhieuMuonSachDAO> dsPhieuMuon = new List <PhieuMuonSachDAO>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.CommandText = "SELECT pms.PhieuId,nms.HoTen,s.TenSach,pms.NgayMuon,pms.NgayDuKienTra,pms.NgayTraSach,pms.TrangThai " + "FROM PhieuMuonSach pms, NguoiMuonSach nms, Sach s WHERE pms.NguoiMuonSachId = nms.Id and pms.SachID = s.ID " + "and pms.TrangThai=N'Chưa Trả Sách' ORDER BY pms.PhieuId DESC"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idphieu = reader.GetInt32(0); string tennguoimuon = reader.GetString(1); string tensach = reader.GetString(2); DateTime ngaymuon = reader.GetDateTime(3); DateTime ngaydukientra = reader.GetDateTime(4); DateTime?ngaytra; if (reader.IsDBNull(5)) { ngaytra = (DateTime?)null; } else { ngaytra = reader.GetDateTime(5); } string trangthai = reader.GetString(6); PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.MaPhieuMuon = idphieu; pms.TenNguoiMuonSach = tennguoimuon; pms.TenSach = tensach; pms.NgayMuon = ngaymuon; pms.NgayDuKienTra = ngaydukientra; pms.NgayTraSach = ngaytra; pms.TrangThai = trangthai; dsPhieuMuon.Add(pms); } reader.Close(); CloseConnection(); return(dsPhieuMuon); }
public List <PhieuMuonSachDAO> TimPhieuTheoNgay(PhieuMuonSachDAO pms) { List <PhieuMuonSachDAO> dsPhieuMuon = new List <PhieuMuonSachDAO>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.CommandText = "exec TimPhieuTheoNgay @ngay='" + pms.ngay + "'," + " @thang='" + pms.thang + "', " + "@nam='" + pms.nam + "'"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idphieu = reader.GetInt32(0); string tennguoimuon = reader.GetString(1); string tensach = reader.GetString(2); DateTime ngaymuon = reader.GetDateTime(3); DateTime ngaydukientra = reader.GetDateTime(4); DateTime?ngaytra; if (reader.IsDBNull(5)) { ngaytra = (DateTime?)null; } else { ngaytra = reader.GetDateTime(5); } PhieuMuonSachDAO timpms = new PhieuMuonSachDAO(); timpms.MaPhieuMuon = idphieu; timpms.TenNguoiMuonSach = tennguoimuon; timpms.TenSach = tensach; timpms.NgayMuon = ngaymuon; timpms.NgayDuKienTra = ngaydukientra; timpms.NgayTraSach = ngaytra; dsPhieuMuon.Add(timpms); } reader.Close(); CloseConnection(); return(dsPhieuMuon); }
public List <PhieuMuonSachDAO> TimPhieuTheoMa(PhieuMuonSachDAO pms) { List <PhieuMuonSachDAO> dsPhieuMuon = new List <PhieuMuonSachDAO>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.CommandText = "EXEC TimMaPhieu @maphieu ='" + pms.MaPhieuMuon + "'"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idphieu = reader.GetInt32(0); string tennguoimuon = reader.GetString(1); string tensach = reader.GetString(2); DateTime ngaymuon = reader.GetDateTime(3); DateTime ngaydukientra = reader.GetDateTime(4); DateTime?ngaytra; if (reader.IsDBNull(5)) { ngaytra = (DateTime?)null; } else { ngaytra = reader.GetDateTime(5); } string trangthai = reader.GetString(6); PhieuMuonSachDAO pmsdao = new PhieuMuonSachDAO(); pmsdao.MaPhieuMuon = idphieu; pmsdao.TenNguoiMuonSach = tennguoimuon; pmsdao.TenSach = tensach; pmsdao.NgayMuon = ngaymuon; pmsdao.NgayDuKienTra = ngaydukientra; pmsdao.NgayTraSach = ngaytra; pmsdao.TrangThai = trangthai; dsPhieuMuon.Add(pmsdao); } reader.Close(); CloseConnection(); return(dsPhieuMuon); }
public List <PhieuMuonSachDAO> TimPhieuChuaDongTheoTen(PhieuMuonSachDAO pmss) { List <PhieuMuonSachDAO> dsPhieuMuon = new List <PhieuMuonSachDAO>(); OpenConnection(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; command.CommandText = " select pms.PhieuId,pms.NgayMuon,pms.NgayDuKienTra,pms.NgayTraSach " + "from PhieuMuonSach pms,Sach s,NguoiMuonSach nms " + "where pms.SachId=s.Id and pms.NguoiMuonSachId=nms.Id and nms.HoTen=N'" + pmss.TenNguoiMuonSach + "' " + "and pms.NgayTraSach is null and pms.TrangThai=N'Chưa Trả Sách'"; command.Connection = conn; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int idphieu = reader.GetInt32(0); DateTime ngaymuon = reader.GetDateTime(1); DateTime ngaydukientra = reader.GetDateTime(2); DateTime?ngaytra; if (reader.IsDBNull(3)) { ngaytra = (DateTime?)null; } else { ngaytra = reader.GetDateTime(3); } PhieuMuonSachDAO pms = new PhieuMuonSachDAO(); pms.MaPhieuMuon = idphieu; pms.NgayMuon = ngaymuon; pms.NgayDuKienTra = ngaydukientra; pms.NgayTraSach = ngaytra; dsPhieuMuon.Add(pms); } reader.Close(); CloseConnection(); return(dsPhieuMuon); }
public List <PhieuMuonSachDAO> PhieuCuaDG(PhieuMuonSachDAO phieudg) { return(phieums.PhieuCuaDG(phieudg)); }
public List <PhieuMuonSachDAO> TimphieuTheoNgay(PhieuMuonSachDAO timngayphieu) { return(phieums.TimPhieuTheoNgay(timngayphieu)); }
public List <PhieuMuonSachDAO> TimPhieuTheoten(PhieuMuonSachDAO timtenphieu) { return(phieums.TimPhieuTheoten(timtenphieu)); }
public List <PhieuMuonSachDAO> TimPhieuTheoMa(PhieuMuonSachDAO timmaphieu) { return(phieums.TimPhieuTheoMa(timmaphieu)); }
public List <PhieuMuonSachDAO> TimPhieuChuaDongTheoTen(PhieuMuonSachDAO timphieumo) { return(phieums.TimPhieuChuaDongTheoTen(timphieumo)); }