private void CompleteSave()
        {
            string message = "Do you wish to confirm the booking?";

            if (newPayment.Amount > 0)
            {
                message += " - (£" + newPayment.Amount + ")";
            }

            new Android.App.AlertDialog.Builder(Activity).
            SetIcon(Android.Resource.Drawable.IcDialogAlert).
            SetTitle("Confirm").
            SetMessage(message).
            SetPositiveButton("Yes", (c, ev) =>
            {
                Booking svdBooking = _bookingFacade.Create(newBooking).Result;

                newPayment.BookingId = svdBooking.Id;

                if (newPayment.Amount > 0)
                {
                    Payment svdPayment = _paymentFacade.Create(newPayment).Result;
                }

                Toast.MakeText(Activity, "Booking Confirmed", ToastLength.Long).Show();

                Dismiss();
            }).
            SetNegativeButton("No", (c, ev) =>
            {
            }).
            Show();
        }
예제 #2
0
        public ActionResult AddMenuItems([Bind(Include = "Id,Name,Description,Price,Selected")] IList <AddMenuItemVM> menuItems)
        {
            List <int> ids = Session["MenuItems"] as List <int>;

            if (ids != null && ids.Any())
            {
                return(RedirectToAction("Create", "Payment"));
            }

            Booking booking = (Booking)Session["Booking"];

            _bookingFacade.Create(booking);
            AddToastMessage("Confirmed", "Booking Confirmed", Toast.ToastType.Success);

            return(RedirectToAction("Index", new { userId = Session[Global.UserIdSessionVar] }));
        }
        public ActionResult Create([Bind(Include = "BookingId,CustomerId,Amount,Comments,PaymentMethod")] PaymentVM payment)
        {
            Booking    booking = (Booking)Session["Booking"];
            List <int> ids     = Session["MenuItems"] as List <int>;

            payment.CustomerId = (int)Session[Global.UserIdSessionVar];
            payment.BookingId  = booking.Id;

            if (ModelState.IsValid)
            {
                booking.PaymentMadeDate = DateTime.Now.Date;
                booking.PaymentTotal    = Convert.ToDecimal(payment.Amount);

                IEnumerable <BookingMenuItem> menuItems = ids.Select(m => new BookingMenuItem {
                    MenuItemId = m, Quantity = 1
                });
                booking.MenuItems = menuItems;

                Booking resBooking = _bookingFacade.Create(booking);

                payment.BookingId = resBooking.Id;

                Payment res = _paymentFacade.Create(new Payment
                {
                    Amount        = Convert.ToDecimal(payment.Amount),
                    Comments      = payment.Comments,
                    BookingId     = payment.BookingId,
                    CustomerId    = payment.CustomerId,
                    PaymentMethod = new PaymentMethod
                    {
                        Id = payment.PaymentMethod
                    }
                });

                AddToastMessage("Confirmed", "Booking Confirmed", Toast.ToastType.Success);
                return(RedirectToAction("Index", "Booking", new { userId = Session[Global.UserIdSessionVar] }));
            }

            ViewBag.PaymentMethod = new SelectList(_paymentFacade.GetPaymentMethod().OrderBy(d => d.Name), "id", "name", "Select payment method");

            return(View(payment));
        }