示例#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>(),
     });
 }
示例#2
0
        public override SalaryModel Deconvert(IGetValues values, IDeconverterErrors errors)
        {
            var lowerBound = values.GetDecimalValue("LowerBound");
            var upperBound = values.GetDecimalValue("UpperBound");

            if (lowerBound == null && upperBound == null)
            {
                return(null);
            }
            return(new SalaryModel {
                LowerBound = lowerBound, UpperBound = upperBound
            });
        }
示例#3
0
        private static void DeconvertSalary(JobAdModel jobAd, IGetValues values)
        {
            var lowerBound = values.GetDecimalValue(Keys.SalaryLowerBound);
            var upperBound = values.GetDecimalValue(Keys.SalaryUpperBound);

            if (lowerBound != null || upperBound != null)
            {
                jobAd.Salary = new Salary {
                    LowerBound = lowerBound, UpperBound = upperBound, Currency = Currency.AUD, Rate = SalaryRate.Year
                }
            }
            ;
        }
    }
        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
                }
            }
            ;
        }
示例#5
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
                    }
                };
            }
        }
 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,
     });
 }
 public override PersonalDetailsMemberModel Deconvert(IGetValues values, IDeconverterErrors errors)
 {
     return(new PersonalDetailsMemberModel
     {
         FirstName = values.GetStringValue("FirstName"),
         LastName = values.GetStringValue("LastName"),
         EmailAddress = values.GetStringValue("EmailAddress"),
         CountryId = values.GetIntValue("CountryId") ?? 0,
         Location = values.GetStringValue("Location"),
         PhoneNumber = values.GetStringValue("PhoneNumber"),
         PhoneNumberType = values.GetValue <PhoneNumberType>("PhoneNumberType") ?? Defaults.PrimaryPhoneNumberType,
         Status = values.GetValue <CandidateStatus>("Status"),
         SalaryLowerBound = values.GetDecimalValue("SalaryLowerBound"),
         SalaryRate = values.GetValue <SalaryRate>("SalaryRate") ?? Defaults.DesiredSalaryRate,
         Visibility = BindVisibility(values),
     });
 }