Exemplo n.º 1
0
        private string MyGetSeriesCommandText(Collection <CatalogElement[]> matchingParamsCollection)
        {
            try
            {
                StringBuilder sb = new StringBuilder(500);


                sb.Append(MyConstants.SelectCommandText.FirstPart);
                sb.Append(MyConstants.SelectCommandText.FromClause.Series);
                sb.Append(InjectJoinForSeriesQuery());
                sb.Append(SqlProviderUtilities.GenerateWhereStatement(matchingParamsCollection));
                sb.Append(MyConstants.SelectCommandText.MIDDLE_PART);
                sb.Append(MyConstants.SelectCommandText.SelectStatements.PatientEntity);
                sb.Append(MyConstants.SelectCommandText.SelectStatements.StudyEntity);
                sb.Append(MyConstants.SelectCommandText.SelectStatements.SeriesEntity);
                sb.Append(MyConstants.SelectCommandText.LAST_PART);

                return(sb.ToString());
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
                System.Diagnostics.Debug.Assert(false);

                throw;
            }
        }
Exemplo n.º 2
0
        // ***************
        // Delete Commands
        // ***************
        private string MyGetDeleteCommandText(Collection <CatalogElement[]> matchingParamsCollection, string fromPart)
        {
            try
            {
                StringBuilder sb = new StringBuilder(fromPart);

                sb.Append(MyConstants.SelectCommandText.FromClause.Image);
                sb.Append(SqlProviderUtilities.GenerateWhereStatement(matchingParamsCollection));
                sb.Append(MyConstants.DeleteCommandText.DeleteLastPart);

                return(sb.ToString());
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
                System.Diagnostics.Debug.Assert(false);

                throw;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a command that returns a count of instance rows matching the search criteria specified in the matchingParamsCollection
        /// </summary>
        /// <param name="command">IDbCommand that is created</param>
        /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param>
        protected override void PrepareInstanceQueryCountCommand(IDbCommand command, Collection <CatalogElement[]> matchingParamsCollection, ExtraQueryOptions extraQueryOptions)
        {
            if (IsNoTableSpecifiedInParams(matchingParamsCollection))
            {
                command.CommandText = string.Format(MySqlStatments.SqlSpecificSelectCount, "MyInstanceTable");
            }
            else
            {
                StringBuilder sb = new StringBuilder(500);


                sb.Append(MyConstants.SelectCommandText.FirstPart);
                sb.Append(MyConstants.SelectCommandText.FromClause.Image);
                sb.Append(SqlProviderUtilities.GenerateWhereStatement(matchingParamsCollection));
                sb.Append(MyConstants.SelectCommandText.MIDDLE_PART);
                sb.Append(string.Format(MySqlStatments.InstanceEntitySelect.InstanceCount, MyConstants.PrimaryKeyTableName));
                sb.Append(MyConstants.SelectCommandText.LAST_PART);

                command.CommandText = sb.ToString( );
            }
        }
Exemplo n.º 4
0
 // UpdateTable
 private void MyUpdateTable
 (
     MyDataSet updatingDataset,
     DbConnection updatingDbConnection,
     DbTransaction updatingTransaction,
     string tableName
 )
 {
     if (tableName == updatingDataset.MyPatientTable.TableName)
     {
         SqlProviderUtilities.UpdateTable(updatingDataset,
                                          updatingDbConnection,
                                          updatingTransaction,
                                          MyCreateDataAdapter(),
                                          CreateInsertPatientCommand(updatingDbConnection),
                                          CreateUpdatePatientCommnad(updatingDbConnection),
                                          CreateDeletePatientCommand(updatingDbConnection),
                                          tableName,
                                          false,
                                          true,
                                          true,
                                          true);
     }
     else if (tableName == updatingDataset.MyStudyTable.TableName)
     {
         SqlProviderUtilities.UpdateTable(updatingDataset,
                                          updatingDbConnection,
                                          updatingTransaction,
                                          MyCreateDataAdapter(),
                                          CreateInsertStudyCommand(updatingDbConnection),
                                          CreateUpdateStudyCommnad(updatingDbConnection),
                                          CreateDeleteStudyCommand(updatingDbConnection),
                                          tableName,
                                          false,
                                          true,
                                          true,
                                          true);
     }
     else if (tableName == updatingDataset.MySeriesTable.TableName)
     {
         SqlProviderUtilities.UpdateTable(updatingDataset,
                                          updatingDbConnection,
                                          updatingTransaction,
                                          MyCreateDataAdapter(),
                                          CreateInsertSeriesCommand(updatingDbConnection),
                                          CreateUpdateSeriesCommnad(updatingDbConnection),
                                          CreateDeleteSeriesCommand(updatingDbConnection),
                                          tableName,
                                          false,
                                          true,
                                          true,
                                          true);
     }
     else if (tableName == updatingDataset.MyInstanceTable.TableName)
     {
         SqlProviderUtilities.UpdateTable(updatingDataset,
                                          updatingDbConnection,
                                          updatingTransaction,
                                          MyCreateDataAdapter(),
                                          CreateInsertInstanceCommand(updatingDbConnection),
                                          CreateUpdateInstanceCommand(updatingDbConnection),
                                          CreateDeleteInstanceCommand(updatingDbConnection),
                                          tableName,
                                          false,
                                          true,
                                          true,
                                          true);
     }
     else
     {
         SqlProviderUtilities.UpdateTable(updatingDataset,
                                          updatingDbConnection,
                                          updatingTransaction,
                                          DataProvider.DbProviderFactory.CreateDataAdapter( ),
                                          DataProvider.DbProviderFactory.CreateCommandBuilder( ),
                                          tableName,
                                          true,
                                          true,
                                          true,
                                          true);
     }
 }
Exemplo n.º 5
0
        private string GetInstanceCommandText(Collection <CatalogElement[]> matchingParamsCollection, QueryPageInfo queryPageInfo)
        {
            try
            {
                string        sOrderByField = "SOPInstanceUID";
                StringBuilder sb            = new StringBuilder(500);
                string        s;

                // Skip the pagination for now!
                queryPageInfo = null;

                if (queryPageInfo != null)
                {
                    string sTemp = MyConstants.SelectCommandText.GetFirstPartPagination(queryPageInfo);
                    sb.Append(sTemp);

                    string originalTableQuery = MyConstants.SelectCommandText.FromClause.Image;
                    originalTableQuery += InjectJoinForInstanceQuery();
                    sb.Append(originalTableQuery);

                    string sWhere = SqlProviderUtilities.GenerateWherePaginationStatement(matchingParamsCollection, "Instance", "SOPInstanceUID", sOrderByField, queryPageInfo, originalTableQuery);
                    sb.Append(sWhere);
                }
                else
                {
                    s = MyConstants.SelectCommandText.FirstPart;
                    sb.Append(s);

                    s = MyConstants.SelectCommandText.FromClause.Image;
                    sb.Append(s);

                    s = SqlProviderUtilities.GenerateWhereStatement(matchingParamsCollection);
                    sb.Append(s);
                }

                s = MyConstants.SelectCommandText.MIDDLE_PART;
                sb.Append(s);

                s = MyConstants.SelectCommandText.SelectStatements.PatientEntity;
                sb.Append(s);

                s = MyConstants.SelectCommandText.SelectStatements.StudyEntity;
                sb.Append(s);

                s = MyConstants.SelectCommandText.SelectStatements.SeriesEntity;
                sb.Append(s);

                s = MyConstants.SelectCommandText.SelectStatements.InstanceEntity;
                sb.Append(s);

                s = MyConstants.SelectCommandText.LAST_PART;
                sb.Append(s);

                return(sb.ToString());
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
                System.Diagnostics.Debug.Assert(false);

                throw;
            }
        }