can i access remote database via this code or can i get data from remote file via port?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.ServiceModel;
using ClearCanvas.Dicom.ServiceModel.Query;
using ClearCanvas.ImageViewer.Services.Automation;
using ClearCanvas.Desktop.View.WinForms;
namespace WindowsService1
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
public static IList FindStudyByPatientId(string patientId)
{
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("http://127.0.0.1:51124/ClearCanvas/ImageViewer/StudyLocator?wsdl");
StudyRootQueryServiceClient client = new StudyRootQueryServiceClient(binding, endpoint);
try
{
client.Open();
StudyRootStudyIdentifier identifier = new StudyRootStudyIdentifier();
identifier.PatientId = patientId;
IList results = client.StudyQuery(identifier);
client.Close();
return results;
}
catch (Exception)
{
client.Abort();
throw;
}
}
public static void OpenStudy(string studyInstanceUid)
{
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("http://127.0.0.1:51124/ClearCanvas/ImageViewer/Automation?wsdl");
ViewerAutomationServiceClient client = new ViewerAutomationServiceClient(binding, endpoint);
try
{
client.Open();
OpenStudiesRequest request = new OpenStudiesRequest();
request.ActivateIfAlreadyOpen = true;
List studiesToOpen = new List();
OpenStudyInfo info = new OpenStudyInfo(studyInstanceUid);
studiesToOpen.Add(info);
request.StudiesToOpen = studiesToOpen;
client.OpenStudies(request);
client.Close();
}
catch (Exception e)
{
client.Abort();
// MessageBox.Show(e.Message);
}
}
}
}