/// <summary> /// Retrieve all data from Tag table. Used to fill combo box. /// </summary> /// <returns>List of Tag</returns> public List <ModelNotifiedForTag> GetAll_Tag(out string error) { error = null; TagBsn bsn = new TagBsn(wpfConfig); List <TagInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForTag> notifiedItems = new List <ModelNotifiedForTag>(); foreach (TagInfo dbItem in dbItems) { ModelNotifiedForTag itemToAdd = new ModelNotifiedForTag(); Cloner.CopyAllTo(typeof(TagInfo), dbItem, typeof(ModelNotifiedForTag), itemToAdd); notifiedItems.Add(itemToAdd); } return(notifiedItems); }
private List <ModelNotifiedForTagEmployee> FilterGrid(string filterValue) { filterValue = filterValue.ToLower(); List <ModelNotifiedForTagEmployee> filteredList = new List <ModelNotifiedForTagEmployee>(); foreach (ModelNotifiedForTagEmployee item in TagEmployeeDataContext.modelNotifiedForTagEmployeeMain) { if (item.TagEmployeeID.ToString().ToLower().Contains(filterValue)) { filteredList.Add(item); continue; } //Filter string values. if (item.TagEmployeeTextDesc != null) { if (item.TagEmployeeTextDesc.ToLower().Contains(filterValue)) { filteredList.Add(item); continue; } } //Filter FK values. if (item.EmployeeIDFK != null) { ModelNotifiedForEmployees comboItem = TagEmployeeDataContext.modelNotifiedForEmployees.Where(x => x.EmployeeID == item.EmployeeIDFK).FirstOrDefault(); if ((comboItem != null) && (comboItem.LastName != null) && (comboItem.LastName.ToLower().Contains(filterValue))) { filteredList.Add(item); continue; } } if (item.TagFK != null) { ModelNotifiedForTag comboItem = TagEmployeeDataContext.modelNotifiedForTag.Where(x => x.TagID == item.TagFK).FirstOrDefault(); if ((comboItem != null) && (comboItem.TextDesc != null) && (comboItem.TextDesc.ToLower().Contains(filterValue))) { filteredList.Add(item); continue; } } } return(filteredList); }