/// <summary> /// 添加购物车 /// </summary> /// <param name="orderId"></param> /// <param name="itemId"></param> /// <param name="count"></param> /// <returns></returns> public static void SetTradeList(int orderId, int itemId, int count) { if (count > 0 && itemId > 0 && orderId > 0) { ShopTradelist tradeListItem = new ShopTradelist(); tradeListItem.OrderId = orderId; tradeListItem.ItemId = itemId; tradeListItem.ItemCount = count; List<ShopTradelist> list = JaneShopGateway.JaneShopProvier.GetShopTradelistByOrderId(orderId); if (list != null && list.Count > 0) { foreach (ShopTradelist st in list) { if (st.ItemId == itemId) { tradeListItem.Id = st.Id; tradeListItem.ItemCount = st.ItemCount + count; break; } } } // tradeListItem.Id = JaneShopGateway.JaneShopProvier.SetShopTradelist(tradeListItem); } }
internal static ShopTradelist GetShopTradelist(int id) { ShopTradelist m = new ShopTradelist(id); if (id > 0) { SafeProcedure.ExecuteAndMapRecords( Database.GetDatabase(JaneDefine.DBInstanceName), "dbo.Shop_tradelist_Get", delegate(IRecord record) { m.Id = record.GetInt32OrDefault(0, 0); m.OrderId = record.GetInt32OrDefault(1, 0); m.ItemId = record.GetInt32OrDefault(2,0); m.ItemCount = record.GetInt32OrDefault(3,0); }, id); } return m; }
public int SetShopTradelist(ShopTradelist item) { return JaneShopTradelistDao.SetShopTradelist(item); }
internal static int SetShopTradelist(ShopTradelist item) { if (item == null) return -1; SafeProcedure.ExecuteNonQuery( Database.GetDatabase(JaneDefine.DBInstanceName), "dbo.Shop_tradelist_Set", delegate(IParameterSet parameters) { parameters.AddWithValue("@Id", item.Id); parameters.AddWithValue("@orderid", item.OrderId); parameters.AddWithValue("@itemid", item.ItemId); parameters.AddWithValue("@itemcount", item.ItemCount); parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue); }, delegate(IParameterSet outputParameters) { item.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal")); }); return item.Id; }
internal static void MapList(IRecord record, List<ShopTradelist> list) { ShopTradelist m = new ShopTradelist(); m.Id = record.GetInt32OrDefault(0, 0); m.OrderId = record.GetInt32OrDefault(1, 0); m.ItemId = record.GetInt32OrDefault(2, 0); m.ItemCount = record.GetInt32OrDefault(3, 0); list.Add(m); }