Exemplo n.º 1
0
        public ActionResult Order(PagePlusActivityPlusOrderDinners model)
        {
            Order order = (Order)Session["order"];

            if (order == null)
            {
                order = new Order();
            }

            DateTime startTime = model.Day.Date + model.Time.TimeOfDay;
            Activity activity  = activityRepository.GetActivity(model.Activity.Id, (Language)Session["language"]);

            OrderHasTickets ticketOrder = new OrderHasTickets();

            ticketOrder.Ticket_TimeSlot_Activity_Id = model.Activity.Id;
            ticketOrder.Remarks = model.Order.OrderHasTickets[0].Remarks;
            ticketOrder.Ticket_TimeSlot_StartTime = model.Day.Date + model.Time.TimeOfDay;
            ticketOrder.Ticket_Type = TicketType.Single;
            ticketOrder.Amount      = model.NumberOfAdults;

            ticketOrder.Ticket = ticketRepository.GetTicket(activity, startTime, ticketOrder.Ticket_Type);

            ticketOrder.TotalPrice = model.NumberOfAdults * ticketOrder.Ticket.Price;

            order.OrderHasTickets.Add(ticketOrder);


            if (model.NumberOfKids > 0)
            {
                OrderHasTickets to = new OrderHasTickets();

                to.Ticket_TimeSlot_Activity_Id = model.Activity.Id;
                to.Remarks = model.Order.OrderHasTickets[0].Remarks;
                to.Ticket_TimeSlot_StartTime = model.Day.Date + model.Time.TimeOfDay;
                to.Ticket_Type = TicketType.Child;
                to.Amount      = model.NumberOfKids;

                to.Ticket     = ticketRepository.GetTicket(activity, startTime, to.Ticket_Type);
                to.TotalPrice = model.NumberOfKids * ticketOrder.Ticket.Price;
                order.OrderHasTickets.Add(to);
            }

            Session["order"] = order;

            BasketHelper.getInstance().checkBasket(HttpContext);
            return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString()));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int ohdId)
        {
            Order order = (Order)Session["order"];

            foreach (var orderhasticket in order.OrderHasTickets)
            {
                if (orderhasticket.Ticket_TimeSlot_Activity_Id == ohdId)
                {
                    order.OrderHasTickets.Remove(orderhasticket);
                    break;
                }
            }
            Session["order"] = order;

            BasketHelper.getInstance().checkBasket(HttpContext);

            return(RedirectToAction("Basket"));
        }
Exemplo n.º 3
0
        public ActionResult Index(PpApOpQ model)
        {
            Order order = (Order)Session["Order"];

            if (order == null)
            {
                order = new Order();
            }

            Activity activity = activityRepository.GetActivity(model.OHT.Ticket_TimeSlot_Activity_Id, Language.Eng);

            model.OHT.Ticket = ticketRepository.GetTicket(activity, model.OHT.Ticket_TimeSlot_StartTime, model.OHT.Ticket_Type);


            order.OrderHasTickets.Add(model.OHT);
            Session["Order"] = order;

            BasketHelper.getInstance().checkBasket(HttpContext);
            return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString()));
        }
Exemplo n.º 4
0
        public ActionResult OrderJazz(int id, int aantal)
        {
            Language language = (Language)Session["language"];
            Activity activity = activityRepository.GetActivity(id, language);

            OrderHasTickets ticketOrder = new OrderHasTickets();

            ticketOrder.Ticket_TimeSlot_Activity_Id = activity.Id;
            ticketOrder.Ticket_TimeSlot_StartTime   = activity.Timeslots[0].StartTime;
            ticketOrder.Ticket_Type = activity.Timeslots[0].Tickets[0].Type;
            ticketOrder.Amount      = aantal;
            ticketOrder.Ticket      = activity.Timeslots[0].Tickets[0];
            ticketOrder.TotalPrice  = aantal * activity.Timeslots[0].Tickets[0].Price;

            Order order = (Order)Session["order"];

            if (order == null)
            {
                order = new Order();
                order.OrderHasTickets.Add(ticketOrder);
            }
            else
            {
                OrderHasTickets OHT = order.OrderHasTickets.Where(x => x.Ticket_TimeSlot_Activity_Id == ticketOrder.Ticket_TimeSlot_Activity_Id).SingleOrDefault();
                if (OHT != null)
                {
                    OHT.Amount    += ticketOrder.Amount;
                    OHT.TotalPrice = OHT.Ticket.Price * OHT.Amount;
                }
                else
                {
                    order.OrderHasTickets.Add(ticketOrder);
                }
            }
            Session["order"] = order;


            BasketHelper.getInstance().checkBasket(HttpContext);

            return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString()));
        }