Esempio n. 1
0
        public JointClientCandidateSearchReturnValue JointClientCandidateSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                                                                JointClientCandidateSearchCriteria criteria)
        {
            JointClientCandidateSearchReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oClientService = new ClientService();
                returnValue    = oClientService.JointClientCandidateSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
            }
            else
            {
                returnValue         = new JointClientCandidateSearchReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
 public JointClientCandidateSearchReturnValue JointClientCandidateSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest,
                                     JointClientCandidateSearchCriteria criteria)
 {
     JointClientCandidateSearchReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oClientService = new ClientService();
         returnValue = oClientService.JointClientCandidateSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria);
     }
     else
     {
         returnValue = new JointClientCandidateSearchReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        public JointClientCandidateSearchReturnValue JointClientCandidateSearch(Guid logonId, CollectionRequest collectionRequest,
                                            JointClientCandidateSearchCriteria criteria)
        {
            JointClientCandidateSearchReturnValue returnValue = new JointClientCandidateSearchReturnValue();

            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");
                    }

                    // Create a data list creator for a list of clients
                    DataListCreator<JointClientCandidateSearchItem> dataListCreator = new DataListCreator<JointClientCandidateSearchItem>();

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        //Add the table to the dataset as the lookup is returning a datatable
                        e.DataSet = new System.Data.DataSet();
                        e.DataSet.Tables.Add(SrvMatterLookup.GetJointClientCandidatesforListView(criteria.ClientId, criteria.IsMember));
                    };

                    // Create the data list
                    returnValue.JointClientCandidates = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "JointClientCandidates",
                        // 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("Name", "Text"),
                            new ImportMapping("Tag", "Tag"),
                            }
                        );
                }
                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;
        }