• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CustomSqlHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CustomSqlHelper的典型用法代码示例。如果您正苦于以下问题:C# CustomSqlHelper类的具体用法?C# CustomSqlHelper怎么用?C# CustomSqlHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CustomSqlHelper类属于命名空间,在下文中一共展示了CustomSqlHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InstitutionSelectByItemID

        public Institution InstitutionSelectByItemID(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            int itemID)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "InstitutionSelectByItemID", connection, transaction,
                    CustomSqlHelper.CreateInputParameter( "ItemID", SqlDbType.Int, null, false, itemID ) ) )
            {
                using ( CustomSqlHelper<Institution> helper = new CustomSqlHelper<Institution>() )
                {
                    CustomGenericList<Institution> list = helper.ExecuteReader( command );
                    if ( list.Count > 0 )
                    {
                        Institution o = list[ 0 ];
                        list = null;
                        return o;
                    }
                    else
                    {
                        return null;
                    }
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:27,代码来源:InstitutionDAL.cs


示例2: PageNameCountUniqueConfirmed

        public static int PageNameCountUniqueConfirmed(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection connection = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

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

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameCountUniqueConfirmed", connection, transaction))
            {
                using (CustomSqlHelper<int> helper = new CustomSqlHelper<int>())
                {
                    CustomGenericList<int> list = helper.ExecuteReader(command);

                    if (list.Count == 0)
                    {
                        return default(int);
                    }
                    else
                    {
                        return list[0];
                    }
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:27,代码来源:NameDAL.cs


示例3: PageNameCountUniqueConfirmedBetweenDates

        public static int PageNameCountUniqueConfirmedBetweenDates(SqlConnection sqlConnection, SqlTransaction sqlTransaction, 
            DateTime startDate, DateTime endDate)
        {
            SqlConnection connection = sqlConnection;
            SqlTransaction transaction = sqlTransaction;

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

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PageNameCountUniqueConfirmedBetweenDates", connection, transaction,
                CustomSqlHelper.CreateInputParameter("StartDate", SqlDbType.DateTime, null, false, startDate),
                CustomSqlHelper.CreateInputParameter("EndDate", SqlDbType.DateTime, null, false, endDate)))
            {
                using (CustomSqlHelper<int> helper = new CustomSqlHelper<int>())
                {
                    CustomGenericList<int> list = helper.ExecuteReader(command);

                    if (list.Count == 0)
                    {
                        return default(int);
                    }
                    else
                    {
                        return list[0];
                    }
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:30,代码来源:NameDAL.cs


示例4: PageTitleSummarySelectByBibId

        /// <summary>
        /// Select values from PageTitleSummaryView by MARC Bib Id.
        /// </summary>
        /// <param name="sqlConnection">Sql connection or null.</param>
        /// <param name="sqlTransaction">Sql transaction or null.</param>
        /// <param name="bibID"></param>
        /// <returns>Object of type Title.</returns>
        public PageSummaryView PageTitleSummarySelectByBibId(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string bibID)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
              SqlTransaction transaction = sqlTransaction;

              using ( SqlCommand command = CustomSqlHelper.CreateCommand( "PageTitleSummarySelectByBibId", connection, transaction,
              CustomSqlHelper.CreateInputParameter( "BibID", SqlDbType.VarChar, 50, false, bibID ) ) )
              {
              using (CustomSqlHelper<PageSummaryView> helper = new CustomSqlHelper<PageSummaryView>())
            {
            CustomGenericList<PageSummaryView> list = helper.ExecuteReader(command);
              if ( list.Count > 0 )
              {
            return list[ 0 ];
              }
              else
              {
            return null;
              }
            }
              }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:32,代码来源:PageTitleSummaryDAL.cs


示例5: ItemSelectByBarCodeOrItemID

        public static Item ItemSelectByBarCodeOrItemID( SqlConnection sqlConnection, SqlTransaction sqlTransaction,
            int? itemId, string barCode)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "ItemSelectByBarCodeOrItemID", connection, transaction,
                CustomSqlHelper.CreateInputParameter( "ItemID", SqlDbType.Int, null, true, itemId ),
                CustomSqlHelper.CreateInputParameter( "BarCode", SqlDbType.NVarChar, 40, true, barCode ) ) )
            {
                using ( CustomSqlHelper<Item> helper = new CustomSqlHelper<Item>() )
                {
                    CustomGenericList<Item> list = helper.ExecuteReader( command );
                    if ( list.Count > 0 )
                    {
                        Item item = (Item)list[ 0 ];
                        item.Pages = new PageDAL().PageSelectByItemID( connection, transaction, item.ItemID );
                        //item.Titles = new TitleDAL().TitleSelectByItem(connection, transaction, item.ItemID);
                        item.TitleItems = new TitleItemDAL().TitleItemSelectByItem(connection, transaction, item.ItemID);
                        item.ItemLanguages = new ItemLanguageDAL().ItemLanguageSelectByItemID(connection, transaction, item.ItemID);
                        return item;
                    }
                    else
                    {
                        return null;
                    }
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:30,代码来源:ItemDAL.cs


示例6: CreatorSelectByCreatorName

        public Creator CreatorSelectByCreatorName(
            SqlConnection sqlConnection,
            SqlTransaction sqlTransaction,
            string creatorName)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
              SqlTransaction transaction = sqlTransaction;

              using ( SqlCommand command = CustomSqlHelper.CreateCommand( "CreatorSelectByCreatorName", connection, transaction,
              CustomSqlHelper.CreateInputParameter( "CreatorName", SqlDbType.NVarChar, 255, false, creatorName ) ) )
              {
            using ( CustomSqlHelper<Creator> helper = new CustomSqlHelper<Creator>() )
            {
              CustomGenericList<Creator> list = helper.ExecuteReader( command );
              if ( list.Count > 0 )
              {
            return list[ 0 ];
              }
              else
              {
            return null;
              }
            }
              }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:25,代码来源:CreatorDAL.cs


示例7: SelectAll

 public static CustomGenericList<ItemStatus> SelectAll( SqlConnection sqlConnection, SqlTransaction sqlTransaction )
 {
     SqlConnection connection = CustomSqlHelper.CreateConnection(
         CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
     SqlTransaction transaction = sqlTransaction;
     using ( SqlCommand command = CustomSqlHelper.CreateCommand( "ItemStatusSelectAll", connection, transaction ) )
     {
         using ( CustomSqlHelper<ItemStatus> helper = new CustomSqlHelper<ItemStatus>() )
         {
             CustomGenericList<ItemStatus> list = helper.ExecuteReader( command );
             return ( list );
         }
     }
 }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:14,代码来源:ItemStatusDAL.cs


示例8: LocationSelectAllValid

        public CustomGenericList<Location> LocationSelectAllValid(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("LocationSelectAllValid", connection, transaction))
            {
                using (CustomSqlHelper<Location> helper = new CustomSqlHelper<Location>())
                {
                    CustomGenericList<Location> list = helper.ExecuteReader(command);
                    return (list);
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:14,代码来源:LocationDAL.cs


示例9: MonthlyStatsSelectCurrentYearSummary

        public CustomGenericList<MonthlyStats> MonthlyStatsSelectCurrentYearSummary(SqlConnection sqlConnection, SqlTransaction sqlTransaction)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MonthlyStatsSelectCurrentYearSummary", connection, transaction))
            {
                using (CustomSqlHelper<MonthlyStats> helper = new CustomSqlHelper<MonthlyStats>())
                {
                    CustomGenericList<MonthlyStats> list = helper.ExecuteReader(command);
                    return (list);
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:14,代码来源:MonthlyStatsDAL.cs


示例10: LanguageSelectWithPublishedItems

 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);
         }
     }
 }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:15,代码来源:LanguageDAL.cs


示例11: PDFPageSummaryViewSelectByPdfID

        public CustomGenericList<PageSummaryView> PDFPageSummaryViewSelectByPdfID(SqlConnection sqlConnection, SqlTransaction sqlTransaction,
            int PdfId)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("PDFPageSummaryViewSelectByPdfId", connection, transaction,
                CustomSqlHelper.CreateInputParameter("PdfID", SqlDbType.Int, null, false, PdfId)))
            {
                using (CustomSqlHelper<PageSummaryView> helper = new CustomSqlHelper<PageSummaryView>())
                {
                    CustomGenericList<PageSummaryView> list = helper.ExecuteReader(command);
                    return list;
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:16,代码来源:PDFPageDAL.cs


示例12: PageNameSelectTop

        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 );
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:16,代码来源:PageNameDAL.cs


示例13: CreatorRoleTypeSelectAll

        public static CustomGenericList<CreatorRoleType> CreatorRoleTypeSelectAll( SqlConnection sqlConnection, 
            SqlTransaction sqlTransaction)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "CreatorRoleTypeSelectAll", connection, transaction ) )
            {
                using ( CustomSqlHelper<CreatorRoleType> helper = new CustomSqlHelper<CreatorRoleType>() )
                {
                    CustomGenericList<CreatorRoleType> list = helper.ExecuteReader( command );
                    return list;
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:16,代码来源:CreatorRoleTypeDAL.cs


示例14: LocationSelectValidByInstitution

        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);
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:16,代码来源:LocationDAL.cs


示例15: ItemLanguageSelectByItemID

        public CustomGenericList<ItemLanguage> ItemLanguageSelectByItemID(SqlConnection sqlConnection,
            SqlTransaction sqlTransaction, int itemId)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("ItemLanguageSelectByItemID", connection, transaction,
                            CustomSqlHelper.CreateInputParameter("ItemID", SqlDbType.Int, null, false, itemId)))
            {
                using (CustomSqlHelper<ItemLanguage> helper = new CustomSqlHelper<ItemLanguage>())
                {
                    CustomGenericList<ItemLanguage> list = helper.ExecuteReader(command);
                    return list;
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:17,代码来源:ItemLanguageDAL.cs


示例16: Title_CreatorSelectByTitle

        public static CustomGenericList<Title_Creator> Title_CreatorSelectByTitle( SqlConnection sqlConnection,
            SqlTransaction sqlTransaction, int titleID)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "Title_CreatorSelectByTitle", connection, transaction,
                    CustomSqlHelper.CreateInputParameter( "TitleID", SqlDbType.Int, null, false, titleID ) ) )
            {
                using ( CustomSqlHelper<Title_Creator> helper = new CustomSqlHelper<Title_Creator>() )
                {
                    CustomGenericList<Title_Creator> list = helper.ExecuteReader( command );
                    return list;
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:17,代码来源:Title_CreatorDAL.cs


示例17: ItemSelectByMarcBibId

        // 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 );
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:18,代码来源:ItemDAL.cs


示例18: MonthlyStatsSelectByStatType

        public CustomGenericList<MonthlyStats> MonthlyStatsSelectByStatType(SqlConnection sqlConnection, SqlTransaction sqlTransaction, 
            string statType, string institutionName, bool showMonthly)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(CustomSqlHelper.GetConnectionStringFromConnectionStrings("BHL"), sqlConnection);
            SqlTransaction transaction = sqlTransaction;

            using (SqlCommand command = CustomSqlHelper.CreateCommand("MonthlyStatsSelectByStatType", connection, transaction,
                CustomSqlHelper.CreateInputParameter("StatType", SqlDbType.NVarChar, 100, false, statType),
                CustomSqlHelper.CreateInputParameter("InstitutionName", SqlDbType.NVarChar, 255, false, institutionName),
                CustomSqlHelper.CreateInputParameter("ShowMonthly", SqlDbType.Bit, null, false, showMonthly)))
            {
                using (CustomSqlHelper<MonthlyStats> helper = new CustomSqlHelper<MonthlyStats>())
                {
                    CustomGenericList<MonthlyStats> list = helper.ExecuteReader(command);
                    return (list);
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:18,代码来源:MonthlyStatsDAL.cs


示例19: PageMetadataSelectByPageID

        public Page PageMetadataSelectByPageID( SqlConnection sqlConnection, SqlTransaction sqlTransaction, int pageID )
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "PageMetadataSelectByPageID", connection, transaction,
                    CustomSqlHelper.CreateInputParameter( "PageID", SqlDbType.Int, null, false, pageID ) ) )
            {
                using ( CustomSqlHelper<Page> helper = new CustomSqlHelper<Page>() )
                {
                    CustomGenericList<Page> list = helper.ExecuteReader( command );
                    if ( list.Count > 0 )
                        return list[ 0 ];
                    else
                        return null;
                }
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:18,代码来源:PageDAL.cs


示例20: Save

        public static void Save( SqlConnection sqlConnection, SqlTransaction sqlTransaction, Vault vault )
        {
            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 );

                if ( vault.VaultID == 0 )
                {
                    using ( SqlCommand command = CustomSqlHelper.CreateCommand( "VaultSelectMaxID", connection, transaction ) )
                    {
                        using ( CustomSqlHelper<int> helper = new CustomSqlHelper<int>() )
                        {
                            CustomGenericList<int> list = helper.ExecuteReader( command );
                            vault.VaultID = list[ 0 ] + 1;
                        }
                    }
                }

                new VaultDAL().VaultManageAuto( connection, transaction, vault );

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

                throw new Exception( "Exception in Save", ex );
            }
            finally
            {
                CustomSqlHelper.CloseConnection( connection, isTransactionCoordinator );
            }
        }
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:44,代码来源:VaultDAL.cs



注:本文中的CustomSqlHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CustomType类代码示例发布时间:2022-05-24
下一篇:
C# CustomNodeDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap