Beispiel #1
0
        //get
        public eKhachHang getKhachHang(int id)
        {
            data = new DvdRentDbDataContext();
            KhachHang item = data.KhachHangs.Single(n => n.Id == id);

            return(new eKhachHang(item.Id, item.Ten, item.DiaChi, item.Sdt, (bool)item.TrangThai));
        }
Beispiel #2
0
        //get
        public eNhanVien getNhanVien(int id)
        {
            data = new DvdRentDbDataContext();
            NhanVien item = data.NhanViens.Single(n => n.Id == id);

            return(new eNhanVien(item.Id, item.Password, item.Ten, item.DiaChi, item.Sdt));
        }
Beispiel #3
0
        public eChiTietPhieuMuon getChiTietPhieuMuon(int idPhieuMuon, int idDvd)
        {
            data = new DvdRentDbDataContext();
            ChiTietPhieuMuon item = data.ChiTietPhieuMuons.Single(n => n.IdDVD == idDvd && n.IdPhieuMuon == idPhieuMuon);

            return(new eChiTietPhieuMuon(item.IdPhieuMuon, item.IdDVD, item.PhiTre, (DateTime)item.NgayTra, (bool)item.TinhTrang));
        }
Beispiel #4
0
        public eDvd getDvd(int id)
        {
            data = new DvdRentDbDataContext();
            DVD item = data.DVDs.Single(n => n.Id == id);

            return(new eDvd(item.Id, item.IdTitle, item.TinhTrang, (bool)item.TrangThai));
        }
Beispiel #5
0
        //get
        public ePhieuDatTruoc getPhieuDatTruocByKhachHangId(int id)
        {
            data = new DvdRentDbDataContext();
            PhieuDatTruoc item = data.PhieuDatTruocs.Single(n => n.IdKhachHang == id);

            return(new ePhieuDatTruoc(item.Id, item.IdKhachHang, DateTime.Parse(item.NgayTao.ToString())));
        }
Beispiel #6
0
        public ePhieuMuon getPhieuMuon(int id)
        {
            data = new DvdRentDbDataContext();
            PhieuMuon item = data.PhieuMuons.Single(n => n.Id == id);

            return(new ePhieuMuon(item.Id, item.IdKhachHang, DateTime.Parse(item.NgayTao.ToString())));
        }
Beispiel #7
0
        public void removeDvd(int id)
        {
            data = new DvdRentDbDataContext();
            DVD item = data.DVDs.Single(n => n.Id == id);

            item.TrangThai = false;
            data.SubmitChanges();
        }
Beispiel #8
0
        //remove
        public void removeKhachHang(int id)
        {
            data = new DvdRentDbDataContext();
            KhachHang item = data.KhachHangs.Single(n => n.Id == id);

            item.TrangThai = false;
            data.SubmitChanges();
        }
Beispiel #9
0
        public void removeChiTietDatTruoc(int idDat, int idTitle)
        {
            data = new DvdRentDbDataContext();
            ChiTietPhieuDatTruoc item = data.ChiTietPhieuDatTruocs.Single(n => n.IdPhieuDatTruoc == idDat && n.IdTitle == idTitle);

            item.Huy = false;
            data.SubmitChanges();
        }
Beispiel #10
0
 //insert
 public void insertPhieuMuon(ePhieuMuon item)
 {
     data = new DvdRentDbDataContext();
     data.PhieuMuons.InsertOnSubmit(new PhieuMuon()
     {
         IdKhachHang = item.IdKhach,
         NgayTao     = item.NgayTao
     });
     data.SubmitChanges();
 }
Beispiel #11
0
        public void updateChiTietPhieuDatTruoc(eChiTietPhieuDatTruoc newitem)
        {
            data = new DvdRentDbDataContext();
            ChiTietPhieuDatTruoc item = data.ChiTietPhieuDatTruocs.Single(n => n.IdPhieuDatTruoc == newitem.IdPhieuDatTruoc && n.IdTitle == newitem.IdTitle);

            item.IdPhieuDatTruoc = newitem.IdPhieuDatTruoc;
            item.IdTitle         = newitem.IdTitle;
            item.TrangThai       = newitem.TrangThai1;
            item.Huy             = newitem.Huy;
            data.SubmitChanges();
        }
Beispiel #12
0
 public void insertDvd(eDvd item)
 {
     data = new DvdRentDbDataContext();
     data.DVDs.InsertOnSubmit(new DVD()
     {
         IdTitle   = item.IdTiltle,
         TinhTrang = item.TinhTrang,
         TrangThai = item.TrangThai1
     });
     data.SubmitChanges();
 }
Beispiel #13
0
        //getAll
        public List <eNhanVien> getAllNhanVien()
        {
            data = new DvdRentDbDataContext();
            List <eNhanVien> list = new List <eNhanVien>();
            var temp = data.NhanViens;

            foreach (var item in temp)
            {
                list.Add(new eNhanVien(item.Id, item.Password, item.Ten, item.DiaChi, item.Sdt));
            }
            return(list);
        }
Beispiel #14
0
        //update
        public void updateKhachHang(eKhachHang newitem)
        {
            data = new DvdRentDbDataContext();
            KhachHang item = data.KhachHangs.Single(n => n.Id == newitem.IdKhach);

            item.Id        = newitem.IdKhach;
            item.Ten       = newitem.TenKhach;
            item.DiaChi    = newitem.DiaChiKhach;
            item.Sdt       = newitem.SdtKhach;
            item.TrangThai = newitem.TrangThai1;
            data.SubmitChanges();
        }
Beispiel #15
0
        //getAll
        public List <eKhachHang> getAllKhachHang()
        {
            data = new DvdRentDbDataContext();
            List <eKhachHang> list = new List <eKhachHang>();
            var temp = data.KhachHangs;

            foreach (var item in temp)
            {
                list.Add(new eKhachHang(item.Id, item.Ten, item.DiaChi, item.Sdt, (bool)item.TrangThai));
            }
            return(list);
        }
Beispiel #16
0
 public void insertChiPhieuDatTruoc(eChiTietPhieuDatTruoc item)
 {
     data = new DvdRentDbDataContext();
     data.ChiTietPhieuDatTruocs.InsertOnSubmit(new ChiTietPhieuDatTruoc()
     {
         IdPhieuDatTruoc = item.IdPhieuDatTruoc,
         IdTitle         = item.IdTitle,
         TrangThai       = item.TrangThai1,
         Huy             = item.Huy
     });
     data.SubmitChanges();
 }
Beispiel #17
0
        public List <eChiTietPhieuDatTruoc> getAllChiTietPhieuDatTruoc()
        {
            data = new DvdRentDbDataContext();
            List <eChiTietPhieuDatTruoc> list = new List <eChiTietPhieuDatTruoc>();
            var temp = data.ChiTietPhieuDatTruocs;

            foreach (var item in temp)
            {
                list.Add(new eChiTietPhieuDatTruoc(item.IdPhieuDatTruoc, item.IdTitle, item.TrangThai, (bool)item.Huy));
            }
            return(list);
        }
Beispiel #18
0
        //update
        public void updateChiTietPhieuMuon(eChiTietPhieuMuon newitem)
        {
            data = new DvdRentDbDataContext();
            ChiTietPhieuMuon item = data.ChiTietPhieuMuons.Single(n => n.IdDVD == newitem.IdDvd && n.IdPhieuMuon == newitem.IdPhieuMuon);

            item.IdPhieuMuon = newitem.IdPhieuMuon;
            item.IdDVD       = newitem.IdDvd;
            item.PhiTre      = newitem.PhiTre;
            item.NgayTra     = newitem.NgayTra;
            item.TinhTrang   = newitem.TinhTrang;
            data.SubmitChanges();
        }
Beispiel #19
0
        //getAll
        public List <ePhieuMuon> getAllPhieuMuon()
        {
            data = new DvdRentDbDataContext();
            List <ePhieuMuon> list = new List <ePhieuMuon>();
            var temp = data.PhieuMuons;

            foreach (var item in temp)
            {
                list.Add(new ePhieuMuon(item.Id, item.IdKhachHang, DateTime.Parse(item.NgayTao.ToString())));
            }
            return(list);
        }
Beispiel #20
0
 //insert
 public void insertKhachHang(eKhachHang item)
 {
     data = new DvdRentDbDataContext();
     data.KhachHangs.InsertOnSubmit(new KhachHang()
     {
         Ten       = item.TenKhach,
         DiaChi    = item.DiaChiKhach,
         Sdt       = item.SdtKhach,
         TrangThai = item.TrangThai1
     });
     data.SubmitChanges();
 }
Beispiel #21
0
        public List <eTitle> getAllTitle()
        {
            data = new DvdRentDbDataContext();
            List <eTitle> list     = new List <eTitle>();
            var           itemlist = data.Titles;

            foreach (var item in itemlist)
            {
                list.Add(new eTitle(item.Id, (int)item.PhiTre, (int)item.ThoiGianThue, (int)item.Gia, item.Ten, (bool)item.TheLoai, (bool)item.TrangThai));
            }
            return(list);
        }
Beispiel #22
0
        //getAll
        public List <eChiTietPhieuMuon> getAllChiTietPhieuMuon()
        {
            data = new DvdRentDbDataContext();
            List <eChiTietPhieuMuon> list = new List <eChiTietPhieuMuon>();
            var temp = data.ChiTietPhieuMuons;

            foreach (var item in temp)
            {
                list.Add(new eChiTietPhieuMuon(item.IdPhieuMuon, item.IdDVD, item.PhiTre, (DateTime)item.NgayTra, (bool)item.TinhTrang));
            }
            return(list);
        }
Beispiel #23
0
        public List <eDvd> getAllDvd()
        {
            data = new DvdRentDbDataContext();
            List <eDvd> list     = new List <eDvd>();
            var         itemlist = data.DVDs;

            foreach (var item in itemlist)
            {
                list.Add(new eDvd(item.Id, item.IdTitle, item.TinhTrang, (bool)item.TrangThai));
            }
            return(list);
        }
Beispiel #24
0
 //insert
 public void insertChiTietPhieuMuon(eChiTietPhieuMuon item)
 {
     data = new DvdRentDbDataContext();
     data.ChiTietPhieuMuons.InsertOnSubmit(new ChiTietPhieuMuon()
     {
         IdPhieuMuon = item.IdPhieuMuon,
         IdDVD       = item.IdDvd,
         PhiTre      = item.PhiTre,
         NgayTra     = item.NgayTra,
         TinhTrang   = item.TinhTrang
     });
     data.SubmitChanges();
 }
Beispiel #25
0
 public void insertTitle(eTitle item)
 {
     data = new DvdRentDbDataContext();
     data.Titles.InsertOnSubmit(new Title()
     {
         PhiTre       = item.PhiTre,
         ThoiGianThue = item.ThoiGianThue,
         Gia          = item.GiaThue,
         Ten          = item.TenTitle,
         TheLoai      = item.TheLoai,
         TrangThai    = item.TrangThai1
     });
     data.SubmitChanges();
 }
Beispiel #26
0
        public eTitle getTitle(int id)
        {
            data = new DvdRentDbDataContext();
            Title item = data.Titles.Single(n => n.Id == id);

            return(new eTitle(
                       item.Id,
                       int.Parse(item.PhiTre.ToString()),
                       int.Parse(item.ThoiGianThue.ToString()),
                       int.Parse(item.Gia.ToString()),
                       item.Ten,
                       (bool)item.TheLoai,
                       (bool)item.TrangThai
                       ));
        }