Esempio n. 1
0
        public virtual LotStateMergePatchedDto ToLotStateMergePatchedDto(ILotStateMergePatched e)
        {
            var dto = new LotStateMergePatchedDto();

            dto.LotEventId                      = e.LotEventId;
            dto.CreatedAt                       = e.CreatedAt;
            dto.CreatedBy                       = e.CreatedBy;
            dto.CommandId                       = e.CommandId;
            dto.Quantity                        = e.Quantity;
            dto.ExpirationDate                  = e.ExpirationDate;
            dto.Active                          = e.Active;
            dto.IsPropertyQuantityRemoved       = e.IsPropertyQuantityRemoved;
            dto.IsPropertyExpirationDateRemoved = e.IsPropertyExpirationDateRemoved;
            dto.IsPropertyActiveRemoved         = e.IsPropertyActiveRemoved;

            return(dto);
        }
Esempio n. 2
0
        public virtual void When(ILotStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Quantity == null)
            {
                if (e.IsPropertyQuantityRemoved)
                {
                    this.Quantity = default(decimal?);
                }
            }
            else
            {
                this.Quantity = e.Quantity;
            }

            if (e.ExpirationDate == null)
            {
                if (e.IsPropertyExpirationDateRemoved)
                {
                    this.ExpirationDate = default(DateTime?);
                }
            }
            else
            {
                this.ExpirationDate = e.ExpirationDate;
            }

            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;
        }
Esempio n. 3
0
        protected virtual ILotStateMergePatched Map(IMergePatchLot c)
        {
            var stateEventId        = new LotEventId(c.LotId, c.Version);
            ILotStateMergePatched e = NewLotStateMergePatched(stateEventId);

            e.Quantity                        = c.Quantity;
            e.ExpirationDate                  = c.ExpirationDate;
            e.Active                          = c.Active;
            e.IsPropertyQuantityRemoved       = c.IsPropertyQuantityRemoved;
            e.IsPropertyExpirationDateRemoved = c.IsPropertyExpirationDateRemoved;
            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);
        }
Esempio n. 4
0
        public virtual void MergePatch(IMergePatchLot c)
        {
            ILotStateMergePatched e = Map(c);

            Apply(e);
        }
Esempio n. 5
0
 void ILotState.When(ILotStateMergePatched e)
 {
     throw new NotSupportedException();
 }