Ejemplo n.º 1
0
 public virtual void Save()
 {
     foreach (IShipmentReceiptImageState s in this.LoadedShipmentReceiptImageStates)
     {
         ShipmentReceiptImageStateDao.Save(s);
     }
     foreach (IShipmentReceiptImageState s in this._removedShipmentReceiptImageStates.Values)
     {
         ShipmentReceiptImageStateDao.Delete(s);
     }
 }
Ejemplo n.º 2
0
        public virtual IShipmentReceiptImageState Get(string sequenceId, bool forCreation, bool nullAllowed)
        {
            ShipmentReceiptImageId globalId = new ShipmentReceiptImageId((_shipmentReceiptState as IGlobalIdentity <ShipmentReceiptId>).GlobalId.ShipmentId, (_shipmentReceiptState as IGlobalIdentity <ShipmentReceiptId>).GlobalId.ReceiptSeqId, sequenceId);

            if (_loadedShipmentReceiptImageStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentReceiptImageStates[globalId];
                if (this._shipmentReceiptState != null && this._shipmentReceiptState.ReadOnly == false)
                {
                    ((IShipmentReceiptImageState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentReceiptImageState(ForReapplying);
                state.ShipmentReceiptImageId = globalId;
                _loadedShipmentReceiptImageStates.Add(globalId, state);
                if (this._shipmentReceiptState != null && this._shipmentReceiptState.ReadOnly == false)
                {
                    ((IShipmentReceiptImageState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentReceiptImageStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentReceiptImageStates.Add(globalId, state);
                }
                if (this._shipmentReceiptState != null && this._shipmentReceiptState.ReadOnly == false)
                {
                    ((IShipmentReceiptImageState)state).ReadOnly = false;
                }
                return(state);
            }
        }