Exemplo n.º 1
0
 public virtual void Save()
 {
     foreach (IOrderItemShipGroupAssociationState s in this.LoadedOrderItemShipGroupAssociationStates)
     {
         OrderItemShipGroupAssociationStateDao.Save(s);
     }
     foreach (IOrderItemShipGroupAssociationState s in this._removedOrderItemShipGroupAssociationStates.Values)
     {
         OrderItemShipGroupAssociationStateDao.Delete(s);
     }
 }
Exemplo n.º 2
0
        public virtual IOrderItemShipGroupAssociationState Get(string orderItemSeqId, bool forCreation, bool nullAllowed)
        {
            OrderItemShipGroupAssociationId globalId = new OrderItemShipGroupAssociationId((_orderShipGroupState as IGlobalIdentity <OrderShipGroupId>).GlobalId.OrderId, (_orderShipGroupState as IGlobalIdentity <OrderShipGroupId>).GlobalId.ShipGroupSeqId, orderItemSeqId);

            if (_loadedOrderItemShipGroupAssociationStates.ContainsKey(globalId))
            {
                var state = _loadedOrderItemShipGroupAssociationStates[globalId];
                if (this._orderShipGroupState != null && this._orderShipGroupState.ReadOnly == false)
                {
                    ((IOrderItemShipGroupAssociationState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new OrderItemShipGroupAssociationState(ForReapplying);
                state.OrderItemShipGroupAssociationId = globalId;
                _loadedOrderItemShipGroupAssociationStates.Add(globalId, state);
                if (this._orderShipGroupState != null && this._orderShipGroupState.ReadOnly == false)
                {
                    ((IOrderItemShipGroupAssociationState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = OrderItemShipGroupAssociationStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedOrderItemShipGroupAssociationStates.Add(globalId, state);
                }
                if (this._orderShipGroupState != null && this._orderShipGroupState.ReadOnly == false)
                {
                    ((IOrderItemShipGroupAssociationState)state).ReadOnly = false;
                }
                return(state);
            }
        }