Ejemplo n.º 1
0
        protected virtual IPartyStateCreated Map(ICreateParty c)
        {
            var stateEventId     = new PartyEventId(c.PartyId, c.Version);
            IPartyStateCreated e = NewPartyStateCreated(stateEventId);

            e.PartyTypeId            = c.PartyTypeId;
            e.PrimaryRoleTypeId      = c.PrimaryRoleTypeId;
            e.ExternalId             = c.ExternalId;
            e.PreferredCurrencyUomId = c.PreferredCurrencyUomId;
            e.Description            = c.Description;
            e.OrganizationName       = c.OrganizationName;
            e.IsSummary     = c.IsSummary;
            e.Salutation    = c.Salutation;
            e.FirstName     = c.FirstName;
            e.MiddleName    = c.MiddleName;
            e.LastName      = c.LastName;
            e.PersonalTitle = c.PersonalTitle;
            e.Nickname      = c.Nickname;
            e.CardId        = c.CardId;
            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);
        }
Ejemplo n.º 2
0
        public virtual PartyStateCreatedDto ToPartyStateCreatedDto(IPartyStateCreated e)
        {
            var dto = new PartyStateCreatedDto();

            dto.PartyEventId           = e.PartyEventId;
            dto.CreatedAt              = e.CreatedAt;
            dto.CreatedBy              = e.CreatedBy;
            dto.CommandId              = e.CommandId;
            dto.PartyTypeId            = e.PartyTypeId;
            dto.PrimaryRoleTypeId      = e.PrimaryRoleTypeId;
            dto.ExternalId             = e.ExternalId;
            dto.PreferredCurrencyUomId = e.PreferredCurrencyUomId;
            dto.Description            = e.Description;
            dto.OrganizationName       = e.OrganizationName;
            dto.IsSummary              = e.IsSummary;
            dto.Salutation             = e.Salutation;
            dto.FirstName              = e.FirstName;
            dto.MiddleName             = e.MiddleName;
            dto.LastName      = e.LastName;
            dto.PersonalTitle = e.PersonalTitle;
            dto.Nickname      = e.Nickname;
            dto.CardId        = e.CardId;
            dto.Active        = e.Active;
            return(dto);
        }
Ejemplo n.º 3
0
        public virtual void Initialize(IPartyStateCreated stateCreated)
        {
            var aggregateId = stateCreated.PartyEventId.PartyId;
            var state       = new PartyState();

            state.PartyId = aggregateId;
            var aggregate = (PartyAggregate)GetPartyAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Ejemplo n.º 4
0
        public virtual PartyStateCreatedDto ToPartyStateCreatedDto(IPartyStateCreated e)
        {
            var dto = new PartyStateCreatedDto();

            dto.PartyEventId      = e.PartyEventId;
            dto.CreatedAt         = e.CreatedAt;
            dto.CreatedBy         = e.CreatedBy;
            dto.CommandId         = e.CommandId;
            dto.PartyTypeId       = e.PartyTypeId;
            dto.PrimaryRoleTypeId = e.PrimaryRoleTypeId;
            dto.OrganizationName  = e.OrganizationName;
            dto.Description       = e.Description;
            dto.Type      = e.Type;
            dto.IsSummary = e.IsSummary;
            dto.Active    = e.Active;
            return(dto);
        }
Ejemplo n.º 5
0
        protected virtual IPartyStateCreated Map(ICreateParty c)
        {
            var stateEventId     = new PartyEventId(c.PartyId, c.Version);
            IPartyStateCreated e = NewPartyStateCreated(stateEventId);

            e.PartyTypeId       = c.PartyTypeId;
            e.PrimaryRoleTypeId = c.PrimaryRoleTypeId;
            e.OrganizationName  = c.OrganizationName;
            e.Description       = c.Description;
            e.Type      = c.Type;
            e.IsSummary = c.IsSummary;
            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);
        }
Ejemplo n.º 6
0
        public virtual void When(IPartyStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.PartyTypeId = e.PartyTypeId;

            this.PrimaryRoleTypeId = e.PrimaryRoleTypeId;

            this.OrganizationName = e.OrganizationName;

            this.Description = e.Description;

            this.Type = e.Type;

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

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 7
0
        public virtual void When(IPartyStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.PartyTypeId = e.PartyTypeId;

            this.PrimaryRoleTypeId = e.PrimaryRoleTypeId;

            this.ExternalId = e.ExternalId;

            this.PreferredCurrencyUomId = e.PreferredCurrencyUomId;

            this.Description = e.Description;

            this.OrganizationName = e.OrganizationName;

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

            this.Salutation = e.Salutation;

            this.FirstName = e.FirstName;

            this.MiddleName = e.MiddleName;

            this.LastName = e.LastName;

            this.PersonalTitle = e.PersonalTitle;

            this.Nickname = e.Nickname;

            this.CardId = e.CardId;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 8
0
 void IPartyState.When(IPartyStateCreated e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 9
0
        public virtual void Create(ICreateParty c)
        {
            IPartyStateCreated e = Map(c);

            Apply(e);
        }