Exemplo n.º 1
0
        protected virtual IContactMechStateMergePatched Map(IMergePatchContactMech c)
        {
            var stateEventId = new ContactMechEventId(c.ContactMechId, c.Version);
            IContactMechStateMergePatched e = NewContactMechStateMergePatched(stateEventId);

            e.ContactMechTypeId = c.ContactMechTypeId;
            e.InfoString        = c.InfoString;
            e.ToName            = c.ToName;
            e.AttnName          = c.AttnName;
            e.Address1          = c.Address1;
            e.Address2          = c.Address2;
            e.Directions        = c.Directions;
            e.City               = c.City;
            e.PostalCode         = c.PostalCode;
            e.PostalCodeExt      = c.PostalCodeExt;
            e.CountryGeoId       = c.CountryGeoId;
            e.StateProvinceGeoId = c.StateProvinceGeoId;
            e.CountyGeoId        = c.CountyGeoId;
            e.PostalCodeGeoId    = c.PostalCodeGeoId;
            e.GeoPointId         = c.GeoPointId;
            e.CountryCode        = c.CountryCode;
            e.AreaCode           = c.AreaCode;
            e.ContactNumber      = c.ContactNumber;
            e.AskForName         = c.AskForName;
            e.Active             = c.Active;
            e.IsPropertyContactMechTypeIdRemoved = c.IsPropertyContactMechTypeIdRemoved;
            e.IsPropertyInfoStringRemoved        = c.IsPropertyInfoStringRemoved;
            e.IsPropertyToNameRemoved            = c.IsPropertyToNameRemoved;
            e.IsPropertyAttnNameRemoved          = c.IsPropertyAttnNameRemoved;
            e.IsPropertyAddress1Removed          = c.IsPropertyAddress1Removed;
            e.IsPropertyAddress2Removed          = c.IsPropertyAddress2Removed;
            e.IsPropertyDirectionsRemoved        = c.IsPropertyDirectionsRemoved;
            e.IsPropertyCityRemoved               = c.IsPropertyCityRemoved;
            e.IsPropertyPostalCodeRemoved         = c.IsPropertyPostalCodeRemoved;
            e.IsPropertyPostalCodeExtRemoved      = c.IsPropertyPostalCodeExtRemoved;
            e.IsPropertyCountryGeoIdRemoved       = c.IsPropertyCountryGeoIdRemoved;
            e.IsPropertyStateProvinceGeoIdRemoved = c.IsPropertyStateProvinceGeoIdRemoved;
            e.IsPropertyCountyGeoIdRemoved        = c.IsPropertyCountyGeoIdRemoved;
            e.IsPropertyPostalCodeGeoIdRemoved    = c.IsPropertyPostalCodeGeoIdRemoved;
            e.IsPropertyGeoPointIdRemoved         = c.IsPropertyGeoPointIdRemoved;
            e.IsPropertyCountryCodeRemoved        = c.IsPropertyCountryCodeRemoved;
            e.IsPropertyAreaCodeRemoved           = c.IsPropertyAreaCodeRemoved;
            e.IsPropertyContactNumberRemoved      = c.IsPropertyContactNumberRemoved;
            e.IsPropertyAskForNameRemoved         = c.IsPropertyAskForNameRemoved;
            e.IsPropertyActiveRemoved             = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            var version = c.Version;


            return(e);
        }
Exemplo n.º 2
0
        public virtual void MergePatch(IMergePatchContactMech c)
        {
            IContactMechStateMergePatched e = Map(c);

            Apply(e);
        }
Exemplo n.º 3
0
 void IContactMechState.When(IContactMechStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 4
0
        public virtual ContactMechStateMergePatchedDto ToContactMechStateMergePatchedDto(IContactMechStateMergePatched e)
        {
            var dto = new ContactMechStateMergePatchedDto();

            dto.ContactMechEventId = e.ContactMechEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.CommandId          = e.CommandId;
            dto.ContactMechTypeId  = e.ContactMechTypeId;
            dto.InfoString         = e.InfoString;
            dto.ToName             = e.ToName;
            dto.AttnName           = e.AttnName;
            dto.Address1           = e.Address1;
            dto.Address2           = e.Address2;
            dto.Directions         = e.Directions;
            dto.City               = e.City;
            dto.PostalCode         = e.PostalCode;
            dto.PostalCodeExt      = e.PostalCodeExt;
            dto.CountryGeoId       = e.CountryGeoId;
            dto.StateProvinceGeoId = e.StateProvinceGeoId;
            dto.CountyGeoId        = e.CountyGeoId;
            dto.PostalCodeGeoId    = e.PostalCodeGeoId;
            dto.GeoPointId         = e.GeoPointId;
            dto.CountryCode        = e.CountryCode;
            dto.AreaCode           = e.AreaCode;
            dto.ContactNumber      = e.ContactNumber;
            dto.AskForName         = e.AskForName;
            dto.Active             = e.Active;
            dto.IsPropertyContactMechTypeIdRemoved = e.IsPropertyContactMechTypeIdRemoved;
            dto.IsPropertyInfoStringRemoved        = e.IsPropertyInfoStringRemoved;
            dto.IsPropertyToNameRemoved            = e.IsPropertyToNameRemoved;
            dto.IsPropertyAttnNameRemoved          = e.IsPropertyAttnNameRemoved;
            dto.IsPropertyAddress1Removed          = e.IsPropertyAddress1Removed;
            dto.IsPropertyAddress2Removed          = e.IsPropertyAddress2Removed;
            dto.IsPropertyDirectionsRemoved        = e.IsPropertyDirectionsRemoved;
            dto.IsPropertyCityRemoved               = e.IsPropertyCityRemoved;
            dto.IsPropertyPostalCodeRemoved         = e.IsPropertyPostalCodeRemoved;
            dto.IsPropertyPostalCodeExtRemoved      = e.IsPropertyPostalCodeExtRemoved;
            dto.IsPropertyCountryGeoIdRemoved       = e.IsPropertyCountryGeoIdRemoved;
            dto.IsPropertyStateProvinceGeoIdRemoved = e.IsPropertyStateProvinceGeoIdRemoved;
            dto.IsPropertyCountyGeoIdRemoved        = e.IsPropertyCountyGeoIdRemoved;
            dto.IsPropertyPostalCodeGeoIdRemoved    = e.IsPropertyPostalCodeGeoIdRemoved;
            dto.IsPropertyGeoPointIdRemoved         = e.IsPropertyGeoPointIdRemoved;
            dto.IsPropertyCountryCodeRemoved        = e.IsPropertyCountryCodeRemoved;
            dto.IsPropertyAreaCodeRemoved           = e.IsPropertyAreaCodeRemoved;
            dto.IsPropertyContactNumberRemoved      = e.IsPropertyContactNumberRemoved;
            dto.IsPropertyAskForNameRemoved         = e.IsPropertyAskForNameRemoved;
            dto.IsPropertyActiveRemoved             = e.IsPropertyActiveRemoved;

            return(dto);
        }
Exemplo n.º 5
0
        public virtual void When(IContactMechStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ContactMechTypeId == null)
            {
                if (e.IsPropertyContactMechTypeIdRemoved)
                {
                    this.ContactMechTypeId = default(string);
                }
            }
            else
            {
                this.ContactMechTypeId = e.ContactMechTypeId;
            }

            if (e.InfoString == null)
            {
                if (e.IsPropertyInfoStringRemoved)
                {
                    this.InfoString = default(string);
                }
            }
            else
            {
                this.InfoString = e.InfoString;
            }

            if (e.ToName == null)
            {
                if (e.IsPropertyToNameRemoved)
                {
                    this.ToName = default(string);
                }
            }
            else
            {
                this.ToName = e.ToName;
            }

            if (e.AttnName == null)
            {
                if (e.IsPropertyAttnNameRemoved)
                {
                    this.AttnName = default(string);
                }
            }
            else
            {
                this.AttnName = e.AttnName;
            }

            if (e.Address1 == null)
            {
                if (e.IsPropertyAddress1Removed)
                {
                    this.Address1 = default(string);
                }
            }
            else
            {
                this.Address1 = e.Address1;
            }

            if (e.Address2 == null)
            {
                if (e.IsPropertyAddress2Removed)
                {
                    this.Address2 = default(string);
                }
            }
            else
            {
                this.Address2 = e.Address2;
            }

            if (e.Directions == null)
            {
                if (e.IsPropertyDirectionsRemoved)
                {
                    this.Directions = default(string);
                }
            }
            else
            {
                this.Directions = e.Directions;
            }

            if (e.City == null)
            {
                if (e.IsPropertyCityRemoved)
                {
                    this.City = default(string);
                }
            }
            else
            {
                this.City = e.City;
            }

            if (e.PostalCode == null)
            {
                if (e.IsPropertyPostalCodeRemoved)
                {
                    this.PostalCode = default(string);
                }
            }
            else
            {
                this.PostalCode = e.PostalCode;
            }

            if (e.PostalCodeExt == null)
            {
                if (e.IsPropertyPostalCodeExtRemoved)
                {
                    this.PostalCodeExt = default(string);
                }
            }
            else
            {
                this.PostalCodeExt = e.PostalCodeExt;
            }

            if (e.CountryGeoId == null)
            {
                if (e.IsPropertyCountryGeoIdRemoved)
                {
                    this.CountryGeoId = default(string);
                }
            }
            else
            {
                this.CountryGeoId = e.CountryGeoId;
            }

            if (e.StateProvinceGeoId == null)
            {
                if (e.IsPropertyStateProvinceGeoIdRemoved)
                {
                    this.StateProvinceGeoId = default(string);
                }
            }
            else
            {
                this.StateProvinceGeoId = e.StateProvinceGeoId;
            }

            if (e.CountyGeoId == null)
            {
                if (e.IsPropertyCountyGeoIdRemoved)
                {
                    this.CountyGeoId = default(string);
                }
            }
            else
            {
                this.CountyGeoId = e.CountyGeoId;
            }

            if (e.PostalCodeGeoId == null)
            {
                if (e.IsPropertyPostalCodeGeoIdRemoved)
                {
                    this.PostalCodeGeoId = default(string);
                }
            }
            else
            {
                this.PostalCodeGeoId = e.PostalCodeGeoId;
            }

            if (e.GeoPointId == null)
            {
                if (e.IsPropertyGeoPointIdRemoved)
                {
                    this.GeoPointId = default(string);
                }
            }
            else
            {
                this.GeoPointId = e.GeoPointId;
            }

            if (e.CountryCode == null)
            {
                if (e.IsPropertyCountryCodeRemoved)
                {
                    this.CountryCode = default(string);
                }
            }
            else
            {
                this.CountryCode = e.CountryCode;
            }

            if (e.AreaCode == null)
            {
                if (e.IsPropertyAreaCodeRemoved)
                {
                    this.AreaCode = default(string);
                }
            }
            else
            {
                this.AreaCode = e.AreaCode;
            }

            if (e.ContactNumber == null)
            {
                if (e.IsPropertyContactNumberRemoved)
                {
                    this.ContactNumber = default(string);
                }
            }
            else
            {
                this.ContactNumber = e.ContactNumber;
            }

            if (e.AskForName == null)
            {
                if (e.IsPropertyAskForNameRemoved)
                {
                    this.AskForName = default(string);
                }
            }
            else
            {
                this.AskForName = e.AskForName;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }