Exemple #1
0
        /// <summary>
        /// Gets the industries.
        /// </summary>
        private void BindIndustries()
        {
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest         collectionRequest = new CollectionRequest();
                IndustrySearchCriteria    searchCriteria    = new IndustrySearchCriteria();
                IndustrySearchReturnValue returnValue       = contactService.IndustrySearch(_logonSettings.LogonId,
                                                                                            collectionRequest, searchCriteria);
                if (returnValue.Success)
                {
                    //Add a blank item
                    AppFunctions.AddDefaultToDropDownList(_ddlIndustry);

                    //Generate the items to be displayed in the Industry drop down list
                    //Get the main items
                    string industryText = string.Empty;
                    foreach (IndustrySearchItem industry in returnValue.Industries.Rows)
                    {
                        if (industry.ParentId == 0)
                        {
                            industryText = industry.Name;
                            _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString()));

                            // Call method to get the sub items
                            GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id);
                        }
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblError.Text     = DataConstants.WSEndPointErrorMessage;
                _lblError.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {
                _lblError.Text     = ex.Message;
                _lblError.CssClass = "errorMessage";
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        contactService.Close();
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets the industries.
        /// </summary>
        private void GetIndustries()
        {
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest         collectionRequest = new CollectionRequest();
                IndustrySearchCriteria    searchCriteria    = new IndustrySearchCriteria();
                IndustrySearchReturnValue returnValue       = contactService.IndustrySearch(_logonId,
                                                                                            collectionRequest, searchCriteria);
                if (returnValue.Success)
                {
                    //Add a blank item
                    _ddlIndustry.Items.Add(new ListItem("", "0"));

                    //Generate the items to be displayed in the Industry drop down list
                    //Get the main items
                    string industryText = string.Empty;
                    foreach (IndustrySearchItem industry in returnValue.Industries.Rows)
                    {
                        if (industry.ParentId == 0)
                        {
                            industryText = industry.Name;
                            _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString()));

                            // Call method to get the sub items
                            GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id);
                        }
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        contactService.Close();
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Get a list of industries 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">Industry search criteria</param>
        /// <returns></returns>
        public IndustrySearchReturnValue IndustrySearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                                        IndustrySearchCriteria criteria)
        {
            IndustrySearchReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oContactService = new ContactService();
                returnValue     = oContactService.IndustrySearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
            }
            else
            {
                returnValue         = new IndustrySearchReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
Exemple #4
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 industries.
        /// </summary>
        private void GetIndustries()
        {
            ContactServiceClient contactService = null;
            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest collectionRequest = new CollectionRequest();
                IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria();
                IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonId,
                                                                collectionRequest, searchCriteria);
                if (returnValue.Success)
                {
                    //Add a blank item
                    _ddlIndustry.Items.Add(new ListItem("", "0"));

                    //Generate the items to be displayed in the Industry drop down list
                    //Get the main items
                    string industryText = string.Empty;
                    foreach (IndustrySearchItem industry in returnValue.Industries.Rows)
                    {
                        if (industry.ParentId == 0)
                        {
                            industryText = industry.Name;
                            _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString()));

                            // Call method to get the sub items
                            GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id);
                        }
                    }
                }
                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 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 industries.
        /// </summary>
        private void BindIndustries()
        {
            ContactServiceClient contactService = null;
            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest collectionRequest = new CollectionRequest();
                IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria();
                IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonSettings.LogonId,
                                                                collectionRequest, searchCriteria);
                if (returnValue.Success)
                {
                    //Add a blank item
                    AppFunctions.AddDefaultToDropDownList(_ddlIndustry);

                    //Generate the items to be displayed in the Industry drop down list
                    //Get the main items
                    string industryText = string.Empty;
                    foreach (IndustrySearchItem industry in returnValue.Industries.Rows)
                    {
                        if (industry.ParentId == 0)
                        {
                            industryText = industry.Name;
                            _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString()));

                            // Call method to get the sub items
                            GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id);
                        }
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {

                _lblMessage.Text = ex.Message;
                _lblMessage.CssClass = "errorMessage";
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                        contactService.Close();
                }
            }
        }
        /// <summary>
        /// Get a list of industries 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">Industry search criteria</param>
        /// <returns></returns>
        public IndustrySearchReturnValue IndustrySearch(Guid logonId, CollectionRequest collectionRequest,
                                                        IndustrySearchCriteria criteria)
        {
            IndustrySearchReturnValue returnValue = new IndustrySearchReturnValue();

            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 industries
                    DataListCreator<IndustrySearchItem> dataListCreator = new DataListCreator<IndustrySearchItem>();

                    // Declare an inline event (annonymous delegate) to read the dataset
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        e.DataSet = SrvIndustryLookup.GetIndustry();

                        DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "IndustryName");
                        e.DataSet.Tables.Remove(e.DataSet.Tables[0]);
                        e.DataSet.Tables.Add(dt);
                    };

                    // Create the data list
                    returnValue.Industries = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "IndustrySearch",
                        // 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", "IndustryID"),
                            new ImportMapping("ParentId", "IndustryParentID"),
                            new ImportMapping("Name", "IndustryName")
                            }
                        );
                }
                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(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>
 /// Get a list of industries 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">Industry search criteria</param>
 /// <returns></returns>
 public IndustrySearchReturnValue IndustrySearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                                 IndustrySearchCriteria criteria)
 {
     IndustrySearchReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oContactService = new ContactService();
         returnValue = oContactService.IndustrySearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
     }
     else
     {
         returnValue = new IndustrySearchReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     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;
 }
Exemple #12
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);
        }