/// <summary> /// Retrieve all data from Employees table. Used to fill combo box. /// </summary> /// <returns>List of Employees</returns> public List <ModelNotifiedForEmployees> GetAll_Employees(out string error) { error = null; EmployeesBsn bsn = new EmployeesBsn(wpfConfig); List <EmployeesInfo> dbItems = bsn.GetAll(); List <ModelNotifiedForEmployees> notifiedItems = new List <ModelNotifiedForEmployees>(); foreach (EmployeesInfo dbItem in dbItems) { ModelNotifiedForEmployees itemToAdd = new ModelNotifiedForEmployees(); Cloner.CopyAllTo(typeof(EmployeesInfo), dbItem, typeof(ModelNotifiedForEmployees), 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); }