/// <summary>
 /// 添加现金券绑定
 /// </summary>
 /// <param name="couponID">
 /// 券ID
 /// </param>
 /// <param name="userID">
 /// 会员ID
 /// </param>
 /// <param name="cause">
 /// 描述
 /// </param>
 /// <param name="status">
 /// The status.
 /// </param>
 /// <param name="transaction">
 /// The transaction.
 /// </param>
 /// <returns>
 /// 绑定的编码
 /// </returns>
 public int Add(int orderId, int couponID, int userID, string cause, int status, SqlTransaction transaction)
 {
     var coupon = new Coupon_Cash_Binding
     {
         Cause = cause,
         CouponCashID = couponID,
         OrderID = orderId,
         Status = status,
         UserID = userID,
         Number = "M" + this.CreateRandomCode(8),
         Password = this.CreateRandomCode(6),
         BindingTime = DateTime.Now,
         UseTime = null
     };
     return this.Add(coupon, transaction);
 }
 /// <summary>
 /// 添加现金券绑定
 /// </summary>
 /// <param name="couponCashBinding">
 /// Coupon_Cash_Binding的对象实例
 /// </param>
 /// <param name="transaction">数据库事务,默认值为Null</param>
 /// <returns>
 /// 现金券绑定编号
 /// </returns>
 public int Add(Coupon_Cash_Binding couponCashBinding, SqlTransaction transaction = null)
 {
     return this.couponCashBindingDA.Insert(couponCashBinding, transaction);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加现金券绑定.
        /// </summary>
        /// <param name="couponCashBinding">
        /// Coupon_Cash_Binding的对象实例.
        /// </param>
        /// <param name="transaction">数据库事务,默认为Null</param>
        /// <returns>
        /// 现金券绑定的编号.
        /// </returns>
        public int Insert(Coupon_Cash_Binding couponCashBinding, SqlTransaction transaction = null)
        {
            if (couponCashBinding == null)
            {
                throw new ArgumentNullException("couponCashBinding");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "CouponCashID",
                                         SqlDbType.Int,
                                         couponCashBinding.CouponCashID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UserID",
                                         SqlDbType.Int,
                                         couponCashBinding.UserID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "OrderID",
                                         SqlDbType.Int,
                                         couponCashBinding.OrderID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Number",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Number,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Password",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Password,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Cause",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Cause,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Status",
                                         SqlDbType.Int,
                                         couponCashBinding.Status,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UseTime",
                                         SqlDbType.DateTime,
                                         couponCashBinding.UseTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BindingTime",
                                         SqlDbType.DateTime,
                                         couponCashBinding.BindingTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(
                CommandType.StoredProcedure,
                "sp_Coupon_Cash_Binding_Insert",
                parameters,
                transaction);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// 添加现金券绑定
 /// </summary>
 /// <param name="couponCashBinding">
 /// Coupon_Cash_Binding的对象实例
 /// </param>
 public void Modify(Coupon_Cash_Binding couponCashBinding)
 {
     this.couponCashBindingDA.Update(couponCashBinding);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加现金券绑定.
        /// </summary>
        /// <param name="couponCashBinding">
        /// Coupon_Cash_Binding的对象实例.
        /// </param>
        public void Update(Coupon_Cash_Binding couponCashBinding)
        {
            if (couponCashBinding == null)
            {
                throw new ArgumentNullException("couponCashBinding");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "CouponCashID",
                                         SqlDbType.Int,
                                         couponCashBinding.CouponCashID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UserID",
                                         SqlDbType.Int,
                                         couponCashBinding.UserID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "OrderID",
                                         SqlDbType.Int,
                                         couponCashBinding.OrderID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Number",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Number,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Password",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Password,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Cause",
                                         SqlDbType.VarChar,
                                         couponCashBinding.Cause,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Status",
                                         SqlDbType.Int,
                                         couponCashBinding.Status,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UseTime",
                                         SqlDbType.DateTime,
                                         couponCashBinding.UseTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BindingTime",
                                         SqlDbType.DateTime,
                                         couponCashBinding.BindingTime,
                                         ParameterDirection.Input),
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Coupon_Cash_Update", parameters, null);
        }