示例#1
0
 public virtual void Save()
 {
     foreach (IShipmentItemState s in this.LoadedShipmentItemStates)
     {
         ShipmentItemStateDao.Save(s);
     }
     foreach (IShipmentItemState s in this._removedShipmentItemStates.Values)
     {
         ShipmentItemStateDao.Delete(s);
     }
 }
示例#2
0
        public virtual IShipmentItemState Get(string shipmentItemSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentItemId globalId = new ShipmentItemId(_shipmentState.ShipmentId, shipmentItemSeqId);

            if (_loadedShipmentItemStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentItemStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentItemState(ForReapplying);
                state.ShipmentItemId = globalId;
                _loadedShipmentItemStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentItemStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentItemStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentItemState)state).ReadOnly = false;
                }
                return(state);
            }
        }