public virtual void Save() { foreach (IShipmentPackageContentState s in this.LoadedShipmentPackageContentStates) { ShipmentPackageContentStateDao.Save(s); } foreach (IShipmentPackageContentState s in this._removedShipmentPackageContentStates.Values) { ShipmentPackageContentStateDao.Delete(s); } }
public virtual IShipmentPackageContentState Get(string shipmentItemSeqId, bool forCreation, bool nullAllowed) { ShipmentPackageContentId globalId = new ShipmentPackageContentId(_shipmentPackageState.ShipmentPackageId, shipmentItemSeqId); if (_loadedShipmentPackageContentStates.ContainsKey(globalId)) { var state = _loadedShipmentPackageContentStates[globalId]; if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false) { ((IShipmentPackageContentState)state).ReadOnly = false; } return(state); } if (forCreation || ForReapplying) { var state = new ShipmentPackageContentState(ForReapplying); state.ShipmentPackageContentId = globalId; _loadedShipmentPackageContentStates.Add(globalId, state); if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false) { ((IShipmentPackageContentState)state).ReadOnly = false; } return(state); } else { var state = ShipmentPackageContentStateDao.Get(globalId, nullAllowed); if (state != null) { _loadedShipmentPackageContentStates.Add(globalId, state); } if (this._shipmentPackageState != null && this._shipmentPackageState.ReadOnly == false) { ((IShipmentPackageContentState)state).ReadOnly = false; } return(state); } }