Beispiel #1
0
        public CustomGenericList <MonthlyStats> MonthlyStatsSelectCurrentMonthSummary(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MonthlyStatsSelectCurrentMonthSummary", connection, transaction))
            {
                using (CustomSqlHelper <MonthlyStats> helper = new CustomSqlHelper <MonthlyStats>())
                {
                    CustomGenericList <MonthlyStats> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Select values from Language by primary key(s).
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="languageCode">Code for a language.</param>
        /// <returns>CustomGenericList&lt;CustomDataRow&gt;</returns>
        public CustomGenericList <CustomDataRow> LanguageSelectAutoRaw(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string languageCode)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("LanguageSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode)))
            {
                return(CustomSqlHelper.ExecuteReaderAndReturnRows(command));
            }
        }
Beispiel #3
0
        public CustomGenericList <Location> LocationSelectAllInvalid(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("LocationSelectAllInvalid", connection, transaction))
            {
                using (CustomSqlHelper <Location> helper = new CustomSqlHelper <Location>())
                {
                    CustomGenericList <Location> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #4
0
        public CustomGenericList <PageName> PageNameSelectByPageID(SqlConnection sqlConnection, SqlTransaction sqlTransaction, int pageID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameSelectByPageID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("PageID", SqlDbType.Int, null, false, pageID)))
            {
                using (CustomSqlHelper <PageName> helper = new CustomSqlHelper <PageName>())
                {
                    return(helper.ExecuteReader(command));
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Select the count of all pages for a particular Item ID.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="itemID">Item identifier</param>
        /// <returns>Count of Pages</returns>
        public int PageSelectCountByItemID(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int itemID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageSelectCountByItemID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("ItemID", SqlDbType.Int, null, false, itemID)))
            {
                return((int)command.ExecuteScalar());
            }
        }
        /// <summary>
        /// Select values from Title_TitleType by primary key(s).
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="title_TitleTypeID"></param>
        /// <returns>CustomGenericList&lt;CustomDataRow&gt;</returns>
        public CustomGenericList <CustomDataRow> Title_TitleTypeSelectAutoRaw(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int title_TitleTypeID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("Title_TitleTypeSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("Title_TitleTypeID", SqlDbType.Int, null, false, title_TitleTypeID)))
            {
                return(CustomSqlHelper.ExecuteReaderAndReturnRows(command));
            }
        }
Beispiel #7
0
        public CustomGenericList <PDF> PDFSelectForDeletion(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PDFSelectForDeletion", connection, transaction))
            {
                using (CustomSqlHelper <PDF> helper = new CustomSqlHelper <PDF>())
                {
                    CustomGenericList <PDF> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #8
0
        public CustomGenericList <Title> TitleSelectByAbbreviation(SqlConnection sqlConnection, SqlTransaction sqlTransaction, string abbreviation)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleSelectByAbbreviation", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("Abbreviation", SqlDbType.NVarChar, 125, false, abbreviation)))
            {
                using (CustomSqlHelper <Title> helper = new CustomSqlHelper <Title>())
                {
                    return(helper.ExecuteReader(command));
                }
            }
        }
Beispiel #9
0
        public CustomGenericList <OpenUrlCitation> OpenUrlCitationSelectByCitationDetails(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int titleID,
            string oclc,
            string lccn,
            string isbn,
            string issn,
            string abbreviation,
            string coden,
            string title,
            string authorLast,
            string authorFirst,
            string authorCorporation,
            string publisherName,
            string publisherPlace,
            string publisher,
            string volume,
            string issue,
            string year,
            string startPage)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("OpenUrlCitationSelectByCitationDetails", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, true, titleID),
                                                                      CustomSqlHelper.CreateInputParameter("OCLC", SqlDbType.NVarChar, 125, true, oclc),
                                                                      CustomSqlHelper.CreateInputParameter("LCCN", SqlDbType.NVarChar, 125, true, lccn),
                                                                      CustomSqlHelper.CreateInputParameter("ISBN", SqlDbType.NVarChar, 125, true, isbn),
                                                                      CustomSqlHelper.CreateInputParameter("ISSN", SqlDbType.NVarChar, 125, true, issn),
                                                                      CustomSqlHelper.CreateInputParameter("Abbreviation", SqlDbType.NVarChar, 125, true, abbreviation),
                                                                      CustomSqlHelper.CreateInputParameter("CODEN", SqlDbType.NVarChar, 125, true, coden),
                                                                      CustomSqlHelper.CreateInputParameter("Title", SqlDbType.NVarChar, 2000, true, title),
                                                                      CustomSqlHelper.CreateInputParameter("AuthorLast", SqlDbType.NVarChar, 150, true, authorLast),
                                                                      CustomSqlHelper.CreateInputParameter("AuthorFirst", SqlDbType.NVarChar, 100, true, authorFirst),
                                                                      CustomSqlHelper.CreateInputParameter("AuthorCorporation", SqlDbType.NVarChar, 255, true, authorCorporation),
                                                                      CustomSqlHelper.CreateInputParameter("PublisherName", SqlDbType.NVarChar, 255, true, publisherName),
                                                                      CustomSqlHelper.CreateInputParameter("PublisherPlace", SqlDbType.NVarChar, 150, true, publisherPlace),
                                                                      CustomSqlHelper.CreateInputParameter("Publisher", SqlDbType.NVarChar, 255, true, publisher),
                                                                      CustomSqlHelper.CreateInputParameter("Volume", SqlDbType.NVarChar, 100, true, volume),
                                                                      CustomSqlHelper.CreateInputParameter("Issue", SqlDbType.NVarChar, 20, true, issue),
                                                                      CustomSqlHelper.CreateInputParameter("Year", SqlDbType.NVarChar, 20, true, year),
                                                                      CustomSqlHelper.CreateInputParameter("StartPage", SqlDbType.NVarChar, 20, true, startPage)))
            {
                CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command);
                return(this.GetOpenUrlCitationList(list));
            }
        }
Beispiel #10
0
        /// <summary>
        /// Update values in TitleAssociation. Returns an object of type TitleAssociation.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="connectionKeyName">Connection key name located in config file.</param>
        /// <param name="titleAssociationID"></param>
        /// <param name="titleID"></param>
        /// <param name="titleAssociationTypeID"></param>
        /// <param name="title"></param>
        /// <param name="section"></param>
        /// <param name="volume"></param>
        /// <param name="heading"></param>
        /// <param name="publication"></param>
        /// <param name="relationship"></param>
        /// <param name="active"></param>
        /// <param name="associatedTitleID"></param>
        /// <returns>Object of type TitleAssociation.</returns>
        public TitleAssociation TitleAssociationUpdateAuto(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            int titleAssociationID,
            int titleID,
            int titleAssociationTypeID,
            string title,
            string section,
            string volume,
            string heading,
            string publication,
            string relationship,
            bool active,
            int?associatedTitleID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleAssociationUpdateAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("TitleAssociationID", SqlDbType.Int, null, false, titleAssociationID),
                                                                      CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, false, titleID),
                                                                      CustomSqlHelper.CreateInputParameter("TitleAssociationTypeID", SqlDbType.Int, null, false, titleAssociationTypeID),
                                                                      CustomSqlHelper.CreateInputParameter("Title", SqlDbType.NVarChar, 500, false, title),
                                                                      CustomSqlHelper.CreateInputParameter("Section", SqlDbType.NVarChar, 500, false, section),
                                                                      CustomSqlHelper.CreateInputParameter("Volume", SqlDbType.NVarChar, 500, false, volume),
                                                                      CustomSqlHelper.CreateInputParameter("Heading", SqlDbType.NVarChar, 500, false, heading),
                                                                      CustomSqlHelper.CreateInputParameter("Publication", SqlDbType.NVarChar, 500, false, publication),
                                                                      CustomSqlHelper.CreateInputParameter("Relationship", SqlDbType.NVarChar, 500, false, relationship),
                                                                      CustomSqlHelper.CreateInputParameter("Active", SqlDbType.Bit, null, false, active),
                                                                      CustomSqlHelper.CreateInputParameter("AssociatedTitleID", SqlDbType.Int, null, true, associatedTitleID),
                                                                      CustomSqlHelper.CreateReturnValueParameter("ReturnCode", SqlDbType.Int, null, false)))
            {
                using (CustomSqlHelper <TitleAssociation> helper = new CustomSqlHelper <TitleAssociation>())
                {
                    CustomGenericList <TitleAssociation> list = helper.ExecuteReader(command);
                    if (list.Count > 0)
                    {
                        TitleAssociation o = list[0];
                        list = null;
                        return(o);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
Beispiel #11
0
        public CustomGenericList <CustomDataRow> PageNameSearchForTitles(SqlConnection sqlConnection,
                                                                         SqlTransaction sqlTransaction, string name, string languageCode)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameSearchForTitles", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("NameConfirmed", SqlDbType.NVarChar, 100, false, name),
                                                                      CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode)))
            {
                CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command);
                return(list);
            }
        }
        /// <summary>
        /// Select values from MarcDataField by primary key(s).
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="connectionKeyName">Connection key name located in config file.</param>
        /// <param name="marcDataFieldID"></param>
        /// <returns>CustomGenericList&lt;CustomDataRow&gt;</returns>
        public CustomGenericList <CustomDataRow> MarcDataFieldSelectAutoRaw(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string connectionKeyName,
            int marcDataFieldID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings(connectionKeyName), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcDataFieldSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("MarcDataFieldID", SqlDbType.Int, null, false, marcDataFieldID)))
            {
                return(CustomSqlHelper.ExecuteReaderAndReturnRows(command));
            }
        }
Beispiel #13
0
        public CustomGenericList <OpenUrlCitation> OpenUrlCitationSelectByTitleID(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int titleID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("OpenUrlCitationSelectByTitleID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, true, titleID)))
            {
                CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command);
                return(this.GetOpenUrlCitationList(list));
            }
        }
Beispiel #14
0
        public static CustomGenericList <TitleType> SelectAll(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleTypeSelectAll", connection, transaction))
            {
                using (CustomSqlHelper <TitleType> helper = new CustomSqlHelper <TitleType>())
                {
                    CustomGenericList <TitleType> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #15
0
        public void MarcUpdateStatusError(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int marcID)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcUpdateStatusError", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("MarcID", SqlDbType.Int, null, false, marcID)))
            {
                CustomSqlHelper.ExecuteNonQuery(command);
            }
        }
Beispiel #16
0
        public CustomGenericList <PDFPage> PDFPageSelectForPdfID(SqlConnection sqlConnection, SqlTransaction sqlTransaction,
                                                                 int PdfId)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PDFPageSelectForPdfID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("PdfID", SqlDbType.Int, null, false, PdfId)))
            {
                using (CustomSqlHelper <PDFPage> helper = new CustomSqlHelper <PDFPage>())
                {
                    CustomGenericList <PDFPage> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #17
0
        public bool MarcResolveTitles(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int batchId)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MarcResolveTitles", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("MarcImportBatchID", SqlDbType.Int, null, false, batchId)))
            {
                bool result = Convert.ToBoolean(CustomSqlHelper.ExecuteScalar(command));
                return(result);
            }
        }
Beispiel #18
0
        /// <summary>
        /// Select values from IndicatedPage by primary key(s).
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="pageID">Unique identifier for each Page record.</param>
        /// <param name="sequence">A number to separately identify various series of Indicated Pages.</param>
        /// <returns>CustomGenericList&lt;CustomDataRow&gt;</returns>
        public CustomGenericList <CustomDataRow> IndicatedPageSelectAutoRaw(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int pageID,
            short sequence)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("IndicatedPageSelectAuto", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("PageID", SqlDbType.Int, null, false, pageID),
                                                                      CustomSqlHelper.CreateInputParameter("Sequence", SqlDbType.SmallInt, null, false, sequence)))
            {
                return(CustomSqlHelper.ExecuteReaderAndReturnRows(command));
            }
        }
Beispiel #19
0
        public static CustomGenericList <Item> ItemSelectPaginationReport(SqlConnection sqlConnection,
                                                                          SqlTransaction sqlTransaction)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("ItemSelectPaginationReport", connection, transaction))
            {
                using (CustomSqlHelper <Item> helper = new CustomSqlHelper <Item>())
                {
                    CustomGenericList <Item> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #20
0
        public static CustomGenericList <NameCloud> PageNameSelectTop(SqlConnection sqlConnection,
                                                                      SqlTransaction sqlTransaction, int top)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameSelectTop", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("Number", SqlDbType.Int, null, false, top)))
            {
                using (CustomSqlHelper <NameCloud> helper = new CustomSqlHelper <NameCloud>())
                {
                    return(helper.ExecuteReader(command));
                }
            }
        }
Beispiel #21
0
        public CustomGenericList <Language> LanguageSelectWithPublishedItems(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("LanguageSelectWithPublishedItems", connection, transaction))
            {
                using (CustomSqlHelper <Language> helper = new CustomSqlHelper <Language>())
                {
                    CustomGenericList <Language> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #22
0
        public CustomGenericList <Location> LocationSelectValidByInstitution(SqlConnection sqlConnection, SqlTransaction sqlTransaction, string institutionCode, string languageCode)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("LocationSelectValidByInstitution", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("InstitutionCode", SqlDbType.NVarChar, 10, false, institutionCode),
                                                                      CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode)))
            {
                using (CustomSqlHelper <Location> helper = new CustomSqlHelper <Location>())
                {
                    CustomGenericList <Location> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #23
0
        public static void Save(SqlConnection sqlConnection, SqlTransaction sqlTransaction,
                                TitleAssociation titleAssociation)
        {
            SqlConnection  connection  = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

            if (connection == null)
            {
                connection =
                    CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"));
            }

            bool isTransactionCoordinator = CustomSqlHelper.IsTransactionCoordinator(transaction);

            try
            {
                transaction = CustomSqlHelper.BeginTransaction(connection, transaction, isTransactionCoordinator);

                CustomDataAccessStatus <TitleAssociation> updatedTitleAssociation =
                    new TitleAssociationDAL().TitleAssociationManageAuto(connection, transaction, titleAssociation);

                if (titleAssociation.TitleAssociationIdentifiers.Count > 0)
                {
                    TitleAssociation_TitleIdentifierDAL titleAssociationTitleIdentifierDAL = new TitleAssociation_TitleIdentifierDAL();
                    foreach (TitleAssociation_TitleIdentifier titleAssociationTitleIdentifier in titleAssociation.TitleAssociationIdentifiers)
                    {
                        if (titleAssociationTitleIdentifier.TitleAssociationID == 0)
                        {
                            titleAssociationTitleIdentifier.TitleAssociationID = updatedTitleAssociation.ReturnObject.TitleAssociationID;
                        }
                        titleAssociationTitleIdentifierDAL.TitleAssociation_TitleIdentifierManageAuto(connection, transaction, titleAssociationTitleIdentifier);
                    }
                }

                CustomSqlHelper.CommitTransaction(transaction, isTransactionCoordinator);
            }
            catch (Exception ex)
            {
                CustomSqlHelper.RollbackTransaction(transaction, isTransactionCoordinator);

                throw new Exception("Exception in Save", ex);
            }
            finally
            {
                CustomSqlHelper.CloseConnection(connection, isTransactionCoordinator);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Select all values from Title.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <returns>Object of type Title.</returns>
        public CustomGenericList <Title> TitleSelectAllPublished(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleSelectAll", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("IsPublished", SqlDbType.Bit, 1, false, true)))
            {
                using (CustomSqlHelper <Title> helper = new CustomSqlHelper <Title>())
                {
                    CustomGenericList <Title> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #25
0
        public static CustomGenericList <Title_TitleType> SelectByTitle(SqlConnection sqlConnection,
                                                                        SqlTransaction sqlTransaction, int titleId)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("Title_TitleTypeSelectByTitle", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, false, titleId)))
            {
                using (CustomSqlHelper <Title_TitleType> helper = new CustomSqlHelper <Title_TitleType>())
                {
                    CustomGenericList <Title_TitleType> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #26
0
        public CustomGenericList <PageName> PageNameSelectByConfirmedName(SqlConnection sqlConnection,
                                                                          SqlTransaction sqlTransaction, string name, string languageCode)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameSelectByConfirmedName", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("NameConfirmed", SqlDbType.NVarChar, 100, false, name),
                                                                      CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode)))
            {
                using (CustomSqlHelper <PageName> helper = new CustomSqlHelper <PageName>())
                {
                    return(helper.ExecuteReader(command));
                }
            }
        }
Beispiel #27
0
        // This does not filter on item status
        public static CustomGenericList <Item> ItemSelectByMarcBibId(SqlConnection sqlConnection, SqlTransaction sqlTransaction,
                                                                     string marcBibId)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("ItemSelectByMARCBibID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("MARCBibID", SqlDbType.NVarChar, 50, false, marcBibId)))
            {
                using (CustomSqlHelper <Item> helper = new CustomSqlHelper <Item>())
                {
                    CustomGenericList <Item> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }
Beispiel #28
0
        public CustomGenericList <CustomDataRow> TitleTagSelectCountByInstitution(SqlConnection sqlConnection,
                                                                                  SqlTransaction sqlTransaction, int numberToReturn, string institutionCode, string languageCode)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("TitleTagSelectCountByInstitution", connection,
                                                                      transaction,
                                                                      CustomSqlHelper.CreateInputParameter("Number", SqlDbType.Int, null, false, numberToReturn),
                                                                      CustomSqlHelper.CreateInputParameter("InstitutionCode", SqlDbType.NVarChar, 10, false, institutionCode),
                                                                      CustomSqlHelper.CreateInputParameter("LanguageCode", SqlDbType.NVarChar, 10, false, languageCode)))
            {
                CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command);
                return(list);
            }
        }
Beispiel #29
0
        public CustomGenericList <OpenUrlCitation> OpenUrlCitationSelectByTitleIdentifier(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string identifierName,
            string identifierValue)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("OpenUrlCitationSelectByTitleIdentifier", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("IdentifierName", SqlDbType.NVarChar, 40, true, identifierName),
                                                                      CustomSqlHelper.CreateInputParameter("IdentifierValue", SqlDbType.NVarChar, 125, true, identifierValue)))
            {
                CustomGenericList <CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows(command);
                return(this.GetOpenUrlCitationList(list));
            }
        }
Beispiel #30
0
        public CustomGenericList <PageSummaryView> PageSummarySelectFoldersForTitleID(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int titleID)
        {
            SqlConnection  connection  = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageSummarySelectFoldersForTitleID", connection, transaction,
                                                                      CustomSqlHelper.CreateInputParameter("TitleID", SqlDbType.Int, null, false, titleID)))
            {
                using (CustomSqlHelper <PageSummaryView> helper = new CustomSqlHelper <PageSummaryView>())
                {
                    CustomGenericList <PageSummaryView> list = helper.ExecuteReader(command);
                    return(list);
                }
            }
        }