private void btnAddTask_Click(object sender, RoutedEventArgs e) { try { if (!ValidateTask()) { return; } Entities.Task t = new Entities.Task { LawyerID = ((Lawyer)cbLawyerT.SelectedItem).LawyerID, SubmatterID = ((Submatter)cbSubmatterT.SelectedItem).SubmatterID, Date = dpDateT.SelectedDate.Value, BillableTime = int.Parse(tbBillableMins.Text) }; if (!EntryValidation.IsEmpty(tbDescriptionT.Text)) { t.Description = tbDescriptionT.Text; } t.Add(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void ListViewSearch(string Text, ListView ListViewToSearch, RefreshFunction RefreshFunction) { if (EntryValidation.IsEmpty(Text)) { for (int i = ListViewToSearch.Items.Count - 1; i >= 0; i--) { var item = ListViewToSearch.Items.GetItemAt(i); if (!item.ToString().ToLower().Contains(Text.ToLower())) { ListViewToSearch.Items.Remove(item); } } } else { RefreshFunction(); } }