Пример #1
0
        public void loadSach(int page = 1)
        {
            tb_trang.Text = "1";
            DataTable table = new DataTable();
            int       stt   = 0;

            table.Columns.Add("STT", typeof(int));
            table.Columns.Add("Ma", typeof(int));
            table.Columns.Add("Tên", typeof(string));
            table.Columns.Add("Số Lượng", typeof(int));
            table.Columns.Add("Giá nhập", typeof(decimal));
            table.Columns.Add("Giá xuất", typeof(decimal));
            table.Columns.Add("NXB", typeof(string));
            table.Columns.Add("Danh mục", typeof(string));
            var books = SachService.GetAllBooks(page);

            foreach (var item in books)
            {
                stt++;
                table.Rows.Add(stt, item.ma, item.ten, item.sl, item.gianhap, item.giaxuat, item.nhaxb.name, item.cat.name);
            }
            dgv_sach.DataSource = table;
        }