// This example builds a IDbCommand // for querying the MyPatient table // The generated WHERE clause contains PatientName and PatientSex public void MyExample() { MatchingParameterCollection matchingParamCollection = new MatchingParameterCollection(); MatchingParameterList matchingParamList = new MatchingParameterList(); MyPatient myPatient = new MyPatient(); myPatient.PatientName = "Smith"; myPatient.PatientSex = "M"; matchingParamList.Add(myPatient); matchingParamCollection.Add(matchingParamList); IDbCommand command = new SqlCommand(); // This reads the storage catalog // Before you run this, make sure and add the following to your application configuration file //<configSections> // <section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" /> //</configSections> StorageCatalog myCatalog = new StorageCatalog(); Collection <CatalogElement[]> catalogElements = CatalogDescriptor.GetElementsCollection(matchingParamCollection, myCatalog, true); PreparePatientsQueryCommand(command, catalogElements, ExtraQueryOptions.Typical); // The 'WHERE' clause of command.CommandText is the following: // WHERE ( ( MyPatientTable.PatientName LIKE 'Smith' ) AND ( MyPatientTable.PatientSex LIKE 'M' ) ) Console.WriteLine(command.CommandText); }
public Stream GetMessageCatalog(StorageCatalog messageCatalog) { Trace.TraceInformation(String.Format(Resources.VersioningMessageCatalog, "catalog name")); var catalogName = Enum.GetName(typeof(StorageCatalog), messageCatalog); if (catalogName == null) { Trace.TraceError(String.Format(Resources.VersioningMessageCatalogNullCatalogName, "catalog name")); throw new NullReferenceException(); } var catalog = Resources.ResourceManager.GetObject(catalogName); if (catalog == null) { Trace.TraceError(String.Format(Resources.VersioningMessageCatalogNullCatalog, "catalog name")); throw new NullReferenceException(); } return(new MemoryStream((byte[])catalog)); }
public static Uri GetMessageCatalogUri(Uri vasaUri, StorageCatalog messageCatalog) { Trace.TraceInformation(Resources.VersioningGetMessageCatalogUri); var catalogName = Enum.GetName(typeof(StorageCatalog), messageCatalog); if (catalogName == null) { Trace.TraceError(Resources.VersioningGetMessageCatalogUriNullCatalog); throw new NullReferenceException(); } return(new Uri(vasaUri, string.Format("{0}/MessageCatalog/{1}.vmsg", Postfix, catalogName).ToLower())); }
// This example is a test to build all queries public void MySampleQueries() { MatchingParameterCollection matchingParamCollection = new MatchingParameterCollection(); MatchingParameterList matchingParamList = new MatchingParameterList(); matchingParamCollection.Add(matchingParamList); StorageCatalog myCatalog = new StorageCatalog(); Collection <CatalogElement[]> catalogElements = CatalogDescriptor.GetElementsCollection(matchingParamCollection, myCatalog, true); IDbCommand command = new SqlCommand(); PreparePatientsQueryCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareStudiesQueryCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareSeriesQueryCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareInstanceQueryCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareDeletePatientsCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareDeleteStudiesCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareDeleteSeriesCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareDeleteInstanceCommand(command, catalogElements, ExtraQueryOptions.Typical); PrepareDeletePatientsNoChildStudiesCommand(command); PrepareDeleteStudiesNoChildSeriesCommand(command); PrepareDeleteSeriesNoChildInstancesCommand(command); DeletePatient(matchingParamCollection); DeleteStudy(matchingParamCollection); DeleteSeries(matchingParamCollection); DeleteInstance(matchingParamCollection); PrepareIsPatientExistsCommand(command, "1111"); PrepareIsStudyExistsCommand(command, "2222"); PrepareIsSeriesExistsCommand(command, "3333"); PrepareIsInstanceExistsCommand(command, "4444"); }