Open and compile the project My.Medical.Storage.DataAccessLayer project. The default location is C:\LEADTOOLS 19\Examples\PACSFramework \CS \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:
1. Open MyDataSet.Designer.cs, and replace all instances of SqlDbType.Date with SqlDbType.DateTime
2. 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:\LEADTOOLS 19\Examples\PACSFramework \CS\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]
GO
ALTER DATABASE [MyDicomDb] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDicomDb] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDicomDb] SET DISABLE_BROKER
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MyDicomDb] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [MyDicomDb] SET READ_WRITE
GO
ALTER DATABASE [MyDicomDb] SET RECOVERY FULL
GO
ALTER DATABASE [MyDicomDb] SET MULTI_USER
GO
ALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MyDicomDb] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'MyDicomDb', N'ON'
GO
USE [MyDicomDb]
GO
/****** Object: Table [dbo].[MyPatientTable] Script Date: 07/01/2013 17:44:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 CASCADE
GO
ALTER 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])
GO
ALTER 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])
GO
ALTER 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]
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDicomDb] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDicomDb] SET DISABLE_BROKER
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MyDicomDb] SET READ_WRITE
GO
ALTER DATABASE [MyDicomDb] SET RECOVERY FULL
GO
ALTER DATABASE [MyDicomDb] SET MULTI_USER
GO
ALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MyDicomDb] SET DB_CHAINING OFF
GO
USE [MyDicomDb]
GO
/****** Object: Table [dbo].[MyPatientTable] Script Date: 08/12/2013 10:39:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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])
GO
ALTER 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])
GO
ALTER 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 CASCADE
GO
ALTER TABLE [dbo].[MyInstanceTable] CHECK CONSTRAINT [FK_DImage_Series]
GO
<!--<section name="storageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=19.0.4.0, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />-->
<section name="myStorageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=19.0.4.0, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />
<storageDataAccessConfiguration175 connectionName="LeadStorageServer19_32">
<!--<add productName="StorageServer" serviceName="L19_PACS_SCP32"
connectionName="LeadStorageServer19_32" />-->
<add productName="Workstation" serviceName="L19_WS_SERVER32"
connectionName="MedicalWorkstation19_32" />
</storageDataAccessConfiguration175>
<myStorageDataAccessConfiguration175 connectionName="MyDicomDb">
<add productName="StorageServer" serviceName=" L19_PACS_SCP32" connectionName="MyDicomDb" />
</myStorageDataAccessConfiguration175>
<connectionStrings>
<add name="LeadStorageServer19_32"
connectionString="Data Source=medical-test;Failover Partner=;Initial Catalog=LeadStorageServer19_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>
Data Source=”myMachineName\SQLServer” You may need to change the SQL Server ID and password to successfully authenticate as well.
// Code changes for Tutorial
using Leadtools.Medical.Storage.DataAccessLayer.Interface;
using My.Medical.Storage.DataAccessLayer;
using My.Medical.Storage.DataAccessLayer.Entities;
// Code changes for Tutorial
// Code changes for Tutorial
DataAccessServiceLocator.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
storageAgent = DataAccessFactory.GetInstance ( new MyStorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent> ( ) ;
bool dbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message);
dbConfigured = true;
// Code changes for Tutorial
using 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
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 ;
}
}
StorageDatabaseManager dbManager = new StorageDatabaseManager ( ) ;
dbManager.PrepareSearch = new PrepareSearchDelegate(MyPrepareSearch);
ServerState.Instance.LicenseChanged += new EventHandler(Instance_LicenseChanged);
dbManager.GetDicomQueryParams();
storage = GetConnectionString(configPacs, configMachine,
new MyStorageDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
<?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:\LEADTOOLS 19\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:\LEADTOOLS 19\Bin\Dotnet4\Win32\MyDataSet.xsd"/>
</appSettings>
</configuration>
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" />
</configSections>
<xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS 19\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:\LEADTOOLS 19\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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE 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]
GO
ALTER TABLE [dbo].[Forward] WITH CHECK ADD CONSTRAINT [FK_Forward_Instance] FOREIGN KEY([SOPInstanceUID])
REFERENCES [dbo].[MyInstanceTable] ([SOPInstanceUID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Forward] CHECK CONSTRAINT [FK_Forward_Instance]
GO
Modify the Leadtools.Medical.Forward.DataAccessLayer assembly
ForwardDBDataAccessAgent
constructor:public ForwardDBDataAccessAgent(string connectionString)
{
#if TUTORIAL_CUSTOM_DATABASE
_instanceTableName = @"MyInstanceTable";
_columnNameSOPInstanceUID = @"SOPInstanceUID";
_columnNameReferencedFile = @"ImageFilename";
#endif
ConnectionString = connectionString;
}
, 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="L19_PACS_SCP32" connectionName="LeadStorageServer19_32" />-->
<add productName="StorageServer" serviceName="L19_PACS_SCP32" connectionName="MyDicomDb" />
</forwardConfiguration175>
Products |
Support |
Feedback: Tutorial: Sample Database for the LEAD Storage Server |
Introduction |
Help Version 19.0.2017.6.21
|