/// <summary> /// Searches for clients that match the search criteria. /// </summary> public ServiceContactSearchItem[] SearchContactService(int startRow, int pageSize, string sortBy, string serviceOrgId, bool forceRefresh) { TimeServiceClient timeService = null; ServiceContactSearchItem[] serviceContact = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid orgId = new Guid(serviceOrgId); timeService = new TimeServiceClient(); ServiceContactSearchReturnValue returnValue = timeService.ServiceContactSearch(_logonId, collectionRequest, orgId, sortBy); if (returnValue.Success) { _serviceContactRowCount = returnValue.ServiceContact.TotalRowCount; serviceContact = returnValue.ServiceContact.Rows; } else { throw new Exception(returnValue.Message); } } return(serviceContact); } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) { timeService.Close(); } } } }
/// <summary> /// Searches for clients that match the search criteria. /// </summary> public ServiceContactSearchItem[] SearchContactService(int startRow, int pageSize, string sortBy, string serviceOrgId, bool forceRefresh) { TimeServiceClient timeService = null; ServiceContactSearchItem[] serviceContact = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid orgId = new Guid(serviceOrgId); timeService = new TimeServiceClient(); ServiceContactSearchReturnValue returnValue = timeService.ServiceContactSearch(_logonId, collectionRequest, orgId, sortBy); if (returnValue.Success) { _serviceContactRowCount = returnValue.ServiceContact.TotalRowCount; serviceContact = returnValue.ServiceContact.Rows; } else { throw new Exception(returnValue.Message); } } return serviceContact; } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) timeService.Close(); } } }