private void btnSave_Click(object sender, EventArgs e) { if (filePath != "") { //check exists Note noteCheck = NoteController.getNote(filePath); noteCheck.note = txtNote.Text; List <Link> listLink = LinkController.getListLinks(filePath); if (listKind != null) { for (int i = 0; i < listLink.Count; i++) { Link link = listLink[i]; LinkController.deleteLink(link); } } for (int i = 0; i < lbChooseKind.Items.Count; i++) { Link link = new Link(); link.kind = lbChooseKind.Items[i].ToString(); link.note = filePath; LinkController.addLink(link); } NoteController.updateNote(noteCheck); } }
private void btnDel_Click(object sender, EventArgs e) { if (getKindLocal != null) { List <Link> listLink = LinkController.getListLink(kindText); for (int i = 0; i < listLink.Count; i++) { LinkController.deleteLink(listLink[i]); } KindController.deleteKind(getKindLocal); } //show BindingSource source = new BindingSource(); source.DataSource = KindController.getListKind(); this.dataKinds.DataSource = source; }