示例#1
0
 public virtual void Save()
 {
     foreach (IShipmentReceiptState s in this.LoadedShipmentReceiptStates)
     {
         ShipmentReceiptStateDao.Save(s);
     }
     foreach (IShipmentReceiptState s in this._removedShipmentReceiptStates.Values)
     {
         ShipmentReceiptStateDao.Delete(s);
     }
 }
示例#2
0
        public virtual IShipmentReceiptState Get(string receiptSeqId, bool forCreation, bool nullAllowed)
        {
            ShipmentReceiptId globalId = new ShipmentReceiptId(_shipmentState.ShipmentId, receiptSeqId);

            if (_loadedShipmentReceiptStates.ContainsKey(globalId))
            {
                var state = _loadedShipmentReceiptStates[globalId];
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new ShipmentReceiptState(ForReapplying);
                state.ShipmentReceiptId = globalId;
                _loadedShipmentReceiptStates.Add(globalId, state);
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = ShipmentReceiptStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedShipmentReceiptStates.Add(globalId, state);
                }
                if (this._shipmentState != null && this._shipmentState.ReadOnly == false)
                {
                    ((IShipmentReceiptState)state).ReadOnly = false;
                }
                return(state);
            }
        }