public virtual void Save() { foreach (IShipmentImageState s in this.LoadedShipmentImageStates) { ShipmentImageStateDao.Save(s); } foreach (IShipmentImageState s in this._removedShipmentImageStates.Values) { ShipmentImageStateDao.Delete(s); } }
public virtual IShipmentImageState Get(string sequenceId, bool forCreation, bool nullAllowed) { ShipmentImageId globalId = new ShipmentImageId(_shipmentState.ShipmentId, sequenceId); if (_loadedShipmentImageStates.ContainsKey(globalId)) { var state = _loadedShipmentImageStates[globalId]; if (this._shipmentState != null && this._shipmentState.ReadOnly == false) { ((IShipmentImageState)state).ReadOnly = false; } return(state); } if (forCreation || ForReapplying) { var state = new ShipmentImageState(ForReapplying); state.ShipmentImageId = globalId; _loadedShipmentImageStates.Add(globalId, state); if (this._shipmentState != null && this._shipmentState.ReadOnly == false) { ((IShipmentImageState)state).ReadOnly = false; } return(state); } else { var state = ShipmentImageStateDao.Get(globalId, nullAllowed); if (state != null) { _loadedShipmentImageStates.Add(globalId, state); } if (this._shipmentState != null && this._shipmentState.ReadOnly == false) { ((IShipmentImageState)state).ReadOnly = false; } return(state); } }