Exemplo n.º 1
0
        /// <summary>
        /// 添加满减券.
        /// </summary>
        /// <param name="couponDecrease">
        /// Coupon_Decrease的对象实例.
        /// </param>
        /// <returns>
        /// 满减券编号.
        /// </returns>
        public int InsertCouponDecrease(Coupon_Decrease couponDecrease)
        {
            if (couponDecrease == null)
            {
                throw new ArgumentNullException("couponDecrease");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "EmployeeID",
                                         SqlDbType.Int,
                                         couponDecrease.EmployeeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Name",
                                         SqlDbType.NVarChar,
                                         couponDecrease.Name,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "FaceValue",
                                         SqlDbType.Float,
                                         couponDecrease.FaceValue,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "MeetAmount",
                                         SqlDbType.Float,
                                         couponDecrease.MeetAmount,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "InitialNumber",
                                         SqlDbType.Int,
                                         couponDecrease.InitialNumber,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Description",
                                         SqlDbType.NVarChar,
                                         couponDecrease.Description,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "StartTime",
                                         SqlDbType.DateTime,
                                         couponDecrease.StartTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "EndTime",
                                         SqlDbType.DateTime,
                                         couponDecrease.EndTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "CreateTime",
                                         SqlDbType.DateTime,
                                         couponDecrease.CreateTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Coupon_Decrease_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// 添加满减券.
 /// </summary>
 /// <param name="couponDecrease">
 /// Coupon_Decrease的对象实例.
 /// </param>
 /// <returns>
 /// 满减券的编号.
 /// </returns>
 public int Add(Coupon_Decrease couponDecrease)
 {
     return this.couponDecreaseDA.InsertCouponDecrease(couponDecrease);
 }