Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Class.Book_Temp   BT      = new Class.Book_Temp();
            Class.XuLyThuVien KiemTra = new Class.XuLyThuVien();
            string            MaSach  = CboxSachTrongKho.SelectedValue.ToString();



            if (KiemTra.TinhTrangSach(MaSach) == true)
            {
                if (KiemTra.LaySTTSachMuon(SoLuongSachMuonToiDa) == 0)
                {
                    MetroFramework.MetroMessageBox.Show(this, string.Format("Chỉ Được Mượn Tối Đa {0} Quyển Sách", SoLuongSachMuonToiDa), "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    BT        = KiemTra.LayTongTinSach_DgvTemp(MaSach);
                    BT.STT    = KiemTra.LaySTTSachMuon(SoLuongSachMuonToiDa);
                    BT.MaSach = MaSach;
                    KiemTra.ThemSachVao_DgvTemp(BT);
                    GridViewSachMuon.DataSource = KiemTra.InfoSach_DgvTemp();
                    KiemTra.Sub_SoLuongSach(MaSach);
                }
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "Tạm Thời Hết Sách Này", "Thông Báo!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Example #2
0
        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();
        }
Example #3
0
        //Lấy Thông Tin Sách Nhờ Mã Sách
        public Book_Temp LayTongTinSach_DgvTemp(string MaSach)
        {
            KetNoi = new Data.QuanLyThuVienDataContext();
            Book_Temp Temp = new Book_Temp();

            Temp.TenSach = (from S in KetNoi.Saches
                            where S.MaSach == MaSach
                            select S.TenSach).Single();

            Temp.TacGia = (from S in KetNoi.Saches
                           where S.MaSach == MaSach
                           select S.TenTacGia).Single();

            Temp.TheLoai = (from S in KetNoi.Saches
                            where S.MaSach == MaSach
                            select S.TheLoai).Single();

            return(Temp);
        }