Exemple #1
0
        protected virtual IInOutStateDeleted Map(IDeleteInOut c)
        {
            var stateEventId     = new InOutStateEventId(c.DocumentNumber, c.Version);
            IInOutStateDeleted e = NewInOutStateDeleted(stateEventId);

            ReflectUtils.CopyPropertyValue("CommandId", c, e);


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;


            return(e);
        }
Exemple #2
0
        public virtual void When(IInOutStateDeleted e)
        {
            ThrowOnWrongEvent(e);

            this.Deleted   = true;
            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;

            foreach (var innerState in this.InOutLines)
            {
                this.InOutLines.Remove(innerState);

                var innerE = e.NewInOutLineStateRemoved(innerState.LineNumber);
                ((InOutLineStateEventBase)innerE).CreatedAt = e.CreatedAt;
                ((InOutLineStateEventBase)innerE).CreatedBy = e.CreatedBy;
                innerState.When(innerE);
                //e.AddInOutLineEvent(innerE);
            }
        }
Exemple #3
0
        public virtual InOutStateDeletedDto ToInOutStateDeletedDto(IInOutStateDeleted e)
        {
            var dto = new InOutStateDeletedDto();

            dto.StateEventId = new InOutStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt    = e.CreatedAt;
            dto.CreatedBy    = e.CreatedBy;
            dto.CommandId    = e.CommandId;
            var inOutLineEvents = new List <InOutLineStateRemovedDto>();

            foreach (var ee in e.InOutLineEvents)
            {
                InOutLineStateRemovedDto eeDto = InOutLineStateEventDtoConverter.ToInOutLineStateRemovedDto(ee);
                inOutLineEvents.Add(eeDto);
            }
            dto.InOutLineEvents = inOutLineEvents.ToArray();


            return(dto);
        }
Exemple #4
0
 void IInOutState.When(IInOutStateDeleted e)
 {
     throw new NotSupportedException();
 }
Exemple #5
0
        public virtual void Delete(IDeleteInOut c)
        {
            IInOutStateDeleted e = Map(c);

            Apply(e);
        }
 public void AddInOutEvent(IInOutStateDeleted e)
 {
     _innerStateEvents.Add((InOutStateDeletedDto)e);
 }