static public ServerPartitionAlternateAeTitle Load(IPersistenceContext read, ServerEntityKey key)
        {
            var broker = read.GetBroker <IServerPartitionAlternateAeTitleEntityBroker>();
            ServerPartitionAlternateAeTitle theObject = broker.Load(key);

            return(theObject);
        }
 static public ServerPartitionAlternateAeTitle Insert(ServerPartitionAlternateAeTitle entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         ServerPartitionAlternateAeTitle newEntity = Insert(update, entity);
         update.Commit();
         return(newEntity);
     }
 }
        static public ServerPartitionAlternateAeTitle Insert(IUpdateContext update, ServerPartitionAlternateAeTitle entity)
        {
            var broker        = update.GetBroker <IServerPartitionAlternateAeTitleEntityBroker>();
            var updateColumns = new ServerPartitionAlternateAeTitleUpdateColumns();

            updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
            updateColumns.AeTitle            = entity.AeTitle;
            updateColumns.Port          = entity.Port;
            updateColumns.Enabled       = entity.Enabled;
            updateColumns.AllowStorage  = entity.AllowStorage;
            updateColumns.AllowKOPR     = entity.AllowKOPR;
            updateColumns.AllowRetrieve = entity.AllowRetrieve;
            updateColumns.AllowQuery    = entity.AllowQuery;
            ServerPartitionAlternateAeTitle newEntity = broker.Insert(updateColumns);

            return(newEntity);
        }
		/// <summary>
		/// Creates an instance of <see cref="SopInstanceImporterContext"/> to be used
		/// by <see cref="SopInstanceImporter"/> 
		/// </summary>
		/// <param name="id"></param>
		/// <param name="sourceAe">Source AE title where the image(s) are imported from</param>
		/// <param name="serverAe">Target AE title where the image(s) will be imported to</param>
		public SopInstanceImporterContext(string id, string sourceAe, string serverAe)
			:
				this(id, sourceAe, ServerPartitionMonitor.Instance.GetPartition(serverAe))
		{
			_alternateAe = ServerPartitionMonitor.Instance.GetPartitionAlternateAe(serverAe);
		}
 static public ServerPartitionAlternateAeTitle Insert(IUpdateContext update, ServerPartitionAlternateAeTitle entity)
 {
     var broker = update.GetBroker<IServerPartitionAlternateAeTitleEntityBroker>();
     var updateColumns = new ServerPartitionAlternateAeTitleUpdateColumns();
     updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
     updateColumns.AeTitle = entity.AeTitle;
     updateColumns.Port = entity.Port;
     updateColumns.Enabled = entity.Enabled;
     updateColumns.AllowStorage = entity.AllowStorage;
     updateColumns.AllowKOPR = entity.AllowKOPR;
     updateColumns.AllowRetrieve = entity.AllowRetrieve;
     updateColumns.AllowQuery = entity.AllowQuery;
     ServerPartitionAlternateAeTitle newEntity = broker.Insert(updateColumns);
     return newEntity;
 }
 static public ServerPartitionAlternateAeTitle Insert(ServerPartitionAlternateAeTitle entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         ServerPartitionAlternateAeTitle newEntity = Insert(update, entity);
         update.Commit();
         return newEntity;
     }
 }
	    private void StartAlternateAeTitleListener(ServerPartition part, ServerPartitionAlternateAeTitle alternateAe)
	    {
	        var context = new DicomScpContext(part)
	            {
	                AlternateAeTitle = alternateAe
	            };

	        if (DicomSettings.Default.ListenIPV4)
	        {
	            var ipV4Scp = new DicomScp<DicomScpContext>(context, AssociationVerifier.Verify,
	                                                        AssociationAuditLogger.InstancesTransferredAuditLogger)
	                {
	                    ListenPort = alternateAe.Port,
	                    AeTitle = alternateAe.AeTitle,
	                    ListenAddress = IPAddress.Any
	                };
	            StartScp(ipV4Scp, _alternateAeListenerList);
			}

	        if (DicomSettings.Default.ListenIPV6)
	        {
	            var ipV6Scp = new DicomScp<DicomScpContext>(context, AssociationVerifier.Verify,
	                                                        AssociationAuditLogger.InstancesTransferredAuditLogger)
	                {
	                    ListenPort = alternateAe.Port,
	                    AeTitle = alternateAe.AeTitle,
	                    ListenAddress = IPAddress.IPv6Any
	                };

	            StartScp(ipV6Scp, _alternateAeListenerList);
	        }
		}
        private bool IsChanged(ServerPartitionAlternateAeTitle p2)
        {
            if (_alternateAeTitles.ContainsKey(p2.AeTitle))
            {
                ServerPartitionAlternateAeTitle p1 = _alternateAeTitles[p2.AeTitle];
                if (p1.Port != p2.Port)
                    return true;
                if (p1.AllowKOPR != p2.AllowKOPR)
                    return true;

                if (p1.AllowQuery != p2.AllowQuery)
                    return true;

                if (p1.AllowRetrieve != p2.AllowRetrieve)
                    return true;

                if (p1.Enabled != p2.Enabled)
                    return true;

                if (!p1.ServerPartitionKey.Key.Equals(p2.ServerPartitionKey.Key))
                    return true;

                // nothing has changed
                return false;
            }

            // this is new ServerPartitionAlternateAeTitle
            return true;
        }