Esempio n. 1
0
        private void btnThue_Click(object sender, EventArgs e)
        {
            if (dgvThue.RowCount == 0)
            {
                MessageBox.Show("Vui lòng thêm DVD! :D");
                txtThongTinThue.Focus();
                return;
            }
            bRentOrder = new bPhieuMuon();
            bRentOrder.insertPhieuMuon(new ePhieuMuon(0, int.Parse(lbMaKhachHang.Text.ToString()), DateTime.Now));
            int idPhieuMuon = bRentOrder.getAllPhieuMuon().Last().IdPhieuMuon;

            bRentOrderDetail = new bChiTietPhieuMuon();
            bDVD             = new bDvd();
            eDvd newitem = new eDvd();

            foreach (DataGridViewRow dgvr in dgvThue.Rows)
            {
                newitem.IdDvd     = Convert.ToInt32(dgvr.Cells[0].Value);
                newitem.IdTiltle  = bDVD.getDvd(newitem.IdDvd).IdTiltle;
                newitem.TinhTrang = "Thue";
                bDVD.updateDvd(newitem);
                bRentOrderDetail.insertChiTietPhieuMuon(new eChiTietPhieuMuon(idPhieuMuon, newitem.IdDvd, 0, DateTime.Now, false));
            }
            MessageBox.Show("Bạn đã thuê thành công! :D");
            btnThueFunction_Click(sender, e);
        }
Esempio n. 2
0
        public void updateDvd(eDvd newitem)
        {
            DVD item = data.DVDs.Single(n => n.Id == newitem.IdDvd);

            item.Id        = newitem.IdDvd;
            item.IdTitle   = newitem.IdTiltle;
            item.TinhTrang = newitem.TinhTrang;
            item.TrangThai = newitem.TrangThai1;
            data.SubmitChanges();
        }
Esempio n. 3
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();
 }