Beispiel #1
0
        public ActionResult AjaxForm()
        {
            var order = new Shop_Orders();

            if (DoAction == ActionType.Edit)
            {
                order = _orderDa.GetById(ArrId.FirstOrDefault());
            }
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            return(View(order));
        }
 public ActionResult StopOrder(string key, int bedId, string port)
 {
     if (key == Keyapi)
     {
         var item = _da.GetOrderOrContactByBedId(bedId);
         var date = DateTime.Now.TotalSeconds();
         if (item.ContactOrders.Any())
         {
             var obj = _contactOrderDa.GetById(item.ContactOrders.Select(m => m).FirstOrDefault());
             if (obj != null)
             {
                 if (date < obj.StartDate)
                 {
                     foreach (var items in obj.Shop_ContactOrder_Details)
                     {
                         items.Status = (int)FDI.CORE.OrderStatus.Cancelled;
                     }
                     obj.Status = (int)FDI.CORE.OrderStatus.Cancelled;
                 }
                 else
                 {
                     obj.Status = (int)FDI.CORE.OrderStatus.Complete;
                 }
                 obj.EndDate = DateTime.Now.TotalSeconds();
                 _contactOrderDa.Save();
                 var url = port + "/updatecontact/" + obj.ID;
                 Node(url);
                 return(Json(1, JsonRequestBehavior.AllowGet));
             }
         }
         else if (item.Shop_Orders.Any())
         {
             var obj = _ordersDa.GetById(item.Shop_Orders.Select(m => m).FirstOrDefault());
             if (obj != null)
             {
                 if (date < obj.StartDate)
                 {
                     foreach (var items in obj.Shop_Order_Details)
                     {
                         items.Status = (int)FDI.CORE.OrderStatus.Cancelled;
                     }
                     foreach (var itemOrder in obj.WalletOrder_History)
                     {
                         itemOrder.IsDelete = true;
                     }
                     foreach (var item1 in obj.RewardHistories)
                     {
                         item1.IsDeleted = true;
                     }
                     foreach (var item2 in obj.ReceiveHistories)
                     {
                         item2.IsDeleted = true;
                     }
                     obj.Status = (int)FDI.CORE.OrderStatus.Cancelled;
                 }
                 else
                 {
                     obj.Status = (int)FDI.CORE.OrderStatus.Complete;
                 }
                 obj.EndDate = DateTime.Now.TotalSeconds();
                 _ordersDa.Save();
                 var url = port + "/updateorder/" + obj.ID;
                 Node(url);
                 return(Json(2, JsonRequestBehavior.AllowGet));
             }
         }
         return(Json(3, JsonRequestBehavior.AllowGet));
     }
     return(Json(0, JsonRequestBehavior.AllowGet));
 }