/// <summary> /// 插入订单商品促销信息 /// </summary> /// <param name="orderProductPromote">插入的对象</param> /// <param name="transaction">数据库事务</param> /// <returns>返回新增的数据编码</returns> public int Insert(Order_Product_Promote orderProductPromote, SqlTransaction transaction) { /* [OrderID] ,[OrderProductID] ,[PromoteType] ,[PromoteID] ,[Remark] ,[ExtField] ,[CreateTime] */ var paras = new List<SqlParameter> { this.SqlServer.CreateSqlParameter( "OrderID", SqlDbType.Int, orderProductPromote.OrderID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "OrderProductID", SqlDbType.Int, orderProductPromote.OrderProductID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "PromoteType", SqlDbType.Int, orderProductPromote.PromoteType, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "PromoteID", SqlDbType.Int, orderProductPromote.PromoteID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "Remark", SqlDbType.NVarChar, orderProductPromote.Remark, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ExtField", SqlDbType.NVarChar, orderProductPromote.ExtField, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "CreateTime", SqlDbType.DateTime, DateTime.Now, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ReferenceID", SqlDbType.Int, null, ParameterDirection.Output) }; this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Order_Product_Promote_Insert", paras, transaction); return (int)paras.Find(p => p.ParameterName == "ReferenceID").Value; }
public int Add(Order_Product_Promote model, SqlTransaction transaction=null) { if (model == null) { LogUtils.Log("新增订单商品促销实体时实体参数为空", "服务层", Category.Warn); return 0; } return this.productPromoteDa.Insert(model, transaction); }