/// <summary>
 /// 添加
 /// </summary>
 /// <param name="groupBuy">
 /// 团购商品对象
 /// </param>
 /// <returns>
 /// T<see cref="int"/>
 /// 返回参数
 /// </returns>
 public int Insert(Channel_GroupBuy groupBuy)
 {
     return this.channelGroupBuyDA.Insert(groupBuy);
 }
예제 #2
0
        /// <summary>
        /// 添加团购活动
        /// </summary>
        /// <param name="groupBy">
        /// 团购活动对象
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// 返回数据
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// 参数为空异常
        /// </exception>
        /// <exception cref="Exception">
        /// 数据库操作异常
        /// </exception>
        public int Insert(Channel_GroupBuy groupBy)
        {
            if (groupBy == null)
            {
                throw new ArgumentNullException("groupBy");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this._sqlServer.CreateSqlParameter(
                                         "ProductID",
                                         SqlDbType.Int,
                                         groupBy.ProductID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "UserLevelID",
                                         SqlDbType.Int,
                                         groupBy.UserLevelID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Name",
                                         SqlDbType.NVarChar,
                                         groupBy.Name,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "GBPrice",
                                         SqlDbType.Decimal,
                                         groupBy.GBPrice,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "TotalNumber",
                                         SqlDbType.Int,
                                         groupBy.TotalNumber,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Introduce",
                                         SqlDbType.NText,
                                         groupBy.Introduce,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ShowLevel",
                                         SqlDbType.Int,
                                         groupBy.ShowLevel,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "StartTime",
                                         SqlDbType.DateTime,
                                         groupBy.StartTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "EndTime",
                                         SqlDbType.DateTime,
                                         groupBy.EndTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "IsShowTime",
                                         SqlDbType.Bit,
                                         groupBy.IsShowTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "IsOnlinePayment",
                                         SqlDbType.Bit,
                                         groupBy.IsOnlinePayment,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SoldOfReality",
                                         SqlDbType.Int,
                                         groupBy.SoldOfReality,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SoldOfVirtual",
                                         SqlDbType.Int,
                                         groupBy.SoldOfVirtual,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "PageView",
                                         SqlDbType.Int,
                                         groupBy.PageView,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Status",
                                         SqlDbType.Int,
                                         groupBy.Status,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "CreateTime",
                                         SqlDbType.DateTime,
                                         groupBy.CreateTime,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Channel_GroupBuy_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// 修改团购商品
 /// </summary>
 /// <param name="groupBuy">团购商品对象</param>
 /// <returns></returns>
 public int UpdateGroupBuyProductId(Channel_GroupBuy groupBuy)
 {
     return this.channelGroupBuyDA.Update(groupBuy);
 }