1 回答

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個贊
謝謝大家,經(jīng)過大量努力,以下工作按預(yù)期為我工作
? ? public decimal? ShopDeal()
? ? ? ? {
? ? ? ? ? ? decimal? shopdeal = 0;
? ? ? ? ? ? var results = (from cartItems in db.Carts
? ? ? ? ? ? ? ? ? ? ? ? ? ?where cartItems.CartId == ShoppingCartId
? ? ? ? ? ? ? ? ? ? ? ? ? ?select new { cartItems.StoreId,cartItems.OrderLimit,cartItems.Duration,cartItems.ShopDiscount }).Distinct().ToList();
? ? ? ? ? ? ? ? //db.Carts.Select(m => new { m.StoreId, m.OrderLimit, m.ShopDiscount, m.Giftback, m.Duration }.where()).Distinct().ToList();
? ? ? ? ? ? foreach (var item in results)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? decimal? shoptotal = (from cartItems in db.Carts
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? where cartItems.CartId == ShoppingCartId
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? && cartItems.Item.StoreId == item.StoreId
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? select (decimal?)cartItems.Item.Price).Sum();
? ? ? ? ? ? ? ? if (shoptotal >= item.OrderLimit && item.Duration == "Started")
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? shopdeal = shopdeal + shoptotal * item.ShopDiscount / 100;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? return shopdeal;
? ? ? ? }
regards?
fiaz ahmed ranjha
- 1 回答
- 0 關(guān)注
- 116 瀏覽
添加回答
舉報(bào)