Exemplo n.º 1
0
        private IReadOnlyCollection <DataSetValuePair> UpdateDatasetSource()
        {
            _sources.Clear();
            var candidates = ViewModelLocatorStatic.Locator.CandidateModule.Candidates.Select(c => c.Model);

            if (NameFilter != null)
            {
                var n = NameFilter.ToLowerInvariant();
                var filteredpersons = candidates.Where(c => c.CandidateFirstName.ToLowerInvariant().Contains(n) ||
                                                       c.CandidateMiddleName.ToLowerInvariant().Contains(n) ||
                                                       c.CandidateLastName.ToLowerInvariant().Contains(n));
                candidates = filteredpersons;
            }

            if (AddressFilter != null)
            {
                var n = AddressFilter.ToLowerInvariant();
                var filteredpersons = candidates.Where(c => c.CandidateAddress.ToLowerInvariant().Contains(n)
                                                       );
                candidates = filteredpersons;
            }

            if (PhoneNumberFilter != null)
            {
                var n = PhoneNumberFilter.ToLowerInvariant();
                var filteredpersons = candidates.Where(c => c.CandidatePhoneNo.Contains(n));
                candidates = filteredpersons;
            }



            _sources.Add(new DataSetValuePair("CandidateDataset", candidates));
            return(_sources);
        }
        private bool CandidatesViewFilter(object item)
        {
            if (string.IsNullOrEmpty(FirstNameFilter) &&
                CvUploaded == null
                &&
                string.IsNullOrEmpty(LastNameFilter) &&
                string.IsNullOrEmpty(PositionNameFilter) &&
                string.IsNullOrEmpty(PhoneNumberFilter) &&
                ConfigProjectsLibsView.Cast <ConfigProjectsLib>().ToList().Where(e => e.Selected.Equals(true)).Count() == ConfigProjectsLibsView.SourceCollection.Cast <ConfigProjectsLib>().ToList().Count() &&
                ConfigCompanyCollectionView.Cast <ConfigCompany>().ToList().Where(e => e.Selected.Equals(true)).Count() == ConfigCompanyCollectionView.SourceCollection.Cast <ConfigCompany>().ToList().Count()
                )
            {
                return(true);
            }
            else
            {
                if (
                    (string.IsNullOrEmpty(FirstNameFilter) || (((Candidate)item).FirstName.ToLower()).StartsWith(FirstNameFilter.ToLower())) &&
                    (string.IsNullOrEmpty(LastNameFilter) || (((Candidate)item).LastName.ToLower()).StartsWith(LastNameFilter.ToLower())) &&
                    (string.IsNullOrEmpty(PhoneNumberFilter) ||
                     (((Candidate)item).FirstPhone.ToLower().Trim()).StartsWith(PhoneNumberFilter.ToLower().Trim()) ||
                     (((Candidate)item).SecondPhone.ToLower().Trim()).StartsWith(PhoneNumberFilter.ToLower().Trim())
                    ) &&
                    (CvUploaded == null || CvUploaded.Equals(((Candidate)item).CvUploaded))

                    &&

                    (
                        (
                            ConfigProjectsLibsView.Cast <ConfigProjectsLib>().ToList().Where(e => e.Selected.Equals(true)).Count() == ConfigProjectsLibsView.SourceCollection.Cast <ConfigProjectsLib>().ToList().Count() &&
                            ConfigAreaView.Cast <ConfigArea>().ToList().Where(e => e.Selected.Equals(true)).Count() == ConfigAreaView.SourceCollection.Cast <ConfigArea>().ToList().Count() &&
                            ConfigCompanyCollectionView.Cast <ConfigCompany>().ToList().Where(e => e.Selected.Equals(true)).Count() == ConfigCompanyCollectionView.SourceCollection.Cast <ConfigCompany>().ToList().Count()
                        )
                        ||
                        (
                            ((Candidate)item).CandidateProjects.Join((ConfigProjectsLibsView.Cast <ConfigProjectsLib>().Where(e => e.Selected.Equals(true))).ToList(), cp => cp.ConfigProjectLibID, cpl => cpl.Id, (cp, cpl) => cp.ConfigCandidateID).ToList().Count > 0
                            &&
                            ((Candidate)item).CandidateProjects.Join((ConfigCompanyCollectionView.Cast <ConfigCompany>().Where(e => e.Selected.Equals(true))).ToList(), cc => cc.CompanyId, ccc => ccc.ID, (cc, ccc) => cc).ToList().Count > 0

                        )

                    )
                    &&
                    (string.IsNullOrEmpty(PositionNameFilter)
                     ||
                     ((Candidate)item).CandidateProjects.Where(e => e.Position.ToLower().Contains(PositionNameFilter.ToLower())).Count() > 0
                    )

                    )
                {
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 3
0
 public Result InsertNote(Note note)
 {
     if (!PhoneNumberFilter.IsMatch(note.phoneNumber) ||
         notesByPhoneNumber.ContainsKey(note.phoneNumber))
     {
         return(Result.InvalidPhoneNumber);
     }
     if (!NameFilter.IsMatch(note.surname))
     {
         return(Result.InvalidSurname);
     }
     if (!NameFilter.IsMatch(note.name))
     {
         return(Result.InvalidName);
     }
     notesSortedByName.Add(note);
     notesSortedByName.Sort();
     notesByPhoneNumber.Add(note.phoneNumber, note);
     return(Result.Success);
 }