private void loadNote() { if (flag) { listView1.Items.Clear(); List <Note> listNode = NoteController.getListNote(); foreach (Note note in listNode) { string text = note.NoteTitle; ListViewItem n = new ListViewItem(note.NoteID.ToString()); n.SubItems.Add(text); this.listView1.Items.Add(n); } } else { listView1.Items.Clear(); List <Trash> listTrash = TrashConntroller.getListTrash(); foreach (Trash trash in listTrash) { string text = trash.TrashTitle; ListViewItem n = new ListViewItem(trash.TrashID.ToString()); n.SubItems.Add(text); this.listView1.Items.Add(n); } } }
private void tbSearchNote_TextChanged(object sender, EventArgs e) { if (flag) { listView1.Items.Clear(); List <Note> listNode = NoteController.getListNote(tbSearchNote.Text); foreach (Note note in listNode) { string text = note.NoteTitle; ListViewItem n = new ListViewItem(note.NoteID.ToString()); n.SubItems.Add(text); this.listView1.Items.Add(n); } } else { listView1.Items.Clear(); List <Trash> listTrash = TrashConntroller.getListTrash(tbSearchNote.Text); foreach (Trash trash in listTrash) { string text = trash.TrashTitle; ListViewItem n = new ListViewItem("T"); n.SubItems.Add(text); this.listView1.Items.Add(n); } } }