Open and compile the project My.Medical.Storage.DataAccessLayer project.
The default location is C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\My.Medical.Storage.DataAccessLayer
Note: If you are using earlier versions of SQL Server 2008 (i.e. SQL Server 2005), there is no support for the data type SqlDbType.Date. In this case, you have choices:
Open MyDataSet.Designer.cs, and replace all instances of SqlDbType.Date with SqlDbType.DateTime
Follow the steps in Strongly Typed DataSet Class and XML Schema to generate a new instance of MyDataSet.Designer.cs.
Open and compile the My.Medical.Storage.Configuration project.
The default location is C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\My.Medical.Storage.Configuration.
Compiling the projects will generate two assemblies:
This tutorial uses Microsoft SQL Server 2008 and SQL Server Management Studio. You can also use SQL Compact Edition, which is installed by default when you install Visual Studio. If you use SQL Compact Edition, you can download SQL Server Management Studio Express (a free download from Microsoft).
Script to generate the tutorial database for SQL Server 2008
USE [master]GO/****** Object: Database [MyDicomDb] Script Date: 07/15/2013 13:02:13 ******/CREATE DATABASE [MyDicomDb]GOALTER DATABASE [MyDicomDb] SET COMPATIBILITY_LEVEL = 100GOIF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))beginEXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'endGOALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFFGOALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFFGOALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFFGOALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFFGOALTER DATABASE [MyDicomDb] SET ARITHABORT OFFGOALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFFGOALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ONGOALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFFGOALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ONGOALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFFGOALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBALGOALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFFGOALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFFGOALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFFGOALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFFGOALTER DATABASE [MyDicomDb] SET DISABLE_BROKERGOALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFFGOALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFFGOALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFFGOALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFFGOALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLEGOALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFFGOALTER DATABASE [MyDicomDb] SET HONOR_BROKER_PRIORITY OFFGOALTER DATABASE [MyDicomDb] SET READ_WRITEGOALTER DATABASE [MyDicomDb] SET RECOVERY FULLGOALTER DATABASE [MyDicomDb] SET MULTI_USERGOALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUMGOALTER DATABASE [MyDicomDb] SET DB_CHAINING OFFGOEXEC sys.sp_db_vardecimal_storage_format N'MyDicomDb', N'ON'GOUSE [MyDicomDb]GO/****** Object: Table [dbo].[MyPatientTable] Script Date: 07/01/2013 17:44:15 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyPatientTable]([PatientId] [int] IDENTITY(1,1) NOT NULL,[PatientIdentification] [nvarchar](70) NOT NULL,[PatientName] [nvarchar](max) NOT NULL,[PatientBirthday] [date] NULL,[PatientSex] [nvarchar](50) NULL,[PatientComments] [nvarchar](200) NULL,CONSTRAINT [PK_Patient] PRIMARY KEY CLUSTERED([PatientId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_PatientIdentification] UNIQUE NONCLUSTERED([PatientIdentification] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MyStudyTable] Script Date: 07/01/2013 17:44:15 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyStudyTable]([StudyId] [int] IDENTITY(1,1) NOT NULL,[StudyPatientId] [int] NOT NULL,[StudyStudyInstanceUID] [nvarchar](64) NOT NULL,[StudyStudyDate] [date] NULL,[StudyAccessionNumber] [nvarchar](64) NULL,[StudyStudyDescription] [nvarchar](256) NULL,[StudyReferringPhysiciansName] [nvarchar](50) NULL,[StudyStudyId] [nvarchar](16) NULL,CONSTRAINT [PK_Study] PRIMARY KEY CLUSTERED([StudyId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_StudyStudyInstanceUID] UNIQUE NONCLUSTERED([StudyStudyInstanceUID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MySeriesTable] Script Date: 07/01/2013 17:44:15 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MySeriesTable]([SeriesId] [int] IDENTITY(1,1) NOT NULL,[SeriesStudyId] [int] NOT NULL,[SeriesSeriesInstanceUID] [nvarchar](64) NOT NULL,[SeriesBodyPartExamined] [nvarchar](16) NULL,[SeriesSeriesNumber] [int] NULL,[SeriesSeriesDescription] [nvarchar](300) NULL,[SeriesSeriesDate] [date] NULL,[SeriesModality] [nvarchar](50) NULL,CONSTRAINT [PK_Series] PRIMARY KEY CLUSTERED([SeriesId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_SerieSeriesInstanceUID] UNIQUE NONCLUSTERED([SeriesSeriesInstanceUID] ASC,[SeriesStudyId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MyInstanceTable] Script Date: 07/01/2013 17:44:15 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyInstanceTable]([ImageId] [bigint] IDENTITY(1,1) NOT NULL,[ImageSeriesId] [int] NOT NULL,[SOPInstanceUID] [nvarchar](64) NOT NULL,[ImageImageNumber] [int] NOT NULL,[ImageLastStoreDate] [date] NULL,[ImageFilename] [nvarchar](400) NOT NULL,[ImageUniqueSOPClassUID] [nvarchar](64) NULL,[ImageRows] [bigint] NULL,[ImageColumns] [bigint] NULL,[ImageBitsAllocated] [bigint] NULL,CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED([ImageId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [IX_Image_SOPInstanceUID] UNIQUE NONCLUSTERED([SOPInstanceUID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: ForeignKey [FK_DImage_Series] Script Date: 07/01/2013 17:44:15 ******/ALTER TABLE [dbo].[MyInstanceTable] WITH CHECK ADD CONSTRAINT [FK_DImage_Series] FOREIGN KEY([ImageSeriesId])REFERENCES [dbo].[MySeriesTable] ([SeriesId])ON DELETE CASCADEGOALTER TABLE [dbo].[MyInstanceTable] CHECK CONSTRAINT [FK_DImage_Series]GO/****** Object: ForeignKey [FK_Series_Study] Script Date: 07/01/2013 17:44:15 ******/ALTER TABLE [dbo].[MySeriesTable] WITH CHECK ADD CONSTRAINT [FK_Series_Study] FOREIGN KEY([SeriesStudyId])REFERENCES [dbo].[MyStudyTable] ([StudyId])GOALTER TABLE [dbo].[MySeriesTable] CHECK CONSTRAINT [FK_Series_Study]GO/****** Object: ForeignKey [FK_Study_Patient] Script Date: 07/01/2013 17:44:15 ******/ALTER TABLE [dbo].[MyStudyTable] WITH CHECK ADD CONSTRAINT [FK_Study_Patient] FOREIGN KEY([StudyPatientId])REFERENCES [dbo].[MyPatientTable] ([PatientId])GOALTER TABLE [dbo].[MyStudyTable] CHECK CONSTRAINT [FK_Study_Patient]GO
Note:
For earlier version of SQL Server (i.e. SQL Server 2005), there is no support for the data type SqlDbType.Date.
If you are using SQL Server 2005, you can use the following script to generate the database, which instead uses the data type SqlDbType.DateTime.
Script to generate the tutorial database for SQL Server 2005
USE [master]GO/****** Object: Database [MyDicomDb] Script Date: 08/12/2013 10:39:18 ******/CREATE DATABASE [MyDicomDb]GOIF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))beginEXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'endGOALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFFGOALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFFGOALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFFGOALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFFGOALTER DATABASE [MyDicomDb] SET ARITHABORT OFFGOALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFFGOALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ONGOALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFFGOALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ONGOALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFFGOALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBALGOALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFFGOALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFFGOALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFFGOALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFFGOALTER DATABASE [MyDicomDb] SET DISABLE_BROKERGOALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFFGOALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFFGOALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFFGOALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFFGOALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLEGOALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFFGOALTER DATABASE [MyDicomDb] SET READ_WRITEGOALTER DATABASE [MyDicomDb] SET RECOVERY FULLGOALTER DATABASE [MyDicomDb] SET MULTI_USERGOALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUMGOALTER DATABASE [MyDicomDb] SET DB_CHAINING OFFGOUSE [MyDicomDb]GO/****** Object: Table [dbo].[MyPatientTable] Script Date: 08/12/2013 10:39:19 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyPatientTable]([PatientId] [int] IDENTITY(1,1) NOT NULL,[PatientIdentification] [nvarchar](70) NOT NULL,[PatientName] [nvarchar](max) NOT NULL,[PatientBirthday] [datetime] NULL,[PatientSex] [nvarchar](50) NULL,[PatientComments] [nvarchar](200) NULL,CONSTRAINT [PK_Patient] PRIMARY KEY CLUSTERED([PatientId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_PatientIdentification] UNIQUE NONCLUSTERED([PatientIdentification] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MyStudyTable] Script Date: 08/12/2013 10:39:19 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyStudyTable]([StudyId] [int] IDENTITY(1,1) NOT NULL,[StudyPatientId] [int] NOT NULL,[StudyStudyInstanceUID] [nvarchar](64) NOT NULL,[StudyStudyDate] [datetime] NULL,[StudyAccessionNumber] [nvarchar](64) NULL,[StudyStudyDescription] [nvarchar](256) NULL,[StudyReferringPhysiciansName] [nvarchar](50) NULL,[StudyStudyId] [nvarchar](16) NULL,CONSTRAINT [PK_Study] PRIMARY KEY CLUSTERED([StudyId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_StudyStudyInstanceUID] UNIQUE NONCLUSTERED([StudyStudyInstanceUID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MySeriesTable] Script Date: 08/12/2013 10:39:19 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MySeriesTable]([SeriesId] [int] IDENTITY(1,1) NOT NULL,[SeriesStudyId] [int] NOT NULL,[SeriesSeriesInstanceUID] [nvarchar](64) NOT NULL,[SeriesBodyPartExamined] [nvarchar](16) NULL,[SeriesSeriesNumber] [int] NULL,[SeriesSeriesDescription] [nvarchar](300) NULL,[SeriesSeriesDate] [datetime] NULL,[SeriesModality] [nvarchar](50) NULL,CONSTRAINT [PK_Series] PRIMARY KEY CLUSTERED([SeriesId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [uc_SerieSeriesInstanceUID] UNIQUE NONCLUSTERED([SeriesSeriesInstanceUID] ASC,[SeriesStudyId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[MyInstanceTable] Script Date: 08/12/2013 10:39:19 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[MyInstanceTable]([ImageId] [bigint] IDENTITY(1,1) NOT NULL,[ImageSeriesId] [int] NOT NULL,[SOPInstanceUID] [nvarchar](64) NOT NULL,[ImageImageNumber] [int] NOT NULL,[ImageLastStoreDate] [datetime] NULL,[ImageFilename] [nvarchar](400) NOT NULL,[ImageUniqueSOPClassUID] [nvarchar](64) NULL,[ImageRows] [bigint] NULL,[ImageColumns] [bigint] NULL,[ImageBitsAllocated] [bigint] NULL,CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED([ImageId] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],CONSTRAINT [IX_Image_SOPInstanceUID] UNIQUE NONCLUSTERED([SOPInstanceUID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: ForeignKey [FK_Study_Patient] Script Date: 08/12/2013 10:39:19 ******/ALTER TABLE [dbo].[MyStudyTable] WITH CHECK ADD CONSTRAINT [FK_Study_Patient] FOREIGN KEY([StudyPatientId])REFERENCES [dbo].[MyPatientTable] ([PatientId])GOALTER TABLE [dbo].[MyStudyTable] CHECK CONSTRAINT [FK_Study_Patient]GO/****** Object: ForeignKey [FK_Series_Study] Script Date: 08/12/2013 10:39:19 ******/ALTER TABLE [dbo].[MySeriesTable] WITH CHECK ADD CONSTRAINT [FK_Series_Study] FOREIGN KEY([SeriesStudyId])REFERENCES [dbo].[MyStudyTable] ([StudyId])GOALTER TABLE [dbo].[MySeriesTable] CHECK CONSTRAINT [FK_Series_Study]GO/****** Object: ForeignKey [FK_DImage_Series] Script Date: 08/12/2013 10:39:19 ******/ALTER TABLE [dbo].[MyInstanceTable] WITH CHECK ADD CONSTRAINT [FK_DImage_Series] FOREIGN KEY([ImageSeriesId])REFERENCES [dbo].[MySeriesTable] ([SeriesId])ON DELETE CASCADEGOALTER TABLE [dbo].[MyInstanceTable] CHECK CONSTRAINT [FK_DImage_Series]GO
Comment out the existing storageDataAccessConfiguration175 entry in the configSections, and add a new myStorageDataAccessConfiguration175 section. The new section is highlighted in yellow, below.
<!--<section name="storageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=21.0.0.1, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />--><section name="myStorageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=21.0.0.1, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />
Comment out the existing StorageServer entry in the storageDataAccessConfiguration175 definition, and add a new myStorageDataAccessConfiguration175 definition. The changes are highlighted in yellow, below.
<storageDataAccessConfiguration175 connectionName="LeadStorageServer21_32"><!--<add productName="StorageServer" serviceName="L21_PACS_SCP32"connectionName="LeadStorageServer21_32" />--><add productName="Workstation" serviceName="L21_WS_SERVER32"connectionName="MedicalWorkstation21_32" /></storageDataAccessConfiguration175><myStorageDataAccessConfiguration175 connectionName="MyDicomDb"><add productName="StorageServer" serviceName=" L21_PACS_SCP32" connectionName="MyDicomDb" /></myStorageDataAccessConfiguration175>
Add a new connection string item to the <connectionStrings> element.
The new connection string is shown highlighted in yellow below. The difference between the old version and the new one is that in the old string, the name and catalog are called "LeadStorageServer21_32", whereas in the new string they are called "MyDicomDb".
<connectionStrings><add name="LeadStorageServer21_32"connectionString="Data Source=medical-test;Failover Partner=;Initial Catalog=LeadStorageServer21_32;Integrated Security=False;User ID=sa;Password=sa;Pooling=True"providerName="System.Data.SqlClient" /><add name="MyDicomDb" connectionString="Data Source=medical-test;Failover Partner=;Initial Catalog=MyDicomDb;Integrated Security=False;User ID=sa;Password=sa;Pooling=True"providerName="System.Data.SqlClient" /></connectionStrings>
Note:
The Data Source here is “medical-test”. You should change this to point to your SQL Server with the machine name followed by the SQL Server name, eg: Data Source=”myMachineName\SQLServer” You may need to change the SQL Server ID and password to successfully authenticate as well.Save the changes to globalPacs.config, and close the file.
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager.Modify shell.cs
Note that all of these changes are already in the shipping version of shell.cs, wrapped in directives
The default location is C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\Shell\Shell.cs.
// Code changes for Tutorialusing Leadtools.Medical.Storage.DataAccessLayer.Interface;using My.Medical.Storage.DataAccessLayer;using My.Medical.Storage.DataAccessLayer.Entities;// Code changes for Tutorial
Add the following to the Run() method, immediately after the call to CreateConfigurationServices ( service ) ;
// Code changes for TutorialDataAccessServiceLocator.Register<IPatientInfo>(new MyPatientInfo());DataAccessServiceLocator.Register<IStudyInfo>(new MyStudyInfo());DataAccessServiceLocator.Register<ISeriesInfo>(new MySeriesInfo());DataAccessServiceLocator.Register<IInstanceInfo>(new MyInstanceInfo());RegisteredEntities.Items.Add(RegisteredEntities.PatientEntityName, typeof(MyPatient));RegisteredEntities.Items.Add(RegisteredEntities.StudyEntityName, typeof(MyStudy));RegisteredEntities.Items.Add(RegisteredEntities.SeriesEntityName, typeof(MySeries));RegisteredEntities.Items.Add(RegisteredEntities.InstanceEntityName, typeof(MyInstance));// Code changes for Tutorial
In the RegisterDataAccessLayers() method, change the following statement to create an instance of MyStorageDataAccessConfigurationView. The change is highlighted in yellow:
storageAgent = DataAccessFactory.GetInstance ( new MyStorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent> ( ) ;Modify Program.cs
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\Program.cs.bool dbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message);dbConfigured = true;
Modify StorageServerContainerPresenter.cs
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\UI\StorageServerContainer\StorageServerContainerPresenter.cs.// Code changes for Tutorialusing My.Medical.Storage.DataAccessLayer;using My.Medical.Storage.DataAccessLayer.Entities;using Leadtools.Dicom.Common.DataTypes;using Leadtools.Medical.Winforms.Control;using Leadtools.Dicom.Common.Extensions;// Code changes for Tutorial
After the RunView() method, insert the MyPrepareSearch() method. See Assigning the StorageDatabaseManager.PrepareSearch delegate for an explanation of the delegate.
private void MyPrepareSearch(MatchingParameterCollection matchingCollection){DicomQueryParams q = __DbManager.GetDicomQueryParams();try{MatchingParameterList matchingList = new MatchingParameterList();MyPatient patient = new MyPatient();MyStudy study = new MyStudy();MySeries series = new MySeries();matchingList.Add(patient);matchingList.Add(study);matchingList.Add(series);matchingCollection.Add(matchingList);study.StudyAccessionNumber = q.AccessionNumber;patient.PatientIdentification = q.PatientId;if (!string.IsNullOrEmpty(q.PatientName.FamilyName))patient.PatientName = q.PatientName.FamilyName.TrimEnd('*') + "*";if (!string.IsNullOrEmpty(q.PatientName.GivenName))patient.PatientName = q.PatientName.GivenName.TrimEnd('*') + "*";if (!string.IsNullOrEmpty(q.Modalities))series.SeriesModality = q.Modalities.Replace(",", "\\"); ;if (!string.IsNullOrEmpty(q.SeriesDescription))series.SeriesSeriesDescription = q.SeriesDescription.TrimEnd('*') + "*";if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.FamilyName))study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.FamilyName.TrimEnd('*') + "*"; ;if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.GivenName))study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.GivenName.TrimEnd('*') + "*"; ;if (q.StudyFromChecked || q.StudyToChecked){DateRange studyDateRange = new DateRange();if (q.StudyFromChecked){studyDateRange.StartDate = q.StudyFromDate;}if (q.StudyToChecked){studyDateRange.EndDate = q.StudyToDate;}study.StudyStudyDate = studyDateRange;}if (q.StorageDateChecked){MyInstance instance = new MyInstance();DateRange dateRange = new DateRange();DateRangeFilter StorageDateRangeFilter = q.StorageDateRange;string startDate = StorageDateRangeFilter.DateRangeFrom;string endDate = StorageDateRangeFilter.DateRangeTo;if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.DateRange){if (!string.IsNullOrEmpty(startDate)){dateRange.StartDate = DateTime.Parse(startDate);}if (!string.IsNullOrEmpty(endDate)){dateRange.EndDate = DateTime.Parse(endDate);}}else if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.Months){DateTime lastMonthsDate = DateTime.Now.SubtractMonths(Convert.ToInt32(StorageDateRangeFilter.LastMonths));dateRange.StartDate = lastMonthsDate;dateRange.EndDate = DateTime.Now;}else{TimeSpan subtractionDays = new TimeSpan(Convert.ToInt32(StorageDateRangeFilter.LastDays),DateTime.Now.Hour,DateTime.Now.Minute,DateTime.Now.Second,DateTime.Now.Millisecond);dateRange.StartDate = DateTime.Now.Subtract(subtractionDays);dateRange.EndDate = DateTime.Now;}instance.ImageLastStoreDate = dateRange;matchingList.Add(instance);}study.StudyStudyId = q.StudyId;}catch (Exception exception){throw exception;}finally{// do nothing ;}}
In the CreateContainerPages( ) method, assign the PrepareSearchDelegate
StorageDatabaseManager dbManager = new StorageDatabaseManager ( ) ;dbManager.PrepareSearch = new PrepareSearchDelegate(MyPrepareSearch);
In the CreateContainerPages( ) method, , add a call to get the query parameters
ServerState.Instance.LicenseChanged += new EventHandler(Instance_LicenseChanged);dbManager.GetDicomQueryParams();
In the ConfigureServerInfoConrol ( ) method, modify the GetConnectionString call to use the custom configuration
storage = GetConnectionString(configPacs, configMachine,new MyStorageDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
Build StorageServerManagerDemo_Original.exe
Modify Leadtools.Dicom.Server.exe.config (additions are highlighted in yellow)
<?xml version="1.0" encoding="utf-8" ?><configuration><configSections><section name="leadLogging" type="Leadtools.Logging.Configuration.ConfigSectionHandler, Leadtools.Logging" /><section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" /><sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" ><section name="Leadtools.Dicom.Service.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /></sectionGroup></configSections><leadLogging><channels><channel name="DataAccessLoggingChannel" type="Leadtools.Medical.Logging.DataAccessLayer.DataAccessLoggingChannel, Leadtools.Medical.Logging.DataAccessLayer" /></channels></leadLogging><xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyCatalog.xml"/><runtime><generatePublisherEvidence enabled="false"/><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-3.5.1.0" newVersion="3.5.1.0"/></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Practices.ObjectBuilder2" publicKeyToken="31BF3856AD364E35" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/></dependentAssembly></assemblyBinding></runtime><appSettings><add key="LicenseFile" value=""/><add key="DeveloperKey" value=""/><add key="DataSetSchema" value=" C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyDataSet.xsd"/></appSettings></configuration>
Modify StorageServerManagerDemo_Original.exe.config (additions are highlighted in yellow)
<?xml version="1.0"?><configuration><configSections><section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" /></configSections><xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyCatalog.xml"/><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-3.5.1.0" newVersion="3.5.1.0"/></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Practices.ObjectBuilder2" publicKeyToken="31BF3856AD364E35" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral"/><bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/></dependentAssembly></assemblyBinding></runtime><appSettings><add key="DataSetSchema" value=" C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyDataSet.xsd"/></appSettings></configuration>
Open the Query Settings, and set the IOD XML Path to be your MyQueryIOD.xml file.
Script to create the Forward table
USE [MyDicomDb]GO/****** Object: Table [dbo].[Forward] Script Date: 09/04/2013 15:55:39 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[Forward]([SOPInstanceUID] [nvarchar](64) NOT NULL,[ForwardDate] [datetime] NULL,[ExpireDate] [datetime] NULL,CONSTRAINT [PK_Forward] PRIMARY KEY CLUSTERED([SOPInstanceUID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[Forward] WITH CHECK ADD CONSTRAINT [FK_Forward_Instance] FOREIGN KEY([SOPInstanceUID])REFERENCES [dbo].[MyInstanceTable] ([SOPInstanceUID])ON UPDATE CASCADEON DELETE CASCADEGOALTER TABLE [dbo].[Forward] CHECK CONSTRAINT [FK_Forward_Instance]GO
Modify the Leadtools.Medical.Forward.DataAccessLayer assembly
C:\LEADTOOLS22\Examples\Medical\DotNet\Medical.Forward.DataAccessLayer.Add the following to the ForwardDBDataAccessAgent constructor:
public ForwardDBDataAccessAgent(string connectionString){#if TUTORIAL_CUSTOM_DATABASE_instanceTableName = @"MyInstanceTable";_columnNameSOPInstanceUID = @"SOPInstanceUID";_columnNameReferencedFile = @"ImageFilename";#endifConnectionString = connectionString;}
Open the properties page
Add TUTORIAL_CUSTOM_DATABASE from the Conditional compilation symbols
Build the project to generate the new Leadtools.Medical.Forward.DataAccessLayer.dll assembly.
Modify the GlobalPacs.config
<forwardConfiguration175>, comment out the existing entry and add a new entry with MyDicomDb as the connection name. The changes are highlighted in yellow below.
<forwardConfiguration175><!--<add productName="StorageServer" serviceName="L21_PACS_SCP32" connectionName="LeadStorageServer21_32" />--><add productName="StorageServer" serviceName="L21_PACS_SCP32" connectionName="MyDicomDb" /></forwardConfiguration175>
Save the changes to globalPacs.config, and close the file