Example #1
0
        /// <summary>
        /// 添加电子券使用范围.
        /// </summary>
        /// <param name="couponScope">
        /// Coupon_Scope的对象实例.
        /// </param>
        /// <returns>
        ///  电子券使用范围编号.
        /// </returns>
        public int Inseret(Coupon_Scope couponScope)
        {
            if (couponScope == null)
            {
                throw new ArgumentNullException("couponScope");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "CouponID",
                                         SqlDbType.Int,
                                         couponScope.CouponID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "CouponTypeID",
                                         SqlDbType.Int,
                                         couponScope.CouponTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ScopeType",
                                         SqlDbType.Int,
                                         couponScope.ScopeType,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "TargetTypeID",
                                         SqlDbType.Int,
                                         couponScope.TargetTypeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "CreateTime",
                                         SqlDbType.DateTime,
                                         couponScope.CreateTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Coupon_Scope_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// 添加电子券使用范围.
 /// </summary>
 /// <param name="couponScope">
 /// Coupon_Scope的对象实例.
 /// </param>
 /// <returns>
 ///  电子券使用范围编号.
 /// </returns>
 public int Add(Coupon_Scope couponScope)
 {
     return this.couponScopeDA.Inseret(couponScope);
 }