/// <summary>
 /// Вызывает проверку подключения к базе данных
 /// </summary>
 private void CheckDbConnection()
 {
     _configuration.DbSource = SourceSerializer.DbDeserialize(Source);
     try
     {
         if (_configuration.GetStateConnection())
         {
             IsConnected = true;
             _connectionMessenger.ShowConnectionSuccess("Соединение с базой данных установленно!");
         }
     }
     catch (Exception e)
     {
         IsConnected = false;
         _connectionMessenger.ShowConnectionErrorMessage(e);
     }
 }
Пример #2
0
        /// <summary>
        /// Возвращает коллекцию поциентов из текущего источника
        /// </summary>
        private void FindPatient()
        {
            if (!string.IsNullOrEmpty(SearchString))
            {
                switch (_source.TypeEnum)
                {
                case SourceTypeEnum.DataBase:
                {
                    try
                    {
                        var configuration = new DbConnectionHelper(SourceSerializer.DbDeserialize(_source));
                        _patientRepository = new PatientDbConnectionRepository(configuration);
                        var patients = _patientRepository.FindPatientsByValue(SearchString);
                        Patients = new ObservableCollection <Patient>(patients);
                    }
                    catch (Exception e)
                    {
                        _connectionMessenger.ShowConnectionErrorMessage(e);
                        ClearSearchArea();
                    }
                }
                    return;

                case SourceTypeEnum.Worklist:
                {
                    try
                    {
                        _patientRepository = new PatientRepositoryDicom(SourceSerializer.WorklistDeserialize(_source));
                        var patients = _patientRepository.FindPatientsByValue(SearchString);
                        Patients = new ObservableCollection <Patient>(patients);
                    }
                    catch (Exception e)
                    {
                        _connectionMessenger.ShowConnectionErrorMessage(e);
                        ClearSearchArea();
                    }
                }
                    return;
                }
            }

            Patients.Clear();
        }