コード例 #1
0
        /// <summary>
        /// 修改满足条件打折促销规则.
        /// </summary>
        /// <param name="promoteMeetDiscount">
        /// Promote_Meet_Discount的对象.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        public void UpdateByRuleID(Promote_Meet_Discount promoteMeetDiscount, SqlTransaction transaction)
        {
            if (promoteMeetDiscount == null)
            {
                throw new ArgumentNullException("promoteMeetDiscount");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetRuleID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.MeetRuleID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetTypeID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.MeetTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ScopeTypeID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.ScopeTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Discount",
                                         SqlDbType.Float,
                                         promoteMeetDiscount.Discount,
                                         ParameterDirection.Input)
                                 };
            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Promote_Meet_Discount_Update", parameters, transaction);
        }
コード例 #2
0
        /// <summary>
        /// 添加满足条件打折促销规则.
        /// </summary>
        /// <param name="promoteMeetDiscount">
        /// Promote_Meet_Discount的对象.
        /// </param>
        /// <param name="transaction">
        /// 数据事务.
        /// </param>
        /// <returns>
        /// 满足条件打折促销规则编号.
        /// </returns>
        public int Insert(Promote_Meet_Discount promoteMeetDiscount, SqlTransaction transaction)
        {
            if (promoteMeetDiscount == null)
            {
                throw new ArgumentNullException("promoteMeetDiscount");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetRuleID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.MeetRuleID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetTypeID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.MeetTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ScopeTypeID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.ScopeTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Discount",
                                         SqlDbType.Float,
                                         promoteMeetDiscount.Discount,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         promoteMeetDiscount.ID,
                                         ParameterDirection.Output)
                                 };
            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Promote_Meet_Discount_Insert", parameters, transaction);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }