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

C# SqlTransaction类代码示例

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

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



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

示例1: BatchInsert

        /// <summary>
        /// 批量插入订单商品促销信息
        /// </summary>
        /// <param name="productPromotes">促销信息列表</param>
        /// <param name="transaction">数据库事务</param>
        /// <returns>插入的记录数</returns>
        public int BatchInsert(List<Order_Product_Promote> productPromotes, SqlTransaction transaction)
        {
            if (productPromotes != null && productPromotes.Count > 0)
            {
                var dt = this.BuildDataTable(productPromotes);

                var paramsList = new List<SqlParameter>
                                     {
                                         new SqlParameter("OPP", SqlDbType.Structured)
                                             {
                                                 TypeName =
                                                     "[dbo].OrderProductPromoteTable",
                                                 Value = dt,
                                                 Direction =
                                                     ParameterDirection
                                                     .Input
                                             },
                                         this.SqlServer.CreateSqlParameter(
                                             "Count",
                                             SqlDbType.Int,
                                             null,
                                             ParameterDirection.Output)
                                     };

                this.SqlServer.ExecuteNonQuery(
                    CommandType.StoredProcedure,
                    "sp_Order_Product_Promote_BatchInsert",
                    paramsList,
                    transaction);

                return (int)paramsList.Find(parameter => parameter.ParameterName == "Count").Value;
            }
            throw new NotImplementedException();
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:40,代码来源:OrderProductPromoteDA.cs


示例2: DeleteByID

        /// <summary>
        /// 删除指定角色编号的角色权限关系
        /// </summary>
        /// <param name="roleID">
        /// 角色编号
        /// </param>
        /// <param name="transaction">
        /// 事务对象
        /// </param>
        public void DeleteByID(int roleID, out SqlTransaction transaction)
        {
            if (roleID <= 0)
            {
                throw new ArgumentNullException("roleID");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "RoleID",
                                         SqlDbType.Int,
                                         roleID,
                                         ParameterDirection.Input)
                                 };

            try
            {
                this.SqlServer.BeginTransaction();
                transaction = this.SqlServer.Transaction;

                this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_System_Role_Permission_DeleteRow", parameters, transaction);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message, exception);
            }
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:37,代码来源:SystemRolePermissionDA.cs


示例3: Insert

        /// <summary>
        /// 添加满额优惠活动范围.
        /// </summary>
        /// <param name="promoteMeetMoneyScope">
        /// Promote_MeetMoney_Scope 的对象实例.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        /// <returns>
        /// 满额优惠活动范围编号.
        /// </returns>
        public int Insert(Promote_MeetMoney_Scope promoteMeetMoneyScope, SqlTransaction transaction)
        {
            if (promoteMeetMoneyScope == null)
            {
                throw new ArgumentNullException("promoteMeetMoneyScope");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetMoneyID",
                                         SqlDbType.Int,
                                         promoteMeetMoneyScope.MeetMoneyID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Scope",
                                         SqlDbType.VarChar,
                                         promoteMeetMoneyScope.Scope,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Promote_MeetMoney_Scope_Insert",
                parameters,
                null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:45,代码来源:PromoteMeetMoneyScopeDA.cs


示例4: PrepareCommand

        private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] parms)
        {
            if (connection.State != ConnectionState.Open) connection.Open();

            command.Connection = connection;
            command.CommandTimeout = CommandTimeOut;
            // 设置命令文本(存储过程名或SQL语句)
            command.CommandText = commandText;
            // 分配事务
            if (transaction != null)
            {
                command.Transaction = transaction;
            }
            // 设置命令类型.
            command.CommandType = commandType;
            if (parms != null && parms.Length > 0)
            {
                //预处理SqlParameter参数数组,将为NULL的参数赋值为DBNull.Value;
                foreach (SqlParameter parameter in parms)
                {
                    if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) && (parameter.Value == null))
                    {
                        parameter.Value = DBNull.Value;
                    }
                }
                command.Parameters.AddRange(parms);
            }
        }
开发者ID:pcstx,项目名称:DBHelper,代码行数:28,代码来源:SqlHelper2.cs


示例5: Insert

        /// <summary>
        /// 插入订单商品促销信息
        /// </summary>
        /// <param name="orderProductPromote">插入的对象</param>
        /// <param name="transaction">数据库事务</param>
        /// <returns>返回新增的数据编码</returns>
        public int Insert(Order_Product_Promote orderProductPromote, SqlTransaction transaction)
        {
            /*
             [OrderID]
              ,[OrderProductID]
              ,[PromoteType]
              ,[PromoteID]
              ,[Remark]
              ,[ExtField]
              ,[CreateTime]
             */
            var paras = new List<SqlParameter>
                            {
                                this.SqlServer.CreateSqlParameter(
                                    "OrderID",
                                    SqlDbType.Int,
                                    orderProductPromote.OrderID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "OrderProductID",
                                    SqlDbType.Int,
                                    orderProductPromote.OrderProductID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "PromoteType",
                                    SqlDbType.Int,
                                    orderProductPromote.PromoteType,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "PromoteID",
                                    SqlDbType.Int,
                                    orderProductPromote.PromoteID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "Remark",
                                    SqlDbType.NVarChar,
                                    orderProductPromote.Remark,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ExtField",
                                    SqlDbType.NVarChar,
                                    orderProductPromote.ExtField,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Order_Product_Promote_Insert", paras, transaction);

            return (int)paras.Find(p => p.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:65,代码来源:OrderProductPromoteDA.cs


示例6: Insert

        /// <summary>
        /// 插入一条订单状态跟踪信息
        /// </summary>
        /// <param name="orderStatusTracking">
        /// 订单状态跟踪对象
        /// </param>
        /// <param name="transaction">
        /// 数据库事务对象
        /// </param>
        /// <returns>
        /// 新增的记录编码
        /// </returns>
        public int Insert(Order_Status_Tracking orderStatusTracking, SqlTransaction transaction)
        {
            var paras = new List<SqlParameter>
                            {
                                this.SqlServer.CreateSqlParameter(
                                    "EmployeeID",
                                    SqlDbType.Int,
                                    orderStatusTracking.EmployeeID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "UserID",
                                    SqlDbType.Int,
                                    orderStatusTracking.UserID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "OrderID",
                                    SqlDbType.Int,
                                    orderStatusTracking.OrderID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "Remark",
                                    SqlDbType.NVarChar,
                                    orderStatusTracking.Remark,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ExpressNumber",
                                    SqlDbType.NVarChar,
                                    orderStatusTracking.ExpressNumber,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "MailNo",
                                    SqlDbType.NVarChar,
                                    orderStatusTracking.MailNo,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "Status",
                                    SqlDbType.Int,
                                    orderStatusTracking.Status,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Order_Status_Tracking_Insert",
                paras,
                transaction);
            return (int)paras.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:70,代码来源:OrderStatusTrackingDA.cs


示例7: Insert

        /// <summary>
        /// 插入一条CPS记录
        /// </summary>
        /// <param name="linkRecord">记录对象</param>
        /// <param name="transaction"></param>
        /// <returns>新增的ID</returns>
        public int Insert(Cps_LinkRecord linkRecord, SqlTransaction transaction)
        {
            //Create Procedure sp_Cps_LinkRecord_Insert
            //    @CpsID int,
            //    @URL nvarchar(1024),
            //    @TargetURL nvarchar(4000),
            //    @CreateTime datetime,
            //    @IsDelete int=default,
            //    @ExtField nvarchar(50)=default,
            //    @ReferenceID int output
            //As

            var paras = new List<SqlParameter>
                            {
                                this.sqlServer.CreateSqlParameter(
                                    "CpsID",
                                    SqlDbType.Int,
                                    linkRecord.CpsID,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "URL",
                                    SqlDbType.NVarChar,
                                    linkRecord.URL,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "TargetURL",
                                    SqlDbType.NVarChar,
                                    linkRecord.TargetURL,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "IsDelete",
                                    SqlDbType.Int,
                                    0,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "ExtField",
                                    SqlDbType.NVarChar,
                                    linkRecord.ExtField,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.sqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Cps_LinkRecord_Insert", paras, transaction);

            return (int)paras.Find(p => p.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:61,代码来源:CpsLinkRecordDA.cs


示例8: Insert

        /// <summary>
        /// 新增一条订单状态日志
        /// </summary>
        /// <param name="orderStatusLog">
        /// 订单状态日志
        /// </param>
        /// <param name="transaction">
        /// 数据库事务对象
        /// </param>
        /// <returns>
        /// 新增的订单状态日子编码
        /// </returns>
        public int Insert(Order_Status_Log orderStatusLog, SqlTransaction transaction)
        {
            /*
             Create Procedure sp_Order_Status_Log_Insert
                @OrderID int,
                @EmployeeID int,
                @Status int,
                @Remark nvarchar(512),
                @CreateTime datetime,
                @ReferenceID int output
            As
             */
            var paras = new List<SqlParameter>
                            {
                                this.SqlServer.CreateSqlParameter(
                                    "OrderID",
                                    SqlDbType.Int,
                                    orderStatusLog.OrderID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "EmployeeID",
                                    SqlDbType.Int,
                                    orderStatusLog.EmployeeID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "Status",
                                    SqlDbType.Int,
                                    orderStatusLog.Status,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "Remark",
                                    SqlDbType.NVarChar,
                                    orderStatusLog.Remark,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Order_Status_Log_Insert", paras, transaction);
            return (int)paras.Find(e => e.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:61,代码来源:OrderStatusLogDA.cs


示例9: InertHwUpdateLog

        /// <summary>
        /// 写入HWERP 回写日志信息
        /// </summary>
        /// <param name="log"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public int InertHwUpdateLog(Hw_Log log, SqlTransaction transaction)
        {
            /*@Number nvarchar(50),
                @Content ntext,
                @State tinyint,
                @CreateTime datetime,
                @ExtField nvarchar(50),
             */

            var paras = new List<SqlParameter>
                            {
                                this.sqlServer.CreateSqlParameter(
                                    "Number",
                                    SqlDbType.VarChar,
                                    log.Number,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "Content",
                                    SqlDbType.NVarChar,
                                    log.Content,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "State",
                                    SqlDbType.Int,
                                    log.State,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "ExtField",
                                    SqlDbType.NVarChar,
                                    log.ExtField,
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now.ToLocalTime(),
                                    ParameterDirection.Input),
                                this.sqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.sqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_hw_Log_Insert", paras, transaction);

            return (int)paras.Find(p => p.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:53,代码来源:OrderErpLogDA.cs


示例10: DeleteByMeetAmountID

        /// <summary>
        /// 删除指定的促销规则.
        /// </summary>
        /// <param name="meetAmountID">
        /// 满件优惠活动促销规则编号.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        public void DeleteByMeetAmountID(int meetAmountID, SqlTransaction transaction)
        {
            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "PromoteMeetAmountID",
                                         SqlDbType.Int,
                                         meetAmountID,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Promote_MeetAmount_Rule_Brand_Delete",
                parameters,
                transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:26,代码来源:PromoteMeetAmountRuleBrandDA.cs


示例11: DeleteByRuleID

        /// <summary>
        /// 删除满足条件减现金促销规则.
        /// </summary>
        /// <param name="ruleID">
        /// 满就送活动规则编号.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        public void DeleteByRuleID(int ruleID, SqlTransaction transaction)
        {
            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetRuleID",
                                         SqlDbType.Int,
                                         ruleID,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Promote_Meet_DecreaseCash_Delete",
                parameters,
                transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:26,代码来源:PromoteMeetDecreaseCashDA.cs


示例12: Delete

        /// <summary>
        /// 删除指定的促销规则.
        /// </summary>
        /// <param name="id">
        /// 满件优惠活动促销规则编号.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        public void Delete(int id, SqlTransaction transaction)
        {
            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ID",
                                         SqlDbType.Int,
                                         id,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Promote_MeetAmount_Rule_Full_DeleteRow",
                parameters,
                transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:26,代码来源:PromoteMeetAmountRuleFullDA.cs


示例13: SqlInternalTransaction

        internal SqlInternalTransaction(SqlInternalConnection innerConnection, TransactionType type, SqlTransaction outerTransaction, long transactionId) {
            Bid.PoolerTrace("<sc.SqlInternalTransaction.ctor|RES|CPOOL> %d#, Created for connection %d#, outer transaction %d#, Type %d\n",
                        ObjectID,
                        innerConnection.ObjectID,
                        (null != outerTransaction) ? outerTransaction.ObjectID : -1,
                        (int)type);

            _innerConnection = innerConnection;
            _transactionType = type;

            if (null != outerTransaction) {
                _parent = new WeakReference(outerTransaction);
            }

            _transactionId = transactionId;
            RestoreBrokenConnection = false;
            ConnectionHasBeenRestored = false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:sqlinternaltransaction.cs


示例14: Insert

        /// <summary>
        /// 新增订单发票
        /// </summary>
        /// <param name="orderInvoice">
        /// 订单发票
        /// </param>
        /// <param name="transaction">
        /// 事务对象
        /// </param>
        /// <returns>
        /// 新增的订单编码
        /// </returns>
        public int Insert(Order_Invoice orderInvoice, SqlTransaction transaction)
        {
            var paras = new List<SqlParameter>
                            {
                                this.SqlServer.CreateSqlParameter(
                                    "OrderID",
                                    SqlDbType.Int,
                                    orderInvoice.OrderID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "InvoiceTypeID",
                                    SqlDbType.Int,
                                    orderInvoice.InvoiceTypeID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "InvoiceContentID",
                                    SqlDbType.Int,
                                    orderInvoice.InvoiceContentID,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "InvoiceTitle",
                                    SqlDbType.NVarChar,
                                    orderInvoice.InvoiceTitle,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "InvoiceCost",
                                    SqlDbType.Float,
                                    orderInvoice.InvoiceCost,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "CreateTime",
                                    SqlDbType.DateTime,
                                    DateTime.Now,
                                    ParameterDirection.Input),
                                this.SqlServer.CreateSqlParameter(
                                    "ReferenceID",
                                    SqlDbType.Int,
                                    null,
                                    ParameterDirection.Output)
                            };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Order_Invoice_Insert", paras, transaction);
            return (int)paras.Find(e => e.ParameterName == "ReferenceID").Value;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:56,代码来源:OrderInvoiceDA.cs


示例15: Delete

        /// <summary>
        /// 删除会员促销活动.
        /// </summary>
        /// <param name="id">
        /// 活动编号.
        /// </param>
        /// <param name="transaction">
        /// 数据库事务.
        /// </param>
        public void Delete(int id, out SqlTransaction transaction)
        {
            if (id <= 0)
            {
                throw new ArgumentNullException("id");
            }

            this.SqlServer.BeginTransaction(IsolationLevel.ReadCommitted);
            transaction = this.SqlServer.Transaction;
            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ID",
                                         SqlDbType.Int,
                                         id,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Promote_Vip_DeleteRow", parameters, transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:29,代码来源:PromoteVipDA.cs


示例16: BatchInsertOrderProduct

        /// <summary>
        /// 批量添加订单商品
        /// </summary>
        /// <param name="orderProducts">
        /// 订单商品列表
        /// </param>
        /// <param name="orderId">
        /// The order Id.
        /// </param>
        /// <param name="transaction">
        /// 事务对象
        /// </param>
        /// <returns>
        /// 成功添加的订单商品记录数量
        /// </returns>
        public int BatchInsertOrderProduct(List<Order_Product> orderProducts, int cpsId, int orderId, SqlTransaction transaction)
        {
            if (orderProducts != null && orderProducts.Count > 0)
            {
                var dt = this.BuildOrderProductDataTable(orderProducts, orderId);

                var paramsList = new List<SqlParameter>
                                     {
                                         this.SqlServer.CreateSqlParameter(
                                             "CpsId",
                                             SqlDbType.Int,
                                             cpsId,
                                             ParameterDirection.Input),
                                         new SqlParameter("OP", SqlDbType.Structured)
                                             {
                                                 TypeName =
                                                     "[dbo].OrderProductTable",
                                                 Value = dt,
                                                 Direction =
                                                     ParameterDirection
                                                     .Input
                                             },
                                         this.SqlServer.CreateSqlParameter(
                                             "RowCount",
                                             SqlDbType.Int,
                                             null,
                                             ParameterDirection.Output)
                                     };

                this.SqlServer.ExecuteNonQuery(
                    CommandType.StoredProcedure,
                    "sp_Order_Product_BatchInsert",
                    paramsList,
                    transaction);

                return (int)paramsList.Find(parameter => parameter.ParameterName == "RowCount").Value;
            }

            return 0;
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:55,代码来源:OrderProductDA.cs


示例17: Delete

        /// <summary>
        /// 删除指定活动商品.
        /// </summary>
        /// <param name="id">
        /// 活动商品编号.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        public void Delete(int id, SqlTransaction transaction)
        {
            if (id <= 0)
            {
                throw new ArgumentNullException("id");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "PromoteVipID",
                                         SqlDbType.Int,
                                         id,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Promote_Vip_Scope_Delete",
                parameters,
                transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:31,代码来源:PromoteVipScopeDA.cs


示例18: Delete

        /// <summary>
        /// The delete.
        /// </summary>
        /// <param name="productID">
        /// The product id.
        /// </param>
        /// <param name="transaction">
        /// The transaction.
        /// </param>
        public void Delete(int productID, SqlTransaction transaction)
        {
            if (productID <= 0)
            {
                throw new ArgumentNullException("productID");
            }

            if (transaction == null)
            {
                throw new ArgumentNullException("transaction");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ProductID",
                                         SqlDbType.Int,
                                         productID,
                                         ParameterDirection.Input)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_AttributeValueSet_DeleteByProductID", parameters, transaction);
        }
开发者ID:jxzly229190,项目名称:OnlineStore,代码行数:32,代码来源:ProductAttributeValueSetDA.cs


示例19: buildSelectSessionsAdapter

        /// <summary>
        /// Build SQL adapter for selecting all MDWS sessions saved to database that where started between a given date range
        /// </summary>
        /// <param name="start">Start date</param>
        /// <param name="end">End date</param>
        /// <param name="conn">SQL Connection</param>
        /// <param name="tx">SQL Transaction</param>
        /// <returns>SQL adapter</returns>
        SqlDataAdapter buildSelectSessionsAdapter(DateTime start, DateTime end, SqlConnection conn, SqlTransaction tx)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.SelectCommand = new SqlCommand();
            adapter.SelectCommand.Connection = conn;
            adapter.SelectCommand.Transaction = tx;
            adapter.SelectCommand.CommandText = "SELECT " +
                "MDWS.dbo.MdwsSessions.[ASP.NET_SessionId], " +
                "MDWS.dbo.MdwsSessions.IP, " +
                "MDWS.dbo.MdwsSessions.Start, " +
                "MDWS.dbo.MdwsSessions.[End], " +
                "MDWS.dbo.MdwsSessions.LocalhostName, " +
                "MDWS.dbo.MdwsSessionRequests.URI, " +
                "MDWS.dbo.MdwsSessionRequests.RequestTimestamp, " +
                "MDWS.dbo.MdwsSessionRequests.ResponseTimestamp, " +
                "MDWS.dbo.MdwsSessionRequests.RequestBody, " +
                "MDWS.dbo.MdwsSessionRequests.ResponseBody " +
                "FROM MDWS.dbo.MdwsSessio 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SqlType类代码示例发布时间:2022-05-24
下一篇:
C# SqlTable类代码示例发布时间: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