示例#1
0
        void UpdateDatabaseButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (_databaseLayer.IsDatabaseUpdated())
                {
                    Messager.ShowInformation(this, "Database has already been updated.");
                }
                else
                // Add the tags to _source, only if they have not already been added
                {
                    try
                    {
                        WorklistIODUpdater.UpdateIOD(_source.DatabaseTags, _iodPath);
                    }
                    catch (Exception exception)
                    {
                        Messager.ShowError(this, "Error Updating the Modality Work-list IOD document.\n" + exception);
                    }

                    _databaseLayer.UpdateDatabase();
                    Messager.ShowInformation(this, "Database updated successfully.");
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
示例#2
0
        public Form1( )
        {
            InitializeComponent( );

            Messager.Caption = this.Text;

            if (!DatabaseLayer.IsDataAccessSettingsValid( ))
            {
                MessageBox.Show("Database settings is not valid. Please run the PACS Database Configuration Demo.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            _source        = new WorklistDataSource( );
            _databaseLayer = new DatabaseLayer(_source);
            _iodPath       = Application.StartupPath;

            _iodPath = Path.Combine(_iodPath, "CustomMWLIOD.xml");

            using (Stream iodStream = MWLCFindCommand.DefualtMWLIOD)
            {
                using (FileStream customIODStream = new FileStream(_iodPath, FileMode.Create))
                {
                    CopyTo(iodStream, customIODStream);
                }
            }

            _source.DatabaseTags.Add(new DatabaseDicomTags("Visit", "ServiceEpisodeDescription", DicomTag.ServiceEpisodeDescription));
            _source.DatabaseTags.Add(new DatabaseDicomTags("ScheduledProcedureStep", "CommentsOnTheScheduledProcedureStep", DicomTag.CommentsOnTheScheduledProcedureStep));
            _source.DatabaseTags.Add(new DatabaseDicomTags("Patient", "SmokingStatus", DicomTag.SmokingStatus));

            _worklistAgent = _databaseLayer.GetWorklistDataAgent( );

            DataAccessServices.RegisterDataAccessService <IWorklistDataAccessAgent> (_worklistAgent);

            databaseStatus1.ConnectionString = _databaseLayer.ConnectionString;
            databaseStatus1.ProviderName     = _databaseLayer.Provider;

            dicomTags1.SetSource(_source.DatabaseTags);
            worklistUpdate1.SetSource(_source.DatabaseTags);
            dicomQuery1.SetSource(_source.DatabaseTags, _iodPath);

            if (_databaseLayer.IsDatabaseUpdated())
            {
                try
                {
                    WorklistIODUpdater.UpdateIOD(_source.DatabaseTags, _iodPath);
                }
                catch (Exception exception)
                {
                    Messager.ShowError(this, "Error Updating the Modality Work-list IOD document.\n" + exception);
                }
            }

            UpdateDatabaseButton.Click += new EventHandler(UpdateDatabaseButton_Click);
        }