private void RegisterGatewayServer() { GatewayServer gateway = GetGatewayServer( ); if (gateway == null) { return; } GatewayServersManager serverManager = new GatewayServersManager(gateway); if (serverManager != null) { AeInfo remote = serverManager.GetRemoteServer(); if (remote != null) { StorageServerInformation info = GetStorageServerInfo(); if (info != null) { if (remote.Address == info.DicomServer.IPAddress && remote.Port == info.DicomServer.Port) { DicomServer server = ServiceLocator.Retrieve <DicomServer>(); GatewaySession.Log(string.Empty, string.Empty, -1, DicomCommandType.Undefined, LogType.Error, MessageDirection.None, null, "Gateway - Remote server cannot be the same as primary server. Gateway [" + server.AETitle + "] not available."); return; } } } ServiceLocator.Register <GatewayServersManager> (serverManager); } }
public static bool AddDicomServiceNameToGlobalPacsConfig() { bool success = true; try { OptionsDataAccessConfigurationView optionsConfigView = new OptionsDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsConfiguration(), DicomDemoSettingsManager.ProductNameStorageServer, null); IOptionsDataAccessAgent optionsAgent = DataAccessFactory.GetInstance(optionsConfigView).CreateDataAccessAgent <IOptionsDataAccessAgent>(); if (optionsAgent != null) { StorageServerInformation serverInfo = null; string name = typeof(StorageServerInformation).Name; if (optionsAgent.OptionExits(name)) { serverInfo = optionsAgent.Get <StorageServerInformation>(name, null, new Type[0]); if (serverInfo != null && !string.IsNullOrEmpty(serverInfo.ServiceName)) { GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, serverInfo.ServiceName, GlobalPacsUpdater.ModifyConfigurationType.Add); } } } } catch (Exception) { success = false; } return(success); }
private static void SetStorageServerInformationOptions(IOptionsDataAccessAgent optionsAgent) { if (null != ServerState.Instance.ServerService) { StorageServerInformation information = null; DicomAE ae = new DicomAE(ServerState.Instance.ServerService.Settings.AETitle, ServerState.Instance.ServerService.Settings.IpAddress, ServerState.Instance.ServerService.Settings.Port, 0, ServerState.Instance.ServerService.Settings.Secure); information = new StorageServerInformation(ae, ServerState.Instance.ServerService.ServiceName, Environment.MachineName); optionsAgent.Set <StorageServerInformation> (typeof(StorageServerInformation).Name, information, new Type[0]); } }
private StorageServerInformation GetStorageServerInfo() { IOptionsDataAccessAgent optionsAgent; StorageServerInformation serverInfo = null; optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>(); if (optionsAgent != null) { string name = typeof(StorageServerInformation).Name; if (optionsAgent.OptionExits(name)) { serverInfo = optionsAgent.Get <StorageServerInformation>(name, null, new Type[0]); } } return(serverInfo); }
public static void UpdateGlobalPacsConfig(Configuration configGlobalPacs, ConnectionStringSettings connectionSettings, bool jobAccessOnly) { string serviceName = string.Empty; StorageServerInformation serverInfo = GetServerInformation( ); if (null != serverInfo) { serviceName = serverInfo.ServiceName; // throw new ApplicationException ( "Server is not configured" ) ; } ConfigureJobsDataAccess(configGlobalPacs, connectionSettings, serviceName); ConfigurePatientRightsDataAccess(configGlobalPacs, connectionSettings, serviceName); ConfigureAnnotationsDataAccess(configGlobalPacs, connectionSettings, serviceName); #if LEADTOOLS_V19_OR_LATER if (jobAccessOnly == false) { ConfigureOptionsDataAccess(configGlobalPacs, connectionSettings, serviceName); ConfigureMoniforCalibrationDataAccess(configGlobalPacs, connectionSettings, serviceName); ConfigureTemplateDataAccess(configGlobalPacs, connectionSettings, serviceName); } #endif }