private void LoadDSSach()
        {
            DataTable dt  = Sach_DAO.LoadDuLieu();
            DataTable dtg = ChuDe_DAO.LoadDuLieu();
            AutoCompleteStringCollection ac = new AutoCompleteStringCollection();

            for (int i = 0; i < dtg.Rows.Count; i++)
            {
                ListViewGroup lvg = new ListViewGroup(dtg.Rows[i][0].ToString(), dtg.Rows[i][1].ToString());
                lsvSach.Groups.Add(lvg);
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ListViewItem lvi = new ListViewItem(dt.Rows[i][1].ToString()); // ten mon
                lvi.SubItems.Add(dt.Rows[i][2].ToString());                    // Don gia
                lvi.SubItems.Add(dt.Rows[i][4].ToString());                    //So luong
                DataTable nxb = NhaXuatBan_DAO.LoadDuLieuNXB(dt.Rows[i][6].ToString());
                lvi.SubItems.Add(nxb.Rows[0][1].ToString());                   //NXB
                lvi.SubItems.Add(dt.Rows[i][7].ToString());                    //id chu de
                lvi.SubItems.Add(dt.Rows[i][0].ToString());                    // id mon
                lvi.Group = lsvSach.Groups[lvi.SubItems[4].Text];
                lsvSach.Items.Add(lvi);
                ac.Add(lvi.SubItems[0].Text);
            }
            txtTenSach.AutoCompleteCustomSource = ac;
        }
Esempio n. 2
0
 private void FrmThemDS_Load(object sender, EventArgs e)
 {
     cboMaCD.DataSource      = ChuDe_DAO.LoadDuLieu();
     cboMaCD.DisplayMember   = "TenCD";
     cboMaCD.ValueMember     = "MaCD";
     cboNhaNXB.DataSource    = NhaXuatBan_DAO.LoadDuLieu();
     dgvDausach.DataSource   = Sach_DAO.LoadDuLieu();
     cboNhaNXB.DisplayMember = "TenNXB";
     cboNhaNXB.ValueMember   = "MaNXB";
     txtMasach.ReadOnly      = true;
 }
        private void LoadDocGia()
        {
            ThoiGianNow.DateTime         = DateTime.Now;
            cboTenNhanVien.DataSource    = NhanVien_DAO.LoadDuLieu();
            cboTenNhanVien.DisplayMember = "HoTen";
            cboTenNhanVien.ValueMember   = "MaNV";


            cboTenChuDe.DataSource    = ChuDe_DAO.LoadDuLieu();
            cboTenChuDe.DisplayMember = "TenCD";
            cboTenChuDe.ValueMember   = "MaCD";
            cboTenChuDe.Text          = "";

            cboNhaXuatBan.DataSource    = NhaXuatBan_DAO.LoadDuLieu();
            cboNhaXuatBan.DisplayMember = "TenNXB";
            cboNhaXuatBan.ValueMember   = "MaNXB";
            cboNhaXuatBan.Text          = "";
        }