コード例 #1
0
        void LoadData()
        {
            try
            {
                dtChiTietPhieuMuon = new DataTable();
                dtChiTietPhieuMuon.Clear();
                DataSet dsChiTietPhieuMuon = dbChiTietPhieuMuon.LayChiTietPhieuMuon();
                dtChiTietPhieuMuon = dsChiTietPhieuMuon.Tables[0];

                gcChiTietPhieuMuon.DataSource = dtChiTietPhieuMuon;

                dtThe = new DataTable();
                dtThe.Clear();
                DataSet dsThe = dbThe.LayThe();
                dtThe = dsThe.Tables[0];

                glueMaThe.DataSource    = dtThe;
                glueMaThe.DisplayMember = "MaThe";
                glueMaThe.ValueMember   = "MaThe";

                dtSach = new DataTable();
                dtSach.Clear();
                DataSet dsSach = dbSach.LaySach();
                dtSach = dsSach.Tables[0];

                glueMaSach.DataSource    = dtSach;
                glueMaSach.DisplayMember = "MaSach";
                glueMaSach.ValueMember   = "MaSach";

                them = false;

                STT           = "";
                MaThe         = "";
                MaSach        = "";
                SoPhieu       = "";
                NgayMuon      = "";
                NgayHenTra    = "";
                NgayTra       = "";
                TinhTrangSach = "";
                TienPhat      = 0;

                this.btnThem.Enabled  = true;
                this.btnXoa.Enabled   = true;
                this.btnInfor.Enabled = true;
                this.btnTable.Enabled = true;
                this.btnTroVe.Enabled = true;

                this.btnTable.Enabled = false;
            }
            catch (SqlException)
            {
                XtraMessageBox.Show("Không lấy được nội dung trong table ChiTietPhieuMuon. Lỗi rồi!!!");
            }
        }
コード例 #2
0
        void LoadData()
        {
            try
            {
                dtSach = new DataTable();
                dtSach.Clear();
                DataSet dsSach = dbSach.LaySach();
                dtSach = dsSach.Tables[0];

                gcSach.DataSource = dtSach;

                dtNgonNguSach = new DataTable();
                dtNgonNguSach.Clear();
                DataSet dsNgonNguSach = dbNgonNgu.LayNgonNguSach();
                dtNgonNguSach = dsNgonNguSach.Tables[0];

                glueMaNgonNgu.DataSource    = dtNgonNguSach;
                glueMaNgonNgu.DisplayMember = "MaNgonNgu";
                glueMaNgonNgu.ValueMember   = "MaNgonNgu";

                dtTacGia = new DataTable();
                dtTacGia.Clear();
                DataSet dsTacGia = dbTG.LayTacGia();
                dtTacGia = dsTacGia.Tables[0];

                glueMaTG.DataSource    = dtTacGia;
                glueMaTG.DisplayMember = "MaTG";
                glueMaTG.ValueMember   = "MaTG";

                dtTheLoai = new DataTable();
                dtTheLoai.Clear();
                DataSet dsTheLoai = dbTheLoai.LayTheLoai();
                dtTheLoai = dsTheLoai.Tables[0];

                glueMaTL.DataSource    = dtTheLoai;
                glueMaTL.DisplayMember = "MaTL";
                glueMaTL.ValueMember   = "MaTL";

                dtNhaXuatBan = new DataTable();
                dtNhaXuatBan.Clear();
                DataSet dsNhaXuatBan = dbNhaXuatBan.LayNhaXuatBan();
                dtNhaXuatBan = dsNhaXuatBan.Tables[0];

                glueMaNXB.DataSource    = dtNhaXuatBan;
                glueMaNXB.DisplayMember = "MaNXB";
                glueMaNXB.ValueMember   = "MaNXB";

                dtViTriSach = new DataTable();
                dtViTriSach.Clear();
                DataSet dsViTriSach = dbVT.LayViTriSach();
                dtViTriSach = dsViTriSach.Tables[0];

                glueMaVT.DataSource    = dtViTriSach;
                glueMaVT.DisplayMember = "MaVT";
                glueMaVT.ValueMember   = "MaVT";



                them = false;

                MaSach                    = "";
                TenSach                   = "";
                MaTL                      = "";
                SoLuong                   = "";
                MaNXB                     = "";
                NamNXB                    = "";
                GiaSach                   = 0;
                this.pic1.Image           = null;
                this.pic1.BackgroundImage = null;

                this.btnThem.Enabled  = true;
                this.btnXoa.Enabled   = true;
                this.btnInfor.Enabled = true;
                this.btnTable.Enabled = true;
                this.btnTroVe.Enabled = true;

                this.btnTable.Enabled = false;
            }
            catch (SqlException)
            {
                XtraMessageBox.Show("Không lấy được nội dung trong table Sach. Lỗi rồi!!!");
            }
        }