Exemplo n.º 1
0
        public virtual void When(IOrderRoleStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Exemplo n.º 2
0
        public virtual OrderRoleStateCreatedDto ToOrderRoleStateCreatedDto(IOrderRoleStateCreated e)
        {
            var dto = new OrderRoleStateCreatedDto();

            dto.OrderRoleEventId = e.OrderRoleEventId;
            dto.CreatedAt        = e.CreatedAt;
            dto.CreatedBy        = e.CreatedBy;
            dto.Version          = e.Version;
            dto.CommandId        = e.CommandId;
            dto.Active           = e.Active;
            return(dto);
        }
Exemplo n.º 3
0
        protected virtual IOrderRoleStateCreated MapCreate(ICreateOrderRole c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId         = new OrderRoleEventId(c.OrderId, c.PartyRoleId, version);
            IOrderRoleStateCreated e = NewOrderRoleStateCreated(stateEventId);
            var s = outerState.OrderRoles.Get(c.PartyRoleId, true);

            e.Active = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
Exemplo n.º 4
0
 void IOrderStateCreated.AddOrderRoleEvent(IOrderRoleStateCreated e)
 {
     this._orderRoleEvents.AddOrderRoleEvent(e);
 }
Exemplo n.º 5
0
        protected virtual IOrderStateCreated Map(ICreateOrder c)
        {
            var stateEventId     = new OrderEventId(c.OrderId, c.Version);
            IOrderStateCreated e = NewOrderStateCreated(stateEventId);

            e.OrderTypeId             = c.OrderTypeId;
            e.OrderName               = c.OrderName;
            e.ExternalId              = c.ExternalId;
            e.SalesChannelEnumId      = c.SalesChannelEnumId;
            e.OrderDate               = c.OrderDate;
            e.Priority                = c.Priority;
            e.EntryDate               = c.EntryDate;
            e.PickSheetPrintedDate    = c.PickSheetPrintedDate;
            e.StatusId                = c.StatusId;
            e.CurrencyUomId           = c.CurrencyUomId;
            e.SyncStatusId            = c.SyncStatusId;
            e.BillingAccountId        = c.BillingAccountId;
            e.OriginFacilityId        = c.OriginFacilityId;
            e.WebSiteId               = c.WebSiteId;
            e.ProductStoreId          = c.ProductStoreId;
            e.TerminalId              = c.TerminalId;
            e.TransactionId           = c.TransactionId;
            e.AutoOrderShoppingListId = c.AutoOrderShoppingListId;
            e.NeedsInventoryIssuance  = c.NeedsInventoryIssuance;
            e.IsRushOrder             = c.IsRushOrder;
            e.InternalCode            = c.InternalCode;
            e.RemainingSubTotal       = c.RemainingSubTotal;
            e.GrandTotal              = c.GrandTotal;
            e.InvoicePerShipment      = c.InvoicePerShipment;
            e.Active    = c.Active;
            e.CommandId = c.CommandId;


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

            foreach (ICreateOrderRole innerCommand in c.OrderRoles)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IOrderRoleStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddOrderRoleEvent(innerEvent);
            }

            foreach (ICreateOrderItem innerCommand in c.OrderItems)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IOrderItemStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddOrderItemEvent(innerEvent);
            }

            foreach (ICreateOrderShipGroup innerCommand in c.OrderShipGroups)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IOrderShipGroupStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddOrderShipGroupEvent(innerEvent);
            }


            return(e);
        }
Exemplo n.º 6
0
 public virtual void AddOrderRoleEvent(IOrderRoleStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._orderRoleEvents[e.OrderRoleEventId] = e;
 }
Exemplo n.º 7
0
 void IOrderRoleState.When(IOrderRoleStateCreated e)
 {
     throw new NotSupportedException();
 }