Example #1
0
        /// <summary>
        /// Gets the industry for association role.
        /// </summary>
        /// <param name="logonId">The logon id.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public IndustryForAssociationRoleReturnValue GetIndustryForAssociationRole(HostSecurityToken oHostSecurityToken, IndustrySearchCriteria criteria)
        {
            IndustryForAssociationRoleReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oContactService = new ContactService();
                returnValue     = oContactService.GetIndustryForAssociationRole(Functions.GetLogonIdFromToken(oHostSecurityToken), criteria);
            }
            else
            {
                returnValue         = new IndustryForAssociationRoleReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
Example #2
0
        /// <summary>
        /// Gets the industry for the association role
        /// </summary>
        /// <param name="associationRoleId">The association role id.</param>
        private int GetIndustryForAssociationRole(int associationRoleId)
        {
            int industryId = -1;

            if (_hdnIsSpecialisedSearch.Value == "true")
            {
                ContactServiceClient contactService = null;
                try
                {
                    contactService = new ContactServiceClient();
                    IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria();
                    searchCriteria.AssociationRoleId = associationRoleId;
                    IndustryForAssociationRoleReturnValue returnValue = contactService.GetIndustryForAssociationRole(_logonSettings.LogonId,
                                                                                                                     searchCriteria);
                    if (returnValue.Success)
                    {
                        industryId = returnValue.IndustryId;
                    }
                    else
                    {
                        throw new Exception(returnValue.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (contactService != null)
                    {
                        if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                        {
                            contactService.Close();
                        }
                    }
                }
            }
            return(industryId);
        }
        /// <summary>
        /// Gets the industry for association role.
        /// </summary>
        /// <param name="logonId">The logon id.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public IndustryForAssociationRoleReturnValue GetIndustryForAssociationRole(Guid logonId, IndustrySearchCriteria criteria)
        {
            IndustryForAssociationRoleReturnValue returnValue = new IndustryForAssociationRoleReturnValue();

            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:
                            // Can do everything
                            break;
                        case DataConstants.UserType.Client:
                        case DataConstants.UserType.ThirdParty:
                            throw new Exception("Access denied");
                        default:
                            throw new Exception("Access denied");
                    }

                    DsAssociationRolesForIndustry data =
                        SrvAssociationRoleLookup.GetAssociationRolesForIndustry(criteria.AssociationRoleId);

                    if (data.uvw_AssociationRolesForIndustry.Rows.Count != 0)
                    {
                        returnValue.IndustryId = data.uvw_AssociationRolesForIndustry[0].IndustryID;
                    }
                }
                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>
 /// Gets the industry for association role.
 /// </summary>
 /// <param name="logonId">The logon id.</param>
 /// <param name="criteria">The criteria.</param>
 /// <returns></returns>
 public IndustryForAssociationRoleReturnValue GetIndustryForAssociationRole(HostSecurityToken oHostSecurityToken, IndustrySearchCriteria criteria)
 {
     IndustryForAssociationRoleReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oContactService = new ContactService();
         returnValue = oContactService.GetIndustryForAssociationRole(Functions.GetLogonIdFromToken(oHostSecurityToken), criteria);
     }
     else
     {
         returnValue = new IndustryForAssociationRoleReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }