Exemplo n.º 1
0
        public Collection<Candidate> Search()
        {
            IEnumerable<Candidate> filteredCandidates = Get.Where(c => c.Id > 0); // Our results collection
            Collection<Candidate> results = new Collection<Candidate>();

            // If we have a basic search
            if (Basic != null)
            {
                filteredCandidates = filteredCandidates.Where(
                    c => c.Forename.ParseText(Basic.Query)
                        || c.Surname.ParseText(Basic.Query)
                        );

                // Select only the active clients
                if (Basic.ShowActive)
                    results.Append(filteredCandidates.Where(c => c.Active));

                // Select only the inactive clients
                if (Basic.ShowInactive)
                    results.Append(filteredCandidates.Where(c => !c.Active));
            }

            if (Advanced != null)
            {
                filteredCandidates = GetCandidatesByName(filteredCandidates);
                filteredCandidates = GetCandidatesByAddress(filteredCandidates);
                filteredCandidates = GetCandidatesByExperience(filteredCandidates, ExperienceType.Skill);
                filteredCandidates = GetCandidatesByExperience(filteredCandidates, ExperienceType.Work);
                filteredCandidates = GetCandidatesBySalary(filteredCandidates);
                filteredCandidates = GetFiltered(filteredCandidates);

                results.Append(filteredCandidates);
            }

            return results.RemoveDuplicates(); // Remove any duplicates and return our result set
        }
Exemplo n.º 2
0
        public IEnumerable<Client> Search()
        {
            IEnumerable<Client> filteredClients = Get.Where(c => c.Id > 0); // Our results collection
            Collection<Client> results = new Collection<Client>();

            // If we have a basic search
            if (Basic != null)
            {
                filteredClients = filteredClients.Where(
                    c => c.Name.ParseText(Basic.Query)
                        || c.PrimaryContact().Forename.ParseText(Basic.Query)
                        || c.PrimaryContact().Surname.ParseText(Basic.Query)
                        );

                // Select only the active clients
                if (Basic.ShowActive)
                    results.Append(filteredClients.Where(c => c.Active));

                // Select only the inactive clients
                if (Basic.ShowInactive)
                    results.Append(filteredClients.Where(c => !c.Active));
            }

            // If we have an advanced search
            if (Advanced != null)
            {
                filteredClients = GetClientsByName(filteredClients);
                filteredClients = GetClientsByAddress(filteredClients);
                filteredClients = GetClientsByContact(filteredClients);
                filteredClients = GetClientsBySector(filteredClients);

                results.Append(filteredClients);
            }

            return results.RemoveDuplicates(); // Remove any duplicates and return our result set
        }