Exemplo n.º 1
0
        // for admin area
        public OrderDetails GetOrderDetail(int orderNumber)
        {
            mergedEntities db = new mergedEntities();
            OrderDetails orderDetails = new OrderDetails();

            var query =

             from o in db.OrderDetails
             where (o.orderNumber == orderNumber)

             select new OrderDetails()
             //select new
             {
                 OrderNumber = o.orderNumber,
                 OrderDate = (DateTime)o.orderDate,
                 OrderDelivery = (DateTime)o.deliveryTime,
                 DeliveryStatus = (bool)o.deliveryStatus
             };

            foreach (var item in query)
            {

                orderDetails.OrderNumber = item.OrderNumber;
                orderDetails.OrderDate = item.OrderDate;
                orderDetails.OrderDelivery = item.OrderDelivery;
                orderDetails.DeliveryStatus = item.DeliveryStatus;
            }


            return orderDetails;
        }
Exemplo n.º 2
0
        //Get order details
        public OrderDetail GetOrderDetail()
        {
            mergedEntities db = new mergedEntities();
            OrderDetails repo = new OrderDetails();
            OrderDetail order = new OrderDetail();

            var query =
            from a in db.OrderDetails
            where (a.orderNumber == repo.OrderNumber)
            select new
            {
                OrderNumber = a.orderNumber,
                OrderDate = a.orderDate,
                Delivery = a.deliveryStatus,
            };

            foreach (var item in query)
            {
                order.orderNumber = item.OrderNumber;
                order.orderDate = item.OrderDate;
                order.deliveryStatus = item.Delivery;
            }

            return order;
        }
Exemplo n.º 3
0
 public OrderDetails UpdateOrder(OrderDetails orderDetails)
 {
     mergedEntities db = new mergedEntities();
     OrderDetail orderDetail = db.OrderDetails.Where(o => o.orderNumber == orderDetails.OrderNumber).FirstOrDefault();
     orderDetail.orderNumber = orderDetails.OrderNumber;
     orderDetail.orderDate = orderDetails.OrderDate;
     orderDetail.deliveryTime = orderDetails.OrderDelivery;
     orderDetail.deliveryStatus = orderDetails.DeliveryStatus;
     db.SaveChanges();
     return orderDetails;
 }
Exemplo n.º 4
0
        public ActionResult ViewCart()
        {
            var items = shoppingCart.GetAllItems(session.SessionID);

            if (items.Any())
            {
                Session["shoppingCart"] = items.Count();
            }
            else
            {
                Session["shoppingCart"] = null;
            }
            var order = new OrderDetails
            {
                CartItems = items,
                Tax = ProductDetails.TAX_RATE
            };

            return View(order);
        }
Exemplo n.º 5
0
        public ActionResult EditOrderDetail(OrderDetails orderDetails)
        {
            OrderRepo orderRepo = new OrderRepo();
            OrderDetails editedOrderDetails = new OrderDetails();

            if (ModelState.IsValid)
            {
                editedOrderDetails = orderRepo.UpdateOrder(orderDetails);
                return RedirectToAction("AdminOnly");
            }
            else
            {
                ViewBag.ErrorMessage = "This entry is invalid.";
                return View(orderDetails);
            }
        }
Exemplo n.º 6
0
        public ActionResult EditOrderDetail(int id) // "id" is "id order number".
        {
            OrderRepo orderRepo = new OrderRepo();
            OrderDetails orderDetails = new OrderDetails();


            orderDetails = orderRepo.GetOrderDetail(id);
            return View(orderDetails);
        }