public static string GetDeleteInstanceCommandText
        (
            //string sopColKeyName, //0
            //string seriesColKeyName, //1
            //string studyColKeyName, //2
            //string patientColKeyName,//3
            //string sopInstanceTableName, //4
            //string seriesTableName, //5
            //string studyTableName, //6
            //string patientTableName, //7
            //string sopInstanceRefSeriesColName, //8
            //string seriesRefStudyColName, //9
            //string studyRefPatientColName, //10
            //string sopInstanceUidColName, //11
            string sopInstanceUidValue //12
        )
        {
            StorageDbSchemaProvider schemaProvider = new StorageDbSchemaProvider( );

            return(string.Format(Delete.Delete_Instance_Command_Formatted,
                                 schemaProvider.ObjectInstanceTable.KeyColumn.Name,
                                 schemaProvider.SeriesTable.KeyColumn.Name,
                                 schemaProvider.StudyTable.KeyColumn.Name,
                                 schemaProvider.PatientTable.KeyColumn.Name,
                                 schemaProvider.ObjectInstanceTable.Name,
                                 schemaProvider.SeriesTable.Name,
                                 schemaProvider.StudyTable.Name,
                                 schemaProvider.PatientTable.Name,
                                 schemaProvider.ObjectInstanceTable.ForeignColumn.Name,
                                 schemaProvider.SeriesTable.ForeignColumn,
                                 schemaProvider.StudyTable.ForeignColumn,
                                 schemaProvider.ObjectInstanceTable.ModelKeyColumns.FirstOrDefault().Name,
                                 sopInstanceUidValue));
        }
        //protected virtual DicomInstanceArchieveDataAccess CreateDataAccess()
        //{
        //    DicomInstanceArchieveDataAccess dataAccess = new DicomInstanceArchieveDataAccess(connectionString);
        //    return dataAccess;
        //}

        protected virtual ObjectArchieveResponseBuilder CreateResponseBuilder(string queryLevel)
        {
            StorageDbSchemaProvider       dbSchema        = new StorageDbSchemaProvider( );
            ObjectArchieveResponseBuilder responseBuilder = new ObjectArchieveResponseBuilder(dbSchema, queryLevel);

            responseBuilder.QueryLevel = queryLevel;

            return(responseBuilder);
        }
        private DataAccessHelpers(string dbName)
        {
            DbSchemaProvider schemaProvider   = new StorageDbSchemaProvider( );
            string           connectionString = "Data Source=(LocalDb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\" + dbName + ";Initial Catalog=" + dbName + ";Integrated Security=True";

            //throw new NotImplementedException ( "specify a connection string below" ) ;
            //TODO: To run the test against a database, uncomment the line below and pass the connection string to your database
            DataAccess = new ObjectArchieveDataAccess(schemaProvider,
                                                      new  ObjectArchieveDataAdapter(schemaProvider, new SqlDatabaseFactory(connectionString)));
        }
Example #4
0
        public static void Start(int port, string aet)
        {
            AETitle = aet;
            string storageConection = ConfigurationManager.AppSettings["app:PacsStorageConnection"];

            if (storageConection.StartsWith("|datadirectory|", StringComparison.OrdinalIgnoreCase))
            {
                var appDataPath  = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                var lastIndex    = storageConection.IndexOf('|', 1);
                var userPathPart = storageConection.Substring(lastIndex + 1);
                storageConection = appDataPath + userPathPart;
            }
            IDicomMediaIdFactory mediaIdFactory = new DicomMediaIdFactory();
            DbSchemaProvider     schemaProvider = new StorageDbSchemaProvider();

            DatabaseService = new SqlDatabaseFactory(ConfigurationManager.AppSettings["app:PacsDataArchieve"]);

            IObjectArchieveDataAccess dataAccess =
                new ObjectArchieveDataAccess(
                    schemaProvider,
                    new ObjectArchieveDataAdapter(
                        schemaProvider,
                        DatabaseService
                        )
                    );

            IMediaStorageService storageService = new FileStorageService(storageConection);

            IDicomMediaWriterFactory dicomMediaWriterFactory =
                new DicomMediaWriterFactory(
                    storageService,
                    mediaIdFactory
                    );

            StorageService = new ObjectStoreService(
                new Pacs.Commands.DCloudCommandFactory(
                    storageService,
                    dataAccess,
                    dicomMediaWriterFactory,
                    mediaIdFactory
                    )
                );

            QueryService = new ObjectArchieveQueryService(dataAccess);

            RetrieveService = new ObjectRetrieveService(
                storageService,
                dicomMediaWriterFactory,
                mediaIdFactory
                );

            _server = DicomServer.Create <SCP>(port);
        }
        public ICollection <DicomAttributeCollection> Find
        (
            DicomAttributeCollection request,
            QueryOptions options
        )
        {
            StorageDbSchemaProvider          dbSchema        = new StorageDbSchemaProvider( );
            IEnumerable <IMatchingCondition> conditions      = null;
            ObjectArchieveResponseBuilder    responseBuilder = new ObjectArchieveResponseBuilder(dbSchema, options.QueryLevel);


            conditions = BuildConditions(request);

            DoFind(request, options, conditions, responseBuilder);

            return(responseBuilder.GetResponse( ));
        }
        private static IObjectStoreService CreateStorageService(string storagePath, string databaseConnectionString)
        {
            IDicomMediaIdFactory      mediaIdFactory = new DicomMediaIdFactory( );
            IMediaStorageService      storageService = new FileStorageService(storagePath);
            DbSchemaProvider          schemaProvider = new StorageDbSchemaProvider( );
            IDatabaseFactory          databaseFacory = new SqlDatabaseFactory(databaseConnectionString);
            ObjectArchieveDataAdapter dataAdapter    = new ObjectArchieveDataAdapter(schemaProvider, databaseFacory);
            IObjectArchieveDataAccess dataAccess     = new ObjectArchieveDataAccess(databaseConnectionString,
                                                                                    schemaProvider,
                                                                                    dataAdapter);
            IDicomMediaWriterFactory mediaWriterFactory = new DicomMediaWriterFactory(storageService,
                                                                                      mediaIdFactory);
            IDCloudCommandFactory factory = new DCloudCommandFactory(storageService,
                                                                     dataAccess,
                                                                     mediaWriterFactory,
                                                                     mediaIdFactory);

            IObjectStoreService StoreService = new ObjectStoreService(factory);

            return(StoreService);
        }
 public SqlDeleteStatments(StorageDbSchemaProvider schemaProvider)
 {
     SchemaProvider = schemaProvider;
 }