public async Task <IEnumerable <Department> > SearchByKey(params string[] keys) { List <Department> list = null; DepartmentsResult result = null; await ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <DepartmentMasterClient>(); switch (Key) { case SearchDepartment.WithSection: result = await service.DepartmentWithSectionAsync(Application.Login.SessionKey, Application.Login.CompanyId, SectionId, DepartmentId?.Distinct().ToArray()); break; default: result = await service.GetItemsAsync(Application.Login.SessionKey, Application.Login.CompanyId); break; } if (result.ProcessResult.Result) { list = result.Departments; } }); if (list != null) { list = list.FindAll( f => (!string.IsNullOrEmpty(f.Name) && f.Name.RoughlyContains(keys[0])) ); } return(list); }
public async Task <IEnumerable <Department> > SearchInfo() { List <Department> list = null; DepartmentsResult result = null; await ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <DepartmentMasterClient>(); switch (Key) { case SearchDepartment.WithSection: result = await service.DepartmentWithSectionAsync(Application.Login.SessionKey, Application.Login.CompanyId, SectionId, DepartmentId?.Distinct().ToArray()); break; default: result = await service.GetItemsAsync(Application.Login.SessionKey, Application.Login.CompanyId); break; } if (result.ProcessResult.Result) { list = result.Departments; } }); return(list); }