public virtual OrganizationStateCreatedDto ToOrganizationStateCreatedDto(IOrganizationStateCreated e)
        {
            var dto = new OrganizationStateCreatedDto();

            dto.StateEventId = new OrganizationStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt    = e.CreatedAt;
            dto.CreatedBy    = e.CreatedBy;
            dto.CommandId    = e.CommandId;
            dto.Name         = e.Name;
            dto.Description  = e.Description;
            dto.Type         = e.Type;
            dto.IsSummary    = e.IsSummary;
            dto.Active       = e.Active;
            return(dto);
        }
Esempio n. 2
0
        public virtual void When(IOrganizationStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Name = e.Name;

            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;
        }
Esempio n. 3
0
        protected virtual IOrganizationStateCreated Map(ICreateOrganization c)
        {
            var stateEventId            = new OrganizationStateEventId(c.OrganizationId, c.Version);
            IOrganizationStateCreated e = NewOrganizationStateCreated(stateEventId);

            e.Name        = c.Name;
            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 = DateTime.Now;
            var version = c.Version;


            return(e);
        }
Esempio n. 4
0
 void IOrganizationState.When(IOrganizationStateCreated e)
 {
     throw new NotSupportedException();
 }
Esempio n. 5
0
        public virtual void Create(ICreateOrganization c)
        {
            IOrganizationStateCreated e = Map(c);

            Apply(e);
        }