예제 #1
0
        public ActionResult cart(FormCollection collection)
        {
            string cosignee = yikuData.UserCurrent.Consignee;
            if (!string.IsNullOrEmpty(Request.Form["CurrentUser.Consignee"]))
                cosignee = Request.Form["CurrentUser.Consignee"];
            string Address = yikuData.UserCurrent.Address;
            if (!string.IsNullOrEmpty(Request.Form["CurrentUser.Consignee"]))
                cosignee = Request.Form["CurrentUser.Consignee"];

            CartModels cm = new CartModels();
            IQueryable<T_Shopping> TSHS = cm.TSHs;
            foreach (T_Shopping tsh in TSHS)
            {
                Order order = new Order();
                order.IID = tsh.IID;
                order.UID = cm.CurrentUser.UID;
                order.Count = tsh.Count;
                order.Cut = tsh.Cut;
                order.Time = DateTime.Now;
                order.Cost = tsh.Item.Price * tsh.Count;
                order.State = "pay";
                order.Address = Address;
                yikuData.Add(order);
                T_Shopping sss = yikuData.GetT_Shopping(tsh.T_Sh_ID);
                Item item = yikuData.GetItem(order.IID);
                item.Volume += order.Count;     //商品卖出量增加N份
                yikuData.Delete(sss);
            }
            yikuData.Save();
            return RedirectToAction("trade", "MyYiku");
        }
예제 #2
0
        public Order OrderCreate(User user, Item item, string Cut, int count = 1)
        {
            Order order = new Order();
            order.UID = user.UID;
            order.IID = item.IID;
            order.Count = count;
            order.Cut = Cut;
            order.Time = DateTime.Now;
            order.Cost = item.Price * count;
            order.State = "buy";
            Add(order);

            return order;
        }
예제 #3
0
 public bool OrderExist(Order order)
 {
     if (yikuData.Orders.SingleOrDefault(o => o == order) != null)
         return true;
     return false;
 }
예제 #4
0
 /// <summary>
 /// 创建新的 Order 对象。
 /// </summary>
 /// <param name="orID">OrID 属性的初始值。</param>
 /// <param name="uID">UID 属性的初始值。</param>
 /// <param name="iID">IID 属性的初始值。</param>
 /// <param name="count">Count 属性的初始值。</param>
 /// <param name="time">Time 属性的初始值。</param>
 /// <param name="cost">Cost 属性的初始值。</param>
 /// <param name="state">State 属性的初始值。</param>
 public static Order CreateOrder(global::System.Int32 orID, global::System.Int32 uID, global::System.Int32 iID, global::System.Int32 count, global::System.DateTime time, global::System.Decimal cost, global::System.String state)
 {
     Order order = new Order();
     order.OrID = orID;
     order.UID = uID;
     order.IID = iID;
     order.Count = count;
     order.Time = time;
     order.Cost = cost;
     order.State = state;
     return order;
 }
예제 #5
0
 /// <summary>
 /// 用于向 Orders EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToOrders(Order order)
 {
     base.AddObject("Orders", order);
 }