Exemplo n.º 1
0
        public static void RemoveGlobalPacsConfig()
        {
            string globalPacsConfigPath       = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
            string backupGlobalPacsConfigPath = GlobalPacsUpdater.BackupFile(globalPacsConfigPath);

            try
            {
                if (File.Exists(globalPacsConfigPath))
                {
                    File.Delete(globalPacsConfigPath);
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
        private static bool UpgradeConfigFiles()
        {
#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
            string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);
            string globalPacsConfigPath       = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
            string backupGlobalPacsConfigPath = string.Empty;

            // Upgrade GlobalPacs.Config if necessary

            bool bNeedsUpdateExternalStore = GlobalPacsUpdater.AddExternalStoreToGlobalPacsConfig(globalPacsConfigPath, false);
            bool bNeedsUpdate = bNeedsUpdateExternalStore;


#if (LEADTOOLS_V20_OR_LATER)
            bool bNeedsUpdateExportLayout = GlobalPacsUpdater.AddExportLayoutToGlobalPacsConfig(globalPacsConfigPath, false);
            bNeedsUpdate = bNeedsUpdate | bNeedsUpdateExportLayout;
#endif
            if (bNeedsUpdate)
            {
                string       msg = string.Format("The existing globalPacs.config must be upgraded\n\nDo you want to continue?", exeName);
                DialogResult dr  = MessageBox.Show(msg, "Upgrade Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr != DialogResult.Yes)
                {
                    return(false);
                }

                backupGlobalPacsConfigPath = GlobalPacsUpdater.BackupFile(globalPacsConfigPath);

                if (bNeedsUpdateExternalStore)
                {
                    GlobalPacsUpdater.AddExternalStoreToGlobalPacsConfig(globalPacsConfigPath, true);
                }
            }
#endif // #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)

#if (LEADTOOLS_V20_OR_LATER)
            if (bNeedsUpdateExportLayout)
            {
                GlobalPacsUpdater.AddExportLayoutToGlobalPacsConfig(globalPacsConfigPath, true);
            }
#endif // (LEADTOOLS_V20_OR_LATER)
            return(true);
        }
Exemplo n.º 3
0
        static bool SilentConfigure()
        {
            bool success = true;

            try
            {
                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    DicomStorageServerSqlInstaller.InstallDatabase(_commandLineOptions.GetConnectionString());
                }

                MainForm.ConfigMachine           = MainForm.GetConfiguration();
                MainForm.GlobalPacsAlreadyExists = MainForm.VerifyAlreadyExistGlobalPacsConfig();
                MainForm.ConfigGlobalPacs        = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                MainForm.ConfigSource            = MainForm.GetConfigurationSource();

                if (MainForm.ConfigGlobalPacs != null)
                {
                    GlobalPacsUpdater.BackupFile(MainForm.ConfigGlobalPacs.FilePath);
                }

                List <ConnectionStringSettings> connectionStringSettingList = new List <ConnectionStringSettings>();

                ConnectionStringSettings storageServerConnectionStringSetting =
                    new ConnectionStringSettings(_commandLineOptions.DatabaseName, _commandLineOptions.GetConnectionString(), ConnectionProviders.SqlServerProvider.Name);
                connectionStringSettingList.Add(storageServerConnectionStringSetting);
                MainForm.StoreConnectionStringsCommandLine(connectionStringSettingList);

                MainForm.RegisterConfigSectionsCommandLine();

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.Existing)
                {
                    // Get DICOM listening service name from options database table
                    // Update globalpacs.config to include service name for each DataAccesLayer entry

                    AddDicomServiceNameToGlobalPacsConfig();
                }

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    //if (databaseOptions1.WorklistDbSelected)
                    //{
                    //   // FillModalityWorklistDummyData ( ) ;
                    //}

                    //if (databaseOptions1.UserManagementDbSelected)
                    //{
                    //   InsertWorkstationUser();
                    //}
                }

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    bool storageServerDbSelected = true;
                    if (storageServerDbSelected)
                    {
                        MainForm.InsertStorageServerUser(_commandLineOptions.DicomServerUsername, _commandLineOptions.DicomServerPassword);

                        if (Program.IsToolkitDemo == true)
                        {
                            // Program.AddDefaultImages(MainForm.ConfigGlobalPacs);
                        }
                        MainForm.AddDefaultIodClasses();
                    }
                }
            }
            catch (Exception ex)
            {
                success = false;
                MyShowError(ex.Message);
            }
            return(success);
        }