Exemplo n.º 1
0
        /// <summary>
        /// 添加现金券信息.
        /// </summary>
        /// <param name="couponCash">
        /// 现金券Coupon_Cash的对象实例.
        /// </param>
        /// <returns>
        /// 现金券的编号.
        /// </returns>
        public int InsertCoupon_Cash(Coupon_Cash couponCash)
        {
            if (couponCash == null)
            {
                throw new ArgumentNullException("couponCash");
            }

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

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Coupon_Cash_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 添加现金券信息.
 /// </summary>
 /// <param name="couponCash">
 /// 现金券Coupon_Cash的对象实例.
 /// </param>
 /// <returns>
 /// 现金券的编号.
 /// </returns>
 public int Add(Coupon_Cash couponCash)
 {
     return this.couponCashDA.InsertCoupon_Cash(couponCash);
 }