Пример #1
0
        protected virtual IContactMechStateCreated Map(ICreateContactMech c)
        {
            var stateEventId           = new ContactMechEventId(c.ContactMechId, c.Version);
            IContactMechStateCreated e = NewContactMechStateCreated(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.CommandId          = c.CommandId;


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


            return(e);
        }
Пример #2
0
        public virtual ContactMechStateCreatedDto ToContactMechStateCreatedDto(IContactMechStateCreated e)
        {
            var dto = new ContactMechStateCreatedDto();

            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;
            return(dto);
        }
Пример #3
0
        public virtual void Initialize(IContactMechStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ContactMechEventId.ContactMechId;
            var state       = new ContactMechState();

            state.ContactMechId = aggregateId;
            var aggregate = (ContactMechAggregate)GetContactMechAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Пример #4
0
        public virtual void When(IContactMechStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ContactMechTypeId = e.ContactMechTypeId;

            this.InfoString = e.InfoString;

            this.ToName = e.ToName;

            this.AttnName = e.AttnName;

            this.Address1 = e.Address1;

            this.Address2 = e.Address2;

            this.Directions = e.Directions;

            this.City = e.City;

            this.PostalCode = e.PostalCode;

            this.PostalCodeExt = e.PostalCodeExt;

            this.CountryGeoId = e.CountryGeoId;

            this.StateProvinceGeoId = e.StateProvinceGeoId;

            this.CountyGeoId = e.CountyGeoId;

            this.PostalCodeGeoId = e.PostalCodeGeoId;

            this.GeoPointId = e.GeoPointId;

            this.CountryCode = e.CountryCode;

            this.AreaCode = e.AreaCode;

            this.ContactNumber = e.ContactNumber;

            this.AskForName = e.AskForName;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Пример #5
0
        public virtual void Create(ICreateContactMech c)
        {
            IContactMechStateCreated e = Map(c);

            Apply(e);
        }
Пример #6
0
 void IContactMechState.When(IContactMechStateCreated e)
 {
     throw new NotSupportedException();
 }