public void LapTheDocGia(TheDocGia TheDocGia) { Data.LapPhieu Temp = new Data.LapPhieu(); Data.DocGia Temp2 = new Data.DocGia(); Temp.IdNguoiLap = TheDocGia.IdNguoiLap; Temp.MaPhieu = TheDocGia.MaVe; Temp2.IdDocGia = TheDocGia.IdDocGia; Temp2.TenDocGia = TheDocGia.HoTen; Temp2.NgaySinh = TheDocGia.NgaySinh; Temp2.CMND = TheDocGia.CMND; Temp2.GioiTinh = TheDocGia.GioiTinh; Temp2.DiaChi = TheDocGia.DiaChi; Temp2.SDT = TheDocGia.Phone; Temp2.Email = TheDocGia.Mail; Temp2.LoaiDocGia = TheDocGia.LoaiDocGia; Temp2.NgayLap = TheDocGia.NgayLapThe; Temp2.MaPhieu = TheDocGia.MaVe; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.LapPhieus.InsertOnSubmit(Temp); KetNoi.DocGias.InsertOnSubmit(Temp2); KetNoi.SubmitChanges(); }
public void UpdateAvatar(string IdNguoiDung, Binary AnhNguoiDung) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.Anh Temp2 = new Data.Anh(); Temp2 = KetNoi.Anhs.Where(s => s.IdNguoiDung == IdNguoiDung).Single(); Temp2.Images = AnhNguoiDung; KetNoi.SubmitChanges(); }
public void CapNhatSachTrongKho(int SoLuong, string MaSach) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.Sach Temp2 = new Data.Sach(); Temp2 = KetNoi.Saches.Where(s => s.MaSach == MaSach).Single(); Temp2.SoLuong = SoLuong; KetNoi.SubmitChanges(); }
public void RemoveSach_DgvTemp(int STT) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.TempTable_MuonSach Temp = new Data.TempTable_MuonSach(); Temp = KetNoi.TempTable_MuonSaches.Where(s => s.STT == STT).Single(); KetNoi.TempTable_MuonSaches.DeleteOnSubmit(Temp); KetNoi.SubmitChanges(); }
// public void XoaSach(string MaSach) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.Sach Temp1 = new Data.Sach(); Temp1 = KetNoi.Saches.Where(s => s.MaSach == MaSach.ToString()).Single(); KetNoi.Saches.DeleteOnSubmit(Temp1); KetNoi.SubmitChanges(); }
//Cộng SoLuongSach public void Plus_SoLuongSach(string MaSach) { Class.XuLyThuVien KiemTra = new Class.XuLyThuVien(); int SoLuong = KiemTra.LaySoLuongSach(MaSach); KetNoi = new Data.QuanLyThuVienDataContext(); Data.Sach Temp2 = new Data.Sach(); Temp2 = KetNoi.Saches.Where(s => s.MaSach == MaSach).Single(); Temp2.SoLuong = SoLuong + 1; KetNoi.SubmitChanges(); }
public void XoaTheDocGia(int IdDocGia) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.DocGia Temp2 = new Data.DocGia(); Data.LapPhieu Temp1 = new Data.LapPhieu(); Temp2 = KetNoi.DocGias.Where(s => s.IdDocGia == IdDocGia).Single(); Temp1 = KetNoi.LapPhieus.Where(s => s.MaPhieu == IdDocGia.ToString()).Single(); KetNoi.DocGias.DeleteOnSubmit(Temp2); KetNoi.LapPhieus.DeleteOnSubmit(Temp1); KetNoi.SubmitChanges(); }
public void XoaPhieuMuonSach(string MaPhieu) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.PhieuMuonSach Temp = new Data.PhieuMuonSach(); if (MaPhieuMuonTonTai(MaPhieu) == 1) { Temp = KetNoi.PhieuMuonSaches.Where(s => s.MaPhieu == MaPhieu).Single(); KetNoi.PhieuMuonSaches.DeleteOnSubmit(Temp); KetNoi.SubmitChanges(); } }
public void CaiDatThuVien(Class.CaiDat Setting) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.CaiDat Temp = new Data.CaiDat(); Temp = KetNoi.CaiDats.Where(s => s.i == 1).Single(); Temp.TuoiMuonSach = Setting.TuoiMuonSach; Temp.HanSuDungThe = Setting.HanSuDungThe; Temp.NgayMuonToiDa = Setting.NgayMuonToiDa; Temp.SoLuongSachMuonToiDa = Setting.SachMuonToiDa; KetNoi.SubmitChanges(); }
public void ChiTietMuonSach(string MaSach, int STT, string MaMuon) { Data.ChiTietMuonSach ctms = new Data.ChiTietMuonSach(); ctms.SoTT = STT; ctms.MaSach = MaSach; ctms.MaMuon = MaMuon; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.ChiTietMuonSaches.InsertOnSubmit(ctms); KetNoi.SubmitChanges(); }
public void XoaChiTietMuonSach(string MaMuon) { KetNoi = new Data.QuanLyThuVienDataContext(); if (DaMuonSachRoi(MaMuon) == true) { var Temp = from sql in KetNoi.ChiTietMuonSaches where sql.MaMuon == MaMuon select sql; foreach (var item in Temp) { KetNoi.ChiTietMuonSaches.DeleteOnSubmit(item); } KetNoi.SubmitChanges(); } }
//Đặt Sách ->Insert 2 bảng PhieuMuonSach và Chi Tiết Mượn Sách<- public void PhieuMuonSach(string NgayMuon, string MaMuon) { Data.PhieuMuonSach pms = new Data.PhieuMuonSach(); pms.MaPhieu = MaMuon; pms.MaMuon = MaMuon; pms.NgayMuon = NgayMuon; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.PhieuMuonSaches.InsertOnSubmit(pms); KetNoi.SubmitChanges(); }
public void ThemSachVao_DgvTemp(Book_Temp Book) { Data.TempTable_MuonSach Temp = new Data.TempTable_MuonSach(); Temp.Sach = Book.TenSach; Temp.TheLoai = Book.TheLoai; Temp.TacGia = Book.TacGia; Temp.STT = Book.STT; Temp.MaSach = Book.MaSach; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.TempTable_MuonSaches.InsertOnSubmit(Temp); KetNoi.SubmitChanges(); }
// public void SuaTheDocGia(TheDocGia TheDocGia, int IdDocGia) { KetNoi = new Data.QuanLyThuVienDataContext(); Data.DocGia Temp2 = new Data.DocGia(); Temp2 = KetNoi.DocGias.Where(s => s.IdDocGia == IdDocGia).Single(); Temp2.TenDocGia = TheDocGia.HoTen; Temp2.NgaySinh = TheDocGia.NgaySinh; Temp2.CMND = TheDocGia.CMND; Temp2.GioiTinh = TheDocGia.GioiTinh; Temp2.DiaChi = TheDocGia.DiaChi; Temp2.SDT = TheDocGia.Phone; Temp2.Email = TheDocGia.Mail; Temp2.LoaiDocGia = TheDocGia.LoaiDocGia; KetNoi.SubmitChanges(); }
// public void ThemSachVaoKho(Sach Book) { Data.Sach Temp = new Data.Sach(); Temp.MaSach = Book.MaSach; Temp.TenSach = Book.TenSach; Temp.SoLuong = Book.SoLuong; Temp.NamXuatBan = Book.NamXuatBan; Temp.NhaXuatBan = Book.NhaSanXuat; Temp.NgayVaoKho = Book.NgayVaoKho; Temp.TheLoai = Book.TheLoai; Temp.TenTacGia = Book.TacGia; KetNoi = new Data.QuanLyThuVienDataContext(); KetNoi.Saches.InsertOnSubmit(Temp); KetNoi.SubmitChanges(); }