Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, April 28, 2011 10:19:59 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 207

Was thanked: 3 time(s) in 3 post(s)

This post was performed using LEADTOOLS version 17.0, Visual Studio 2008 (C#), and SQL Express.

First let's create a new database using our Database Configuration Demo found here: "\Program Files\LEAD Technologies\LEADTOOLS 17\Bin\Dotnet\Win32\CSPacsDatabaseConfigurationDemo_Original.exe"

Once running, uncheck all database names except "DICOM Work-list Database" and ensure "Create New Databases" is selected at the top.  Press "Next"
For the Data Source, press the "Change" button and select "Microsoft SQL Server" (note this post will not work with SQL CE)  Your machine name should be selected by default in the next drop down.  If, not, be sure to select it.  At the bottom, enter a name for your database.  For this post I will enter "ModalityWorklistDB"  Take the defaults for all other options and press "Next" until you have created the database.  You can then close the demo.

Next, we will change the name of one of the tables in the ModalityWorklistDB.  You can do this using the Server Explorer from Visual Studio.  If you do not have the Server Explorer showing in Visual Studio, click "View | Server Explorer"  In the Server Explorer, right click "Database Connections" and select "Add Connection"  In the next dialog, ensure "Microsoft SQL Server (SqlClient)" is selected.  If not, use the "Change" button to select it.  In the "Server name" drop down, select your SQL server (typically this is your machine name.)  In the "Connect to a database" section, select the "ModalityWorklistDB" from the drop down.  Press the "OK" button to connect.  Now right click on the connection and select "New Query..." Close the "Add Table" dialog, and delete the "SELECT/FROM" SQL statement, replacing them with this: sp_rename 'Patient', 'Patient_MWL' 
Next, press the "Execute SQL" in the tool bar above. Press "yes" to continue in the next dialog and you should then see a dialog stating that the SQL executed successfully.  We have now renamed the table within the database.

Now that we have our database and table setup, let's go to our Modality Work-list Addin project.  You can find it here: "\Program Files\LEAD Technologies\LEADTOOLS 17\Examples\PACSFramework\CS\Leadtools.Medical.Worklist.AddIns\CSLeadtools.Medical.Worklist.AddIns_x86.csproj"  Once opened, right click on the project and select "Add  | New Folder"  Name the folder "CustomClasses".  Right click on the "CustomClasses" folder and select Add | New Item..."  Add a new Class. Name the class, "MyWorklistSqlCeDataAccessAgent" The following is how you should define your class:

using Leadtools.Medical.Worklist.DataAccessLayer;
using Leadtools.Dicom;

namespace Leadtools.Medical.Worklist.AddIns.MyCustomClasses
{
    public class MyWorklistSqlDbDataAccessAgent : WorklistSqlDbDataAccessAgent
    {
       public MyWorklistSqlDbDataAccessAgent(string connectionString)
            : base(connectionString)
        {

        }

        protected override void PrepareMWLQueryCommand(System.Data.IDbCommand command, System.Collections.ObjectModel.Collection<Leadtools.Medical.DataAccessLayer.Catalog.CatalogElement[]> matchingParamsCollection, System.Collections.Specialized.StringCollection NoReturnStatusStrings)
        {
           base.PrepareMWLQueryCommand(command, matchingParamsCollection, NoReturnStatusStrings);

           command.CommandText = command.CommandText.Replace(" Patient ", " Patient_MWL ");
           command.CommandText = command.CommandText.Replace(" Patient.", " Patient_MWL.");

        }           
    }
}

As you can see, in the PrepareMWLQueryCommand override, we rename the table in the SQL text that is generated by our base class.  This tells our tools to use this table name instead of the default name.  Next, we must use tell our Addin to use this new class.

Under the "ModalityWorklistAddin" folder, open the "MWLAddin.cs.

In this file you will want to alter it like this:

// Modified Code:
MyWorklistSqlDbDataAccessAgent agent = new MyWorklistSqlDbDataAccessAgent(@"Data Source=ttest\SQLEXPRESS;Initial Catalog=MWLDatabase;Integrated Security=True;User ID=;Password=;Pooling=True");
mwlCommand = new MWLCFindCommand(sessionProxy, Request, agent);
// Modified Code:

// Original Code
//mwlCommand = DicomCommandFactory.GetInstance ( ).CreateCFindCommand ( sessionProxy, Request )  ;
// Original Code

This code comments out some original code, and adds some new code.  The new code uses our new class and accepts a connection string that points to our new database.

When this code is used, we will connect to the new database.  When the SQL statements are constructed for the query, the name of the table will be altered to use the new table name.  This occurs because we are now using our derived class.

Now, to test this, you will need to stop our high level server using the Server Manager Demo, found here: "\Program Files\LEAD Technologies\LEADTOOLS 17\Bin\Dotnet\Win32\CSLeadtools.Dicom.Server.Manager_Original.exe"  Use this demo to stop the L17_SERVER_32. Once stopped, you can then build the MWL Addin project.  After it has successfully built, start the L17_SERVER_32 Service. 

Next, use our high level MWL SCU demo found here: "\Program Files\LEAD Technologies\LEADTOOLS 17\Bin\Dotnet\Win32\CsDicomHighLevelMwlScudemo_original.exe" to query the server.  If everything works correctly, you should be able to query the server and see results returned from it. 

Travis Montgomery
Senior Sales Engineer
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.069 seconds.