private void btnFilter_Click(object sender, EventArgs e) { string criteria = TakeFilterCriteria(); lbKanjiList.Items.Clear(); if (criteria == "") { BringAllKanji(user_pool.FindUser(user.GetMail()).GetDictionary()); } else { List <Kanji> filtered_kanji_list = user_pool.FindUser(user.GetMail()).FilterKanji(criteria); BringAllKanji(filtered_kanji_list); } }
public SearchForm(User user, UserPool user_pool) { InitializeComponent(); this.user = user; this.user_pool = user_pool; lblWelcome.Text = user.GetMail(); BringAllKanji(user_pool.FindUser(user.GetMail()).GetDictionary()); }
private void btnAddUpdate_Click(object sender, EventArgs e) { if (EmptinessCheck()) { if (management_type == ManagementType.ADD) { Kanji added_kanji = new Kanji(); added_kanji = AssignKanjiDetails(added_kanji); user_pool.FindUser(user.GetMail()).AddKanji(added_kanji); // save DB_str = JsonConvert.SerializeObject(user_pool); File.WriteAllText(user_pool.path, DB_str); this.Close(); } else if (management_type == ManagementType.UPDATE_DELETE) { // do update Kanji updated_kanji = new Kanji(); updated_kanji = AssignKanjiDetails(updated_kanji); user_pool.FindUser(user.GetMail()).DeleteKanji(kanji); user_pool.FindUser(user.GetMail()).AddKanji(updated_kanji); // save DB_str = JsonConvert.SerializeObject(user_pool); File.WriteAllText(user_pool.path, DB_str); this.Close(); } } else { MessageBox.Show("Lack of info!"); } }