public void Update(ConsumerPreference preference)
        {
            // update all values
            this.MaxDistance = MathHelper.RoundMaxDistance(preference.MaxDistance);
            this.InternmentType.Update(preference.InternmentType);
            this.FuneralType.Update(preference.FuneralType);
            this.WakeType.Update(preference.WakeType);
            this.ExpectedAttendanceType.Update(preference.ExpectedAttendanceType);
            this.ServicePreferences = preference.ServicePreferences;
            this.RemainsChoiceType  = preference.RemainsChoiceType;
            this.CasketMaterialType.Update(preference.CasketMaterialType);
            this.CasketSizeType.Update(preference.CasketSizeType);
            this.CasketColorType.Update(preference.CasketColorType);
            this.CasketManufacturerType.Update(preference.CasketManufacturerType);
            this.BurialContainerType.Update(preference.BurialContainerType);
            this.TransportationChoiceType   = preference.TransportationChoiceType;
            this.TransportationOfFamilyType = preference.TransportationOfFamilyType;
            this.FlowerSprayType.Update(preference.FlowerSprayType);
            this.PrimaryFlowerType.Update(preference.PrimaryFlowerType);
            this.SecondaryFlowerType.Update(preference.SecondaryFlowerType);
            this.AccentFlowerType.Update(preference.AccentFlowerType);
            this.ReligionType.Update(preference.ReligionType);

            this.Proximity.Update(preference.Proximity);
        }
        public bool HasChanged(ConsumerPreference preference)
        {
            if (preference == null)
            {
                return(false);
            }

            if (this.MaxDistance != preference.MaxDistance)
            {
                return(true);
            }

            if (this.Proximity.HasChanged(preference.Proximity))
            {
                return(true);
            }

            if (this.InternmentType.HasChanged(preference.InternmentType) ||
                this.FuneralType.HasChanged(preference.FuneralType) ||
                this.WakeType.HasChanged(preference.WakeType) ||
                this.ReligionType.HasChanged(preference.ReligionType) ||
                this.ExpectedAttendanceType.HasChanged(preference.ExpectedAttendanceType) ||
                this.ServicePreferences != preference.ServicePreferences ||
                this.RemainsChoiceType != preference.RemainsChoiceType ||
                this.CasketMaterialType.HasChanged(preference.CasketMaterialType) ||
                this.CasketSizeType.HasChanged(preference.CasketSizeType) ||
                this.CasketColorType.HasChanged(preference.CasketColorType) ||
                this.CasketManufacturerType.HasChanged(preference.CasketManufacturerType) ||
                this.BurialContainerType.HasChanged(preference.BurialContainerType) ||
                this.TransportationChoiceType != preference.TransportationChoiceType ||
                this.TransportationOfFamilyType.HasChanged(preference.TransportationOfFamilyType) ||
                this.FlowerSprayType.HasChanged(preference.FlowerSprayType) ||
                this.PrimaryFlowerType.HasChanged(preference.PrimaryFlowerType) ||
                this.SecondaryFlowerType.HasChanged(preference.SecondaryFlowerType) ||
                this.AccentFlowerType.HasChanged(preference.AccentFlowerType))
            {
                return(true);
            }

            return(false);
        }
Exemple #3
0
        public static IRuleBuilderOptions <T, object> HasPreference <T>(this IRuleBuilder <T, object> rule, ConsumerPreference instance, string propertyName)
        {
            return(rule.Must(value =>
            {
                var preference = instance.AsGenericType(propertyName);

                // if this user has not selected anything:
                if (preference.Value == GenericTypes.NA)
                {
                    return false;
                }

                // if user specified, make sure the consumer has typed in a value
                if (preference.Value == GenericTypes.UserSpecified)
                {
                    return !string.IsNullOrEmpty(Convert.ToString(preference.Specified));
                }

                return true;
            }));
        }