/// <summary> /// Gets the ethnicity values for the drop down list. /// </summary> private void GetEthnicity() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); EthnicitySearchCriteria searchCriteria = new EthnicitySearchCriteria(); EthnicitySearchReturnValue returnValue = contactService.EthnicitySearch(_logonId, collectionRequest, searchCriteria); if (returnValue.Success) { _ddlEthnicity.DataSource = returnValue.Ethnicity.Rows; _ddlEthnicity.DataTextField = "Description"; _ddlEthnicity.DataValueField = "Id"; _ddlEthnicity.DataBind(); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) { contactService.Close(); } } } }
/// <summary> /// Gets the ethnicity values for the drop down list. /// </summary> private void GetEthnicity() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); EthnicitySearchCriteria searchCriteria = new EthnicitySearchCriteria(); EthnicitySearchReturnValue returnValue = contactService.EthnicitySearch(_logonId, collectionRequest, searchCriteria); if (returnValue.Success) { _ddlEthnicity.DataSource = returnValue.Ethnicity.Rows; _ddlEthnicity.DataTextField = "Description"; _ddlEthnicity.DataValueField = "Id"; _ddlEthnicity.DataBind(); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) contactService.Close(); } } }
/// <summary> /// Get a list of ethnicity values that match the search criteria /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service.</param> /// <param name="collectionRequest">Information about the collection being requested.</param> /// <param name="criteria">Ethnicity search criteria</param> /// <returns></returns> public EthnicitySearchReturnValue EthnicitySearch(Guid logonId, IRIS.Law.WebServiceInterfaces.CollectionRequest collectionRequest, EthnicitySearchCriteria criteria) { EthnicitySearchReturnValue returnValue = new EthnicitySearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Can do everything break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of ethnicity values DataListCreator<EthnicitySearchItem> dataListCreator = new DataListCreator<EthnicitySearchItem>(); // Declare an inline event (annonymous delegate) to read the dataset dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { e.DataSet = SrvEthnicityLookup.GetEthnicity(); DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "EthnicDesc"); e.DataSet.Tables.Remove(e.DataSet.Tables[0]); e.DataSet.Tables.Add(dt); }; // Create the data list returnValue.Ethnicity = dataListCreator.Create(logonId, // Give the query a name so it can be cached "EthnicitySearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query criteria.ToString(), collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("Id", "EthnicID"), new ImportMapping("Description", "EthnicDesc"), } ); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return returnValue; }
/// <summary> /// Get a list of ethnicity values that match the search criteria /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="collectionRequest">Information about the collection being requested.</param> /// <param name="criteria">Ethnicity search criteria</param> /// <returns></returns> public EthnicitySearchReturnValue EthnicitySearch(HostSecurityToken oHostSecurityToken, IRIS.Law.WebServiceInterfaces.CollectionRequest collectionRequest, EthnicitySearchCriteria criteria) { EthnicitySearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.EthnicitySearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new EthnicitySearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// Get a list of ethnicity values that match the search criteria /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="collectionRequest">Information about the collection being requested.</param> /// <param name="criteria">Ethnicity search criteria</param> /// <returns></returns> public EthnicitySearchReturnValue EthnicitySearch(HostSecurityToken oHostSecurityToken, IRIS.Law.WebServiceInterfaces.CollectionRequest collectionRequest, EthnicitySearchCriteria criteria) { EthnicitySearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.EthnicitySearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new EthnicitySearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }