public void Prepare(BookingModel form, ReservationState reservation) { this.Reservation = reservation; this.Form = new BookingModel(); if (form != null) { this.Form.PartnerAlias = form.PartnerAlias; this.Form.PartnerSessionID = form.PartnerSessionID; this.Form.CustomerName = form.CustomerName; this.Form.CustomerSecondName = form.CustomerSecondName; this.Form.CustomerAddress = form.CustomerAddress; this.Form.CustomerEmail = form.CustomerEmail; this.Form.CustomerMobile = form.CustomerMobile; this.Form.BookingNote = form.BookingNote; this.Form.PromoCodes = form.PromoCodes; } if (this.Reservation != null) { if (this.Reservation.orders != null) { this.Reservation.orders.ForEach(delegate(ReservationOrder m) { BookingOrderModel order = new BookingOrderModel(); order.ReservationOrder = m; if (form != null && form.Orders != null) { BookingOrderModel formOrder = form.Orders.FirstOrDefault((BookingOrderModel o) => o != null && o.BookingOrder != null && o.BookingOrder.orderid == m.id); if (formOrder != null) { order.BookingOrder = formOrder.BookingOrder; } } this.Form.Orders.Add(order); }); } } bool arg_17A_1; if (this.Reservation != null) { arg_17A_1 = (this.Reservation.errors.FirstOrDefault((ReservationError m) => m.isstop) == null); } else { arg_17A_1 = false; } this.IsBookingEnabled = arg_17A_1; }
public void Prepare(BookingModel form, ReservationState reservation) { this.Reservation = reservation; this.Form = new BookingModel(); if (form != null) { this.Form.PartnerAlias = form.PartnerAlias; this.Form.PartnerSessionID = form.PartnerSessionID; this.Form.CustomerName = form.CustomerName; this.Form.CustomerSecondName = form.CustomerSecondName; this.Form.CustomerAddress = form.CustomerAddress; this.Form.CustomerEmail = form.CustomerEmail; this.Form.CustomerMobile = form.CustomerMobile; this.Form.BookingNote = form.BookingNote; this.Form.PromoCodes = form.PromoCodes; } if (this.Reservation != null) { if (this.Reservation.orders != null) { this.Reservation.orders.ForEach(delegate (ReservationOrder m) { BookingOrderModel order = new BookingOrderModel(); order.ReservationOrder = m; if (form != null && form.Orders != null) { BookingOrderModel formOrder = form.Orders.FirstOrDefault((BookingOrderModel o) => o != null && o.BookingOrder != null && o.BookingOrder.orderid == m.id); if (formOrder != null) { order.BookingOrder = formOrder.BookingOrder; } } this.Form.Orders.Add(order); }); } } bool arg_17A_1; if (this.Reservation != null) { arg_17A_1 = (this.Reservation.errors.FirstOrDefault((ReservationError m) => m.isstop) == null); } else { arg_17A_1 = false; } this.IsBookingEnabled = arg_17A_1; }
public ActionResult Index(BookingCartWebParam param) { Action<BookingOrder> action = null; Action<BookingOrder> action2 = null; BookingContext context = new BookingContext(); CompleteOperation operation = CompleteOperation.CreateFromSession(base.Session); if (operation.IsProgress) { context.BookingOperationId = operation.OperationId; return base.View("_BookingProcessing", context); } if (operation.HasResult) { BookingCartResult result = JsonConvert.DeserializeObject<BookingCartResult>(operation.OperationResultData); if (result != null) { context.Prepare(result.Form, result.Reservation); } operation.Clear(); return base.View(context); } using (ShoppingCart cart = ShoppingCart.CreateFromSession(base.Session)) { if (param != null) { if (param.PartnerSessionID != null) { cart.PartnerSessionID = param.PartnerSessionID; } if (param.PartnerAlias != null) { cart.PartnerAlias = param.PartnerAlias; } } context.Form = new BookingModel(); context.Form.PartnerAlias = cart.PartnerAlias; context.Form.PartnerSessionID = cart.PartnerSessionID; if (WebSecurity.IsAuthenticated) { context.Form.CustomerEmail = WebSecurity.CurrentUserName; } if (cart.Orders != null) { if (action == null) { action = delegate (BookingOrder o) { if (((o != null) && (o.excursion != null)) && (o.excursion.contact != null)) { if (!((context.Form.CustomerName != null) || string.IsNullOrEmpty(o.excursion.contact.name))) { context.Form.CustomerName = o.excursion.contact.name; } if (!((context.Form.CustomerMobile != null) || string.IsNullOrEmpty(o.excursion.contact.mobile))) { context.Form.CustomerMobile = o.excursion.contact.mobile; } } }; } cart.Orders.ForEach(action); } if (cart.Orders != null) { if (action2 == null) { action2 = delegate (BookingOrder m) { BookingOrderModel item = new BookingOrderModel { BookingOrder = m }; context.Form.Orders.Add(item); }; } cart.Orders.ForEach(action2); } } context.Form.Action = "calculate"; context.PaymentModes = BookingProvider.GetPaymentModes(UrlLanguage.CurrentLanguage, 2025654180); return this.Index(context.Form); }