void loadDonHang() { listViewHoaDonGanDay.Items.Clear(); List <DonHangNew> lst = funHome.getDonHangMoi(); if (lst != null) { listViewHoaDonGanDay.FullRowSelect = true; listViewHoaDonGanDay.View = View.Details; foreach (DonHangNew item in lst) { ListViewItem lstViewItem = new ListViewItem(); lstViewItem.Text = item.maDonHang.ToString(); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.thanhTien.ToString() }); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.tenKhachHang }); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.tenNhanVien }); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.tinhTrang }); listViewHoaDonGanDay.Items.Add(lstViewItem); } } }
private void frm_Home_Load(object sender, EventArgs e) { List <DonHangNew> lst = funHome.getDonHangMoi(); if (lst != null) { listViewHoaDonGanDay.FullRowSelect = true; listViewHoaDonGanDay.View = View.Details; foreach (DonHangNew item in lst) { ListViewItem lstViewItem = new ListViewItem(); lstViewItem.Text = item.maDonHang.ToString(); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.tenKhachHang }); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.ngayMua.ToString() }); lstViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = item.thanhTien.ToString() }); listViewHoaDonGanDay.Items.Add(lstViewItem); } } this.WindowState = FormWindowState.Maximized; }