Ejemplo n.º 1
0
        public static void UpdateMasterData(BookingConfirmationViewModel model)
        {
            var manager             = PlugInManager.GetBookingDataManager();
            var bookingconfirmation = manager.GetBookingConfirmation(model.id);

            bookingconfirmation.Id = model.id;
            bookingconfirmation.BookingInquiryNummer      = model.BookingInquiryNummer;
            bookingconfirmation.BookingConfirmationNummer = model.BookingConfirmationNummer;
            bookingconfirmation.BookingProcessId          = model.BookingProcessId;
            bookingconfirmation.docType                     = model.docType;
            bookingconfirmation.OfferInfo.Country           = model.Country;
            bookingconfirmation.OfferInfo.PlaceName         = model.PlaceName;
            bookingconfirmation.OfferInfo.SiteName          = model.SiteName;
            bookingconfirmation.OfferInfo.TourOperatorCode  = model.TourOperatorCode;
            bookingconfirmation.OfferInfo.CheckIn           = model.CheckIn;
            bookingconfirmation.OfferInfo.CheckOut          = model.CheckOut;
            bookingconfirmation.TravelApplicant.FirstName   = model.FirstName;
            bookingconfirmation.TravelApplicant.LastName    = model.LastName;
            bookingconfirmation.TravelApplicant.Contry      = model.TravelerCountry;
            bookingconfirmation.TravelApplicant.Adress      = model.Address;
            bookingconfirmation.OfferInfo.OfferName         = model.OfferName;
            bookingconfirmation.TravelApplicant.MobilePhone = model.MobilePhone;
            bookingconfirmation.TravelApplicant.Phone       = model.Phone;
            bookingconfirmation.TravelApplicant.ZipCode     = model.ZipCode;
            bookingconfirmation.TravelApplicant.Place       = model.PlaceName;
            bookingconfirmation.HtmlDocumentView            = model.HtmlDocumentView;

            manager.UpdateMasterData(bookingconfirmation);
        }
 private bool CheckisSame(ProviderAnnouncementViewModel modela, BookingConfirmationViewModel modelc)
 {
     if ((modela.CheckIn == modelc.CheckIn) && (modela.CheckOut == modelc.CheckOut))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// loads the confirmation page to finalise and make payments
        /// </summary>
        /// <param name="bookingId">id of booking</param>
        /// <returns>Confirmation page</returns>
        public async Task <IActionResult> Confirmation(int?bookingId)
        {
            //if booking id is null go to browse brochures
            if (bookingId == null)
            {
                return(RedirectToAction(nameof(BrochureController.Browse), "Brochure"));
            }

            //gets all data from the database related to the booking
            var booking = await _context.Bookings
                          .Where(b => b.BookingId == bookingId)
                          .Include(b => b.Brochure)
                          .Include(b => b.Brochure.Accomodation)
                          .Include(b => b.Brochure.Accomodation.Country)
                          .Include(b => b.Persons)
                          .FirstOrDefaultAsync();

            //if booking doesnt exist, redirect to browse brochures
            if (booking == null)
            {
                return(RedirectToAction(nameof(BrochureController.Browse), "Brochure"));
            }

            //updates the total price of the booking in the database
            booking.TotalPrice = booking.Brochure.PricePerPerson * booking.Persons.Count();
            _context.Bookings.Update(booking);
            await _context.SaveChangesAsync();

            //populate the viewmodel and inject into the view
            BookingConfirmationViewModel model = new BookingConfirmationViewModel
            {
                BookingId           = (int)bookingId,
                AccomodationName    = booking.Brochure.Accomodation.AccomodationName,
                CountryName         = booking.Brochure.Accomodation.Country.CountryName,
                DepartureDate       = booking.DepartureDate,
                Duration            = booking.Brochure.Duration,
                Catering            = booking.Brochure.Catering,
                TotalPrice          = booking.TotalPrice,
                Persons             = booking.Persons,
                Status              = booking.Status,
                SpecialRequirements = booking.SpecialRequirements
            };

            //if special requirements are returned null, initialize it
            if (model.SpecialRequirements == null)
            {
                model.SpecialRequirements = "";
            }
            return(View(model));
        }
        public async Task <IActionResult> Confirmation(BookingConfirmationViewModel model)
        {
            //get booking from the database
            var booking = await _context.Bookings.FindAsync(model.BookingId);

            //if booking doesnt exist redirect to the previous page
            if (booking == null)
            {
                return(RedirectToAction(nameof(BookingController.Confirmation), new { bookingId = model.BookingId }));
            }

            //update payment method in the database
            booking.PaymentType = model.PaymentType;
            _context.Update(booking);
            await _context.SaveChangesAsync();

            //redirect to make payment page
            return(RedirectToAction(nameof(BookingController.MakePayment), new { bookingId = model.BookingId }));
        }
Ejemplo n.º 5
0
        public ActionResult ConfirmationLetter(int Id)
        {
            List <BookingConfirmationViewModel> bookingConfirmationViewModels = new List <BookingConfirmationViewModel>();
            BookingConfirmationViewModel        bookingConfirmationViewModel  = new BookingConfirmationViewModel();
            SearchViewModel searchViewModel = new SearchViewModel
            {
                Id = Id
            };
            var results = webServices.Post(searchViewModel, "CustomerBooking/BookingConfirmationById");

            if (results.StatusCode == System.Net.HttpStatusCode.Accepted)
            {
                bookingConfirmationViewModel = (new JavaScriptSerializer()).Deserialize <BookingConfirmationViewModel>(results.Data.ToString());
            }

            bookingConfirmationViewModels.Add(bookingConfirmationViewModel);

            string         pdfname = "";
            ReportDocument Report  = new ReportDocument();

            Report.Load(Server.MapPath("~/Reports/OrderConfirmation/OrderConfirmation.rpt"));

            Report.Database.Tables[0].SetDataSource(bookingConfirmationViewModels);
            //Report.Database.Tables[1].SetDataSource(compnayModels);

            Stream stram = Report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stram.Seek(0, SeekOrigin.Begin);

            var root = Server.MapPath("/PDF/");

            pdfname = String.Format("{0}.pdf", "Demo");
            var path = Path.Combine(root, pdfname);

            path = Path.GetFullPath(path);

            //Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path);
            //  stram.Close();

            stram.Seek(0, SeekOrigin.Begin);
            return(new FileStreamResult(stram, "application/pdf"));
        }
        public IActionResult BookingConfirmation(Payment payment)
        {
            var claimsIdentity = (ClaimsIdentity)User.Identity;
            var identityClaim  = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);

            var user      = _appContext.ApplicationUsers.FirstOrDefault(u => u.Id == identityClaim.Value);
            var bookingId = HttpContext.Session.GetInt32("bookingId");
            var booking   = _appContext.Bookings.FirstOrDefault(b => b.Id == bookingId);
            var room      = _appContext.Rooms.FirstOrDefault(r => r.RoomId == booking.RoomId);
            var hotel     = _appContext.Hotels.FirstOrDefault(h => h.HotelId == room.HotelId);

            var bookingConfVM = new BookingConfirmationViewModel()
            {
                User    = user,
                Payment = payment,
                Booking = booking,
                Room    = room,
                Hotel   = hotel,
            };

            return(View(bookingConfVM));
        }
Ejemplo n.º 7
0
        public static BookingConfirmationViewModel CreateBookingConfirmation(string bookingid)
        {
            var bookingmodel        = GetBookingProcess(bookingid);
            var bookingconfirmation = new BookingConfirmationViewModel();

            bookingconfirmation.Address          = bookingmodel.Address;
            bookingconfirmation.BookingProcessId = bookingid;
            bookingconfirmation.CheckIn          = bookingmodel.CheckIn;
            bookingconfirmation.CheckOut         = bookingmodel.CheckOut;
            bookingconfirmation.Country          = bookingmodel.Country;
            bookingconfirmation.FirstName        = bookingmodel.FirstName;
            bookingconfirmation.LastName         = bookingmodel.LastName;
            bookingconfirmation.MobilePhone      = bookingmodel.MobilePhone;
            bookingconfirmation.OfferName        = bookingmodel.OfferName;
            bookingconfirmation.Phone            = bookingmodel.Phone;
            bookingconfirmation.PlaceName        = bookingmodel.PlaceName;
            bookingconfirmation.SiteName         = bookingmodel.SiteName;
            bookingconfirmation.TourOperatorCode = bookingmodel.TourOperatorCode;
            bookingconfirmation.TravelerCountry  = bookingmodel.TravelerCountry;
            bookingconfirmation.TravelerPlace    = bookingmodel.TravelerPlace;
            bookingconfirmation.ZipCode          = bookingmodel.ZipCode;

            return(bookingconfirmation);
        }
Ejemplo n.º 8
0
        public static List <BookingConfirmationViewModel> GetBookingConfirmationViewModel()
        {
            var model   = new List <BookingConfirmationViewModel>();
            var manager = PlugInManager.GetBookingDataManager();

            var bookingconfirmations = manager.GetBookingConfirmations();

            foreach (var bookingconfirmation in bookingconfirmations)
            {
                var m = new BookingConfirmationViewModel();
                m.id                        = bookingconfirmation.Id;
                m.docType                   = bookingconfirmation.docType;
                m.BookingProcessId          = bookingconfirmation.BookingProcessId;
                m.BookingInquiryNummer      = bookingconfirmation.BookingInquiryNummer;
                m.BookingConfirmationNummer = bookingconfirmation.BookingConfirmationNummer;
                m.Country                   = bookingconfirmation.OfferInfo.Country;
                m.PlaceName                 = bookingconfirmation.OfferInfo.PlaceName;
                m.SiteName                  = bookingconfirmation.OfferInfo.SiteName;
                m.TourOperatorCode          = bookingconfirmation.OfferInfo.TourOperatorCode;
                m.CheckIn                   = bookingconfirmation.OfferInfo.CheckIn;
                m.CheckOut                  = bookingconfirmation.OfferInfo.CheckOut;
                m.FirstName                 = bookingconfirmation.TravelApplicant.FirstName;
                m.LastName                  = bookingconfirmation.TravelApplicant.LastName;
                m.TravelerCountry           = bookingconfirmation.TravelApplicant.Contry;
                m.Address                   = bookingconfirmation.TravelApplicant.Adress;
                m.OfferName                 = bookingconfirmation.OfferInfo.OfferName;
                m.MobilePhone               = bookingconfirmation.TravelApplicant.MobilePhone;
                m.Phone                     = bookingconfirmation.TravelApplicant.Phone;
                m.ZipCode                   = bookingconfirmation.TravelApplicant.ZipCode;
                m.TravelerPlace             = bookingconfirmation.TravelApplicant.Place;
                m.HtmlDocumentView          = bookingconfirmation.HtmlDocumentView;
                model.Add(m);
            }

            return(model);
        }
 public void UpdateMasterData(BookingConfirmationViewModel model)
 {
     BookingDataDocumentsRepository.UpdateMasterData(model);
 }
Ejemplo n.º 10
0
 public void AddMasterData(BookingConfirmationViewModel model)
 {
     BookingDataRepository.AddMasterData(model);
 }