예제 #1
0
        public virtual IOrderItemState Get(string orderItemSeqId, bool forCreation, bool nullAllowed)
        {
            OrderItemId globalId = new OrderItemId(_orderState.OrderId, orderItemSeqId);

            if (_loadedOrderItemStates.ContainsKey(globalId))
            {
                var state = _loadedOrderItemStates[globalId];
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new OrderItemState(ForReapplying);
                state.OrderItemId = globalId;
                _loadedOrderItemStates.Add(globalId, state);
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = OrderItemStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedOrderItemStates.Add(globalId, state);
                }
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderItemState)state).ReadOnly = false;
                }
                return(state);
            }
        }
예제 #2
0
 public static CreateOrderItem ToCreateOrderItem(this OrderItemState state)
 {
     return(state.ToCreateOrderItem <CreateOrderItem>());
 }
예제 #3
0
 public static MergePatchOrderItem ToMergePatchOrderItem(this OrderItemState state)
 {
     return(state.ToMergePatchOrderItem <MergePatchOrderItem>());
 }
예제 #4
0
 public static RemoveOrderItem ToRemoveOrderItem(this OrderItemState state)
 {
     return(state.ToRemoveOrderItem <RemoveOrderItem>());
 }
예제 #5
0
 public static IOrderItemCommand ToCreateOrMergePatchOrderItem(this OrderItemState state)
 {
     return(state.ToCreateOrMergePatchOrderItem <CreateOrderItem, MergePatchOrderItem>());
 }
예제 #6
0
        public virtual IOrderItemState ToOrderItemState()
        {
            var state = new OrderItemState(true);

            state.OrderItemSeqId        = this.OrderItemSeqId;
            state.ProductId             = this.ProductId;
            state.ExternalProductId     = this.ExternalProductId;
            state.Quantity              = this.Quantity;
            state.CancelQuantity        = this.CancelQuantity;
            state.SelectedAmount        = this.SelectedAmount;
            state.ExternalId            = this.ExternalId;
            state.OrderItemTypeId       = this.OrderItemTypeId;
            state.OrderItemGroupSeqId   = this.OrderItemGroupSeqId;
            state.IsItemGroupPrimary    = this.IsItemGroupPrimary;
            state.FromInventoryItemId   = this.FromInventoryItemId;
            state.IsPromo               = this.IsPromo;
            state.QuoteId               = this.QuoteId;
            state.QuoteItemSeqId        = this.QuoteItemSeqId;
            state.ShoppingListId        = this.ShoppingListId;
            state.ShoppingListItemSeqId = this.ShoppingListItemSeqId;
            state.UnitPrice             = this.UnitPrice;
            state.UnitListPrice         = this.UnitListPrice;
            state.UnitAverageCost       = this.UnitAverageCost;
            state.UnitRecurringPrice    = this.UnitRecurringPrice;
            state.IsModifiedPrice       = this.IsModifiedPrice;
            state.RecurringFreqUomId    = this.RecurringFreqUomId;
            state.ItemDescription       = this.ItemDescription;
            state.Comments              = this.Comments;
            state.CorrespondingPoId     = this.CorrespondingPoId;
            state.StatusId              = this.StatusId;
            state.SyncStatusId          = this.SyncStatusId;
            state.EstimatedShipDate     = this.EstimatedShipDate;
            state.EstimatedDeliveryDate = this.EstimatedDeliveryDate;
            state.AutoCancelDate        = this.AutoCancelDate;
            state.DontCancelSetDate     = this.DontCancelSetDate;
            state.DontCancelSetBy       = this.DontCancelSetBy;
            state.ShipBeforeDate        = this.ShipBeforeDate;
            state.ShipAfterDate         = this.ShipAfterDate;
            state.CancelBackOrderDate   = this.CancelBackOrderDate;
            state.OverrideGlAccountId   = this.OverrideGlAccountId;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.OrderId   = this.OrderId;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }