Beispiel #1
0
 private void btnTimKiemSach_Click(object sender, EventArgs e)
 {
     lvwDanhSach_Sach.Items.Clear();
     try
     {
         List <Sach> lst = sachService.GetSachByTen(txtTimKiemSach.Text);
         foreach (Sach item in lst)
         {
             ListViewItem listViewItem = new ListViewItem();
             listViewItem.SubItems.Add(item.MaSach.ToString());
             listViewItem.SubItems.Add(item.TenSach);
             listViewItem.SubItems.Add(item.SoLuong.ToString());
             listViewItem.SubItems.Add(item.TacGia.ToString());
             listViewItem.SubItems.Add(item.TheLoai.ToString());
             lvwDanhSach_Sach.Items.Add(listViewItem);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }