Example #1
0
 public override MockModelValues Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new MockModelValues
     {
         NullStringValue = values.GetStringValue("NullStringValue"),
         NotNullStringValue = values.GetStringValue("NotNullStringValue"),
         NullStringArrayValue = values.GetStringArrayValue("NullStringArrayValue"),
         NotNullStringArrayValue = values.GetStringArrayValue("NotNullStringArrayValue"),
         NullBoolValue = values.GetBooleanValue("NullBoolValue"),
         NotNullBoolValue = values.GetBooleanValue("NotNullBoolValue"),
         BoolValue = values.GetBooleanValue("BoolValue") ?? false,
         NullIntValue = values.GetIntValue("NullIntValue"),
         NotNullIntValue = values.GetIntValue("NotNullIntValue"),
         IntValue = values.GetIntValue("IntValue") ?? 0,
         NullDecimalValue = values.GetDecimalValue("NullDecimalValue"),
         NotNullDecimalValue = values.GetDecimalValue("NotNullDecimalValue"),
         DecimalValue = values.GetDecimalValue("DecimalValue") ?? 0,
         NullGuidValue = values.GetGuidValue("NullGuidValue"),
         NotNullGuidValue = values.GetGuidValue("NotNullGuidValue"),
         GuidValue = values.GetGuidValue("GuidValue") ?? Guid.Empty,
         NullGuidArrayValue = values.GetGuidArrayValue("NullGuidArrayValue"),
         NotNullGuidArrayValue = values.GetGuidArrayValue("NotNullGuidArrayValue"),
         NullDateTimeValue = values.GetDateTimeValue("NullDateTimeValue"),
         NotNullDateTimeValue = values.GetDateTimeValue("NotNullDateTimeValue"),
         NullPartialDateValue = values.GetPartialDateValue("NullPartialDateValue"),
         NotNullPartialDateValue = values.GetPartialDateValue("NotNullPartialDateValue"),
         EnumValue = values.GetValue <EnumValue>("EnumValue") ?? EnumValue.No,
         NullEnumValue = values.GetValue <EnumValue>("NullEnumValue"),
         NotNullEnumValue = values.GetValue <EnumValue>("NotNullEnumValue"),
         EnumFlagsValue = values.GetFlagsValue <EnumFlagsValue1>() ?? EnumFlagsValue1.None,
         NullEnumFlagsValue = values.GetFlagsValue <EnumFlagsValue2>(),
         NotNullEnumFlagsValue = values.GetFlagsValue <EnumFlagsValue3>(),
     });
 }
Example #2
0
 private static void DeconvertActivity(JobAdSearchCriteria criteria, IGetValues values)
 {
     criteria.IsFlagged  = values.GetBooleanValue(JobAdSearchCriteriaKeys.IsFlagged);
     criteria.HasNotes   = values.GetBooleanValue(JobAdSearchCriteriaKeys.HasNotes);
     criteria.HasViewed  = values.GetBooleanValue(JobAdSearchCriteriaKeys.HasViewed);
     criteria.HasApplied = values.GetBooleanValue(JobAdSearchCriteriaKeys.HasApplied);
 }
 public override DisqusThreadResponse Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new DisqusThreadResponse
     {
         Category = values.GetIntValue("category").Value,
         Reactions = values.GetIntValue("reactions").Value,
         CanModerate = values.GetBooleanValue("canModerate").Value,
         Author = values.GetIntValue("author").Value,
         Forum = values.GetStringValue("forum"),
         Title = values.GetStringValue("title"),
         Dislikes = values.GetIntValue("dislikes").Value,
         Identifiers = values.GetGuidArrayValue("identifiers"),
         UserScore = values.GetIntValue("userScore").Value,
         CreatedAt = values.GetDateTimeValue("createdAt").Value,
         Slug = values.GetStringValue("slug"),
         IsClosed = values.GetBooleanValue("isClosed").Value,
         Posts = values.GetIntValue("posts").Value,
         UserSubscription = values.GetBooleanValue("userSubscription").Value,
         Link = values.GetStringValue("link"),
         Likes = values.GetIntValue("likes").Value,
         CanPost = values.GetBooleanValue("canPost").Value,
         Id = values.GetIntValue("id").Value,
         IsDeleted = values.GetBooleanValue("isDeleted").Value,
     });
 }
 private static void DeconvertActivity(MemberSearchCriteria criteria, IGetValues values)
 {
     criteria.InFolder   = values.GetBooleanValue(MemberSearchCriteriaKeys.InFolder);
     criteria.IsFlagged  = values.GetBooleanValue(MemberSearchCriteriaKeys.IsFlagged);
     criteria.HasNotes   = values.GetBooleanValue(MemberSearchCriteriaKeys.HasNotes);
     criteria.HasViewed  = values.GetBooleanValue(MemberSearchCriteriaKeys.HasViewed);
     criteria.IsUnlocked = values.GetBooleanValue(MemberSearchCriteriaKeys.IsUnlocked);
 }
 public override VisibilityModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new VisibilityModel
     {
         ShowResume = values.GetBooleanValue(VisibilityKeys.ShowResume) ?? false,
         ShowRecentEmployers = values.GetBooleanValue(VisibilityKeys.ShowRecentEmployers) ?? false,
         ShowName = values.GetBooleanValue(VisibilityKeys.ShowName) ?? false,
         ShowPhoneNumbers = values.GetBooleanValue(VisibilityKeys.ShowPhoneNumbers) ?? false,
         ShowProfilePhoto = values.GetBooleanValue(VisibilityKeys.ShowProfilePhoto) ?? false,
     });
 }
 public override OrganisationEmployerSearchCriteria Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new OrganisationEmployerSearchCriteria
     {
         Employers = values.GetBooleanValue("Employers") ?? true,
         Recruiters = values.GetBooleanValue("Recruiters") ?? true,
         VerifiedOrganisations = values.GetBooleanValue("VerifiedOrganisations") ?? true,
         UnverifiedOrganisations = values.GetBooleanValue("UnverifiedOrganisations") ?? true,
         IndustryIds = values.GetGuidArrayValue("IndustryIds"),
         MinimumLogins = values.GetIntValue("MinimumLogins"),
         MaximumLogins = values.GetIntValue("MaximumLogins")
     });
 }
 public override DesiredJobMemberModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new DesiredJobMemberModel
     {
         DesiredJobTitle = values.GetStringValue(DesiredJobKeys.DesiredJobTitle),
         DesiredJobTypes = values.GetFlagsValue <JobTypes>() ?? Defaults.DesiredJobTypes,
         Status = values.GetValue <CandidateStatus>(DesiredJobKeys.Status) ?? Defaults.CandidateStatus,
         DesiredSalaryLowerBound = values.GetDecimalValue(DesiredJobKeys.DesiredSalaryLowerBound),
         DesiredSalaryRate = values.GetValue <SalaryRate>(DesiredJobKeys.DesiredSalaryRate) ?? Defaults.DesiredSalaryRate,
         IsSalaryNotVisible = values.GetBooleanValue(DesiredJobKeys.IsSalaryNotVisible) ?? !Defaults.SalaryVisibility,
         RelocationPreference = values.GetValue <RelocationPreference>(DesiredJobKeys.RelocationPreference) ?? Defaults.RelocationPreference,
         RelocationCountryIds = values.GetIntArrayValue(DesiredJobKeys.RelocationCountryIds),
         RelocationCountryLocationIds = values.GetIntArrayValue(DesiredJobKeys.RelocationCountryLocationIds),
         SendSuggestedJobs = values.GetBooleanValue(DesiredJobKeys.SendSuggestedJobs) ?? Defaults.SendSuggestedJobs,
     });
 }
Example #8
0
        public override JobAdModel Deconvert(IGetValues values, IDeconverterErrors errors)
        {
            var jobAd = new JobAdModel
            {
                Title               = values.GetStringValue(Keys.Title),
                PositionTitle       = values.GetStringValue(Keys.PositionTitle),
                ExternalReferenceId = values.GetStringValue(Keys.ExternalReferenceId),
                BulletPoints        = new[]
                {
                    values.GetStringValue(Keys.BulletPoint1),
                    values.GetStringValue(Keys.BulletPoint2),
                    values.GetStringValue(Keys.BulletPoint3)
                }.Where(b => !string.IsNullOrEmpty(b)).ToArray(),
                Summary            = values.GetStringValue(Keys.Summary),
                Content            = values.GetStringValue(Keys.Content),
                CompanyName        = values.GetStringValue(Keys.CompanyName),
                HideCompany        = values.GetBooleanValue(Keys.HideCompany) ?? true,
                Package            = values.GetStringValue(Keys.Package),
                ResidencyRequired  = values.GetBooleanValue(Keys.ResidencyRequired) ?? true,
                ExpiryTime         = values.GetDateTimeValue(Keys.ExpiryTime),
                HideContactDetails = values.GetBooleanValue(Keys.HideContactDetails) ?? true,
                ContactDetails     = new ContactDetails
                {
                    FirstName               = values.GetStringValue(Keys.FirstName),
                    LastName                = values.GetStringValue(Keys.LastName),
                    EmailAddress            = values.GetStringValue(Keys.EmailAddress),
                    SecondaryEmailAddresses = values.GetStringValue(Keys.SecondaryEmailAddresses),
                    FaxNumber               = values.GetStringValue(Keys.FaxNumber),
                    PhoneNumber             = values.GetStringValue(Keys.PhoneNumber),
                },
                IndustryIds = values.GetGuidArrayValue(Keys.IndustryIds)
            };

            DeconvertLocation(jobAd, values);
            DeconvertSalary(jobAd, values);

            var jobTypes = values.GetFlagsValue <JobTypes>();

            if (jobTypes != null)
            {
                jobAd.JobTypes = jobTypes.Value;
            }

            return(jobAd);
        }
Example #9
0
        private static void DeconvertIncludeSynonyms(JobAdSearchCriteria criteria, IGetValues values)
        {
            var includeSynonyms = values.GetBooleanValue(JobAdSearchCriteriaKeys.IncludeSynonyms);

            if (includeSynonyms != null)
            {
                criteria.IncludeSynonyms = includeSynonyms.Value;
            }
        }
        private static void DeconvertName(MemberSearchCriteria criteria, IGetValues values)
        {
            criteria.Name = values.GetStringValue(MemberSearchCriteriaKeys.Name);
            var includeSimiliarNames = values.GetBooleanValue(MemberSearchCriteriaKeys.IncludeSimilarNames);

            if (includeSimiliarNames != null)
            {
                criteria.IncludeSimilarNames = includeSimiliarNames.Value;
            }
        }
 public override MemberSearchRequestModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new MemberSearchRequestModel
     {
         Name = values.GetStringValue("Name"),
         IsAlert = values.GetBooleanValue("IsAlert").Value,
         Criteria = values.GetChildValue <MemberSearchCriteria>("Criteria"),
         DeviceToken = values.GetStringValue("DeviceToken"),
     });
 }
Example #12
0
 public override JobModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new JobModel
     {
         Title = values.GetStringValue("Title"),
         IsCurrent = values.GetBooleanValue("IsCurrent") ?? false,
         StartDate = values.GetPartialDateValue("StartDate"),
         EndDate = values.GetPartialDateValue("EndDate"),
         Company = values.GetStringValue("Company"),
     });
 }
Example #13
0
 public override CandidateModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new CandidateModel
     {
         Id = values.GetGuidValue("Id").Value,
         CanContact = values.GetValue <CanContactStatus>("CanContact").Value,
         CanContactByPhone = values.GetValue <CanContactStatus>("CanContactByPhone").Value,
         HasBeenViewed = values.GetBooleanValue("HasBeenViewed").Value,
         HasBeenAccessed = values.GetBooleanValue("HasBeenAccessed").Value,
         IsInMobileFolder = values.GetBooleanValue("IsInMobileFolder").Value,
         FullName = values.GetStringValue("FullName"),
         PhoneNumbers = values.GetStringArrayValue("PhoneNumbers"),
         Status = values.GetValue <CandidateStatus>("Status").Value,
         LastUpdatedTime = values.GetDateTimeValue("LastUpdatedTime"),
         Location = values.GetStringValue("Location"),
         DesiredJobTitle = values.GetStringValue("DesiredJobTitle"),
         DesiredJobTypes = values.GetFlagsValue <JobTypes>() ?? JobTypes.None,
         Summary = values.GetStringValue("Summary"),
         DesiredSalary = values.GetChildValue <SalaryModel>("DesiredSalary"),
         Jobs = values.GetArrayValue <JobModel>("Jobs"),
     });
 }
        private static ProfessionalVisibility BindVisibility(IGetValues values)
        {
            var visibility = ProfessionalVisibility.None;

            var resumeVisibility = values.GetBooleanValue("ResumeVisibility");

            if (resumeVisibility != null && resumeVisibility.Value)
            {
                visibility = visibility.SetFlag(ProfessionalVisibility.Resume);

                var nameVisibility            = values.GetBooleanValue("NameVisibility");
                var phoneNumbersVisibility    = values.GetBooleanValue("PhoneNumbersVisibility");
                var recentEmployersVisibility = values.GetBooleanValue("RecentEmployersVisibility");

                if (nameVisibility != null && nameVisibility.Value)
                {
                    visibility = visibility.SetFlag(ProfessionalVisibility.Name);
                }
                if (phoneNumbersVisibility != null && phoneNumbersVisibility.Value)
                {
                    visibility = visibility.SetFlag(ProfessionalVisibility.PhoneNumbers);
                }
                if (recentEmployersVisibility != null && recentEmployersVisibility.Value)
                {
                    visibility = visibility.SetFlag(ProfessionalVisibility.RecentEmployers);
                }
            }

            // Salary is back to front.

            var notSalaryVisibility = values.GetBooleanValue("NotSalaryVisibility");

            if (notSalaryVisibility == null || !notSalaryVisibility.Value)
            {
                visibility = visibility.SetFlag(ProfessionalVisibility.Salary);
            }

            return(visibility);
        }
Example #15
0
        private static void DeconvertSalary(JobAdSearchCriteria criteria, IGetValues values)
        {
            var includeNoSalary = values.GetBooleanValue(JobAdSearchCriteriaKeys.IncludeNoSalary);
            var excludeNoSalary = values.GetBooleanValue(JobAdSearchCriteriaKeys.ExcludeNoSalary);

            if (includeNoSalary != null)
            {
                criteria.ExcludeNoSalary = !includeNoSalary.Value;
            }

            //override with new format "excludeNoSalary"
            if (excludeNoSalary != null)
            {
                criteria.ExcludeNoSalary = excludeNoSalary.Value;
            }

            // Look for old values if the new ones aren't found.

            var lowerBound = values.GetDecimalValue(JobAdSearchCriteriaKeys.SalaryLowerBound) ?? values.GetDecimalValue(JobAdSearchCriteriaKeys.MinSalary);
            var upperBound = values.GetDecimalValue(JobAdSearchCriteriaKeys.SalaryUpperBound) ?? values.GetDecimalValue(JobAdSearchCriteriaKeys.MaxSalary);
            var rate       = values.GetValue <SalaryRate>(JobAdSearchCriteriaKeys.SalaryRate);

            if (lowerBound != null || upperBound != null)
            {
                if (rate.HasValue && rate.Value.Equals(SalaryRate.Hour))
                {
                    criteria.Salary = new Salary {
                        LowerBound = lowerBound, UpperBound = upperBound, Currency = Currency.AUD, Rate = SalaryRate.Hour
                    };
                }
                else
                {
                    criteria.Salary = new Salary {
                        LowerBound = lowerBound, UpperBound = upperBound, Currency = Currency.AUD, Rate = SalaryRate.Year
                    }
                };
            }
        }
        private void DeconvertLocation(MemberSearchCriteria criteria, IGetValues values)
        {
            var location = values.GetStringValue(MemberSearchCriteriaKeys.Location);

            Country country   = null;
            var     countryId = values.GetIntValue(MemberSearchCriteriaKeys.CountryId);

            if (countryId != null)
            {
                country = _locationQuery.GetCountry(countryId.Value);
            }

            if (country != null)
            {
                criteria.Location = _locationQuery.ResolveLocation(country, location);
            }
            else if (!string.IsNullOrEmpty(location))
            {
                criteria.Location = _locationQuery.ResolveLocation(_locationQuery.GetCountries()[0], location);
            }

            criteria.Distance = values.GetIntValue(MemberSearchCriteriaKeys.Distance);

            var includeRelocating = values.GetBooleanValue(MemberSearchCriteriaKeys.IncludeRelocating);

            if (includeRelocating != null)
            {
                criteria.IncludeRelocating = includeRelocating.Value;
            }

            var includeInternational = values.GetBooleanValue(MemberSearchCriteriaKeys.IncludeInternational);

            if (includeInternational != null)
            {
                criteria.IncludeInternational = includeInternational.Value;
            }
        }
Example #17
0
 public override EducationUpdateModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new EducationUpdateModel
     {
         HighestEducationLevel = values.GetValue <EducationLevel>(EducationKeys.HighestEducationLevel),
         School = new SchoolModel
         {
             Id = values.GetGuidValue(EducationKeys.Id),
             City = values.GetStringValue(EducationKeys.City),
             EndDate = new PartialDateConverter(false).Deconvert(EducationKeys.EndDate, values),
             IsCurrent = values.GetBooleanValue(EducationKeys.IsCurrent),
             Description = values.GetStringValue(EducationKeys.Description),
             Institution = values.GetStringValue(EducationKeys.Institution),
             Major = values.GetStringValue(EducationKeys.Major),
             Degree = values.GetStringValue(EducationKeys.Degree),
         }
     });
 }
Example #18
0
 public override EmploymentHistoryUpdateModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new EmploymentHistoryUpdateModel
     {
         RecentProfession = values.GetValue <Profession>(EmploymentHistoryKeys.RecentProfession),
         RecentSeniority = values.GetValue <Seniority>(EmploymentHistoryKeys.RecentSeniority),
         IndustryIds = values.GetGuidArrayValue(EmploymentHistoryKeys.IndustryIds),
         Job = new JobModel
         {
             Id = values.GetGuidValue(EmploymentHistoryKeys.Id),
             Company = values.GetStringValue(EmploymentHistoryKeys.Company),
             Title = values.GetStringValue(EmploymentHistoryKeys.Title),
             Description = values.GetStringValue(EmploymentHistoryKeys.Description),
             StartDate = new PartialDateConverter(false).Deconvert(EmploymentHistoryKeys.StartDate, values),
             EndDate = new PartialDateConverter(false).Deconvert(EmploymentHistoryKeys.EndDate, values),
             IsCurrent = values.GetBooleanValue(EmploymentHistoryKeys.IsCurrent),
         },
     });
 }
        private static void DeconvertSalary(MemberSearchCriteria criteria, IGetValues values)
        {
            var excludeNoSalary = values.GetBooleanValue(MemberSearchCriteriaKeys.ExcludeNoSalary);

            if (excludeNoSalary != null)
            {
                criteria.ExcludeNoSalary = excludeNoSalary.Value;
            }

            var lowerBound = values.GetDecimalValue(MemberSearchCriteriaKeys.SalaryLowerBound);
            var upperBound = values.GetDecimalValue(MemberSearchCriteriaKeys.SalaryUpperBound);

            if (lowerBound != null || upperBound != null)
            {
                criteria.Salary = new Salary {
                    LowerBound = lowerBound, UpperBound = upperBound, Currency = Currency.AUD, Rate = SalaryRate.Year
                }
            }
            ;
        }