public List <ListViewItem> searchIUResults(Dictionary <String, String> searchStrings, bool strategyAND) { List <ListViewItem> items = new List <ListViewItem>(); try { LogicalRestriction restrict = null; if (strategyAND) { restrict = RestrictionFactory.And(); } else { restrict = RestrictionFactory.Or(); } foreach (String key in searchStrings.Keys) { if (key != null) { IRestriction r = RestrictionFactory.Like(typeof(IdentificationUnit), key, searchStrings[key]); restrict.Add(r); } } foreach (IdentificationUnit iu in con.LoadList <IdentificationUnit>(restrict)) { if (iu != null) { ListViewItem item = new ListViewItem(); item.Text = iu.IdentificationUnitID.ToString(); item.SubItems.Add(iu.LastIdentificationCache); item.SubItems.Add(iu.TaxonomicGroup); item.SubItems.Add(iu.UnitIdentifier); item.Tag = iu.IdentificationUnitID; items.Add(item); } } } catch (Exception) { items.Clear(); } return(items); }
public IList <ListViewItem> searchEventResults(Dictionary <String, String> searchStrings, bool strategyAND) { List <ListViewItem> items = new List <ListViewItem>(); try { LogicalRestriction restrict = null; if (strategyAND) { restrict = RestrictionFactory.And(); } else { restrict = RestrictionFactory.Or(); } foreach (String key in searchStrings.Keys) { if (key != null) { IRestriction r = RestrictionFactory.Like(typeof(CollectionEvent), key, searchStrings[key]); restrict.Add(r); } } foreach (CollectionEvent ce in con.LoadList <CollectionEvent>(restrict)) { if (ce != null) { ListViewItem item = new ListViewItem(); item.Text = ce.CollectionEventID.ToString(); item.SubItems.Add(ce.CollectorsEventNumber); item.SubItems.Add(ce.CollectionDate.ToShortDateString()); item.Tag = ce.CollectionEventID; items.Add(item); } } } catch (Exception) { items.Clear(); } return(items); }
public List <ListViewItem> searchSpecimenResults(Dictionary <String, String> searchStrings, bool strategyAND) { List <ListViewItem> items = new List <ListViewItem>(); try { LogicalRestriction restrict = null; if (strategyAND) { restrict = RestrictionFactory.And(); } else { restrict = RestrictionFactory.Or(); } foreach (String key in searchStrings.Keys) { if (key != null) { IRestriction r = RestrictionFactory.Like(typeof(CollectionSpecimen), key, searchStrings[key]); restrict.Add(r); } } foreach (CollectionSpecimen cs in con.LoadList <CollectionSpecimen>(restrict)) { if (cs != null) { ListViewItem item = new ListViewItem(); item.Text = cs.CollectionSpecimenID.ToString(); item.Tag = cs.CollectionSpecimenID; items.Add(item); } } } catch (Exception) { items.Clear(); } return(items); }