public ActionResult Search(ProductCarRental.SearchCriteria model)
        {
            model = model ?? new ProductCarRental.SearchCriteria();
            FilterHotelResultModel filterResult = new FilterHotelResultModel();

            if (Core.GetSession(Enumeration.SessionName.CarRentalSearchReq, tripid) != null)
            {
                model = (ProductCarRental.SearchCriteria)Core.GetSession(Enumeration.SessionName.CarRentalSearchReq, tripid);
            }
            else if (model.PickupDateTime != DateTime.MinValue && model.ReturnDateTime != DateTime.MinValue && Core.GetSession(Enumeration.SessionName.CarRentalSearchReq, tripid) == null)
            {
                Core.SetSession(Enumeration.SessionName.CarRentalSearchReq, tripid, model);
            }
            else
            {
                // GO
                model.PickupDateTime = DateTime.Now.AddDays(double.Parse(Core.GetSettingValue("dayadvance")));
                // RETURN
                model.ReturnDateTime = model.PickupDateTime.AddDays(1);
            }

            #region If error from Reserve, show message.
            if (Core.GetSession(Enumeration.SessionName.ErrorMessage) != null)
            {
                ViewData.Add("ERRMSG", Core.GetSession(Enumeration.SessionName.ErrorMessage).ToString());
                Core.SetSession(Enumeration.SessionName.ErrorMessage, null);
            }
            #endregion

            CheckoutProduct checkoutmodel = new CheckoutProduct();
            if (Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid) != null)
            {
                checkoutmodel = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid);
            }
            if (checkoutmodel.CarRental == null)
            {
                checkoutmodel.InsertProduct(new ProductCarRental
                {
                    SearchInfo = model,
                });
                Core.SetSession(Enumeration.SessionName.CheckoutProduct, tripid, checkoutmodel);
            }
            var locationList = CarsRentalServiceCall.GetBranchList();
            ViewBag.locationList = locationList;
            return(View(checkoutmodel));
        }
Example #2
0
        public ActionResult GetTourPackage(int TourPackageID)
        {
            string tripid          = Guid.NewGuid().ToString();
            var    tour            = new ProductTourPackage(TourPackageID);
            var    langList        = UtilitiesService.GetTourLanguageList(tour.TourPackageID);
            var    entrances       = tour.TourPackageDetails.EntranceTickets.ToList();
            var    transportDetail = tour.TourPackageDetails.TransportPackages.ToList();

            if (!((langList != null && langList.Count > 0) || (entrances != null && entrances.Count > 0) || (transportDetail != null && transportDetail.Count > 0)))
            {
                tour.skipAddon = true;
            }
            CheckoutProduct checkout = new CheckoutProduct();

            checkout.InsertProduct(tour);
            Core.SetSession(Enumeration.SessionName.CheckoutProduct, tripid, checkout);
            return(RedirectToAction("Search", "TourPackage", new { tripid }));
        }
Example #3
0
        private CheckoutProduct GenerateTestProduct()
        {
            SearchFlightResultViewModel searchModel = new SearchFlightResultViewModel
            {
                ArrivalStation       = "PEN",
                BeginDate            = new DateTime(2018, 2, 2),
                DepartureStation     = "KUL",
                CabinClass           = "Y",
                DepartureTime        = "00002359",
                DirectFlight         = false,
                EndDate              = new DateTime(2018, 2, 10),
                PrefferedAirlineCode = string.Empty,
                ReturnTime           = "00002359",
                TripType             = "Return",
                Adults    = 1,
                Childrens = 1,
                Infants   = 0
            };

            var contactPerson = new ContactPerson
            {
                Address1           = "asd",
                Address2           = "fgh",
                Address3           = "jkl",
                City               = "rgrrgeg",
                CountryCode        = "123123",
                Email              = "*****@*****.**",
                GivenName          = "werwe",
                Phone1             = "12573725",
                Phone1LocationCode = "08",
                Phone1Prefix       = "0808",
                Phone1PrefixNo     = "321",
                Phone1UseType      = "cell",
                Phone2             = "312131",
                Phone2LocationCode = "321654",
                Phone2Prefix       = "654",
                Phone2PrefixNo     = "564",
                Phone2UseType      = "phone",
                PostalCode         = "56465",
                State              = "asddd",
                Surname            = "asdsad",
                Title              = "Mr",
                DOB = new DateTime(1999, 08, 01),
            };

            CheckoutProduct product = new CheckoutProduct
            {
                ContactPerson = contactPerson,
            };

            product.InsertProduct(new ProductFlight
            {
                SearchFlightInfo = searchModel,
                ContactPerson    = contactPerson,
                TravellerDetails = new List <TravellerDetail>
                {
                    new TravellerDetail
                    {
                        Address1           = "asd",
                        Address2           = "fgh",
                        Address3           = "jkl",
                        City               = "rgrrgeg",
                        CountryCode        = "123123",
                        Email              = "*****@*****.**",
                        GivenName          = "werwe",
                        Phone1             = "12573725",
                        Phone1LocationCode = "08",
                        Phone1Prefix       = "0808",
                        Phone1PrefixNo     = "321",
                        Phone1UseType      = "cell",
                        Phone2             = "312131",
                        Phone2LocationCode = "321654",
                        Phone2Prefix       = "654",
                        Phone2PrefixNo     = "564",
                        Phone2UseType      = "phone",
                        PostalCode         = "56465",
                        State              = "asddd",
                        Surname            = "asdsad",
                        Title              = "Mr",
                        DOB = new DateTime(1999, 08, 01),
                    }
                }
            });

            return(product);
        }
Example #4
0
        public ActionResult Hotel(string travelerdata, ProductTourPackage prodTour, string tripid)
        {
            CheckoutProduct checkout          = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid);
            int             TourPackageID     = checkout.TourPackage.TourPackageID;
            int             NoOfPax           = checkout.TourPackage.TourPackagesInfo.NoOfPax;
            var             tourProdDetail    = checkout.TourPackage.TourPackageDetails;
            bool            isEmptyHotelToken = string.IsNullOrWhiteSpace(travelerdata);

            List <TourRoomModel> TourRoomPackages = isEmptyHotelToken ? new List <TourRoomModel>() : JsonConvert.DeserializeObject <List <TourRoomModel> >(travelerdata);

            foreach (var room in TourRoomPackages)
            {
                room.RoomTypeName = tourProdDetail.PackageRoomTypes.FirstOrDefault(x => x.RoomTypeID == room.RoomTypeID).RoomTypeName;
            }
            checkout.TourPackage.TourPackagesInfo.TourRoomPackages = TourRoomPackages;
            checkout.TourPackage.TourPackagesInfo.HotelID          = TourRoomPackages.FirstOrDefault().hotelID;
            checkout.TourPackage.TourPackagesInfo.RatingID         = tourProdDetail.PackageHotels.FirstOrDefault(x => x.HotelID == checkout.TourPackage.TourPackagesInfo.HotelID).RatingID;

            List <PeakDates>   PeakDateList = GetDates(checkout.TourPackage.TourPackagesInfo.TravelDateFrom, checkout.TourPackage.TourPackagesInfo.TravelDateTo, checkout.TourPackage.TourPackageDetails, checkout.TourPackage.TourPackagesInfo);
            List <ProductItem> tourproducts = new List <ProductItem>();

            tourproducts.Add(new ProductItem()
            {
                ItemDetail        = tourProdDetail.TourPackageName,
                ItemQty           = NoOfPax,
                BaseRate          = tourProdDetail.SellingPrice,
                Surcharge         = 0,
                Supplier_TotalAmt = tourProdDetail.Cost * NoOfPax,
                GST = 0,
            });
            foreach (var room in TourRoomPackages)
            {
                var roomdetail = tourProdDetail.PackageRoomTypes.Where(x => x.RoomTypeID == room.RoomTypeID).FirstOrDefault();
                tourproducts.Add(new ProductItem()
                {
                    ItemDetail        = roomdetail.RoomTypeName + " room",
                    ItemQty           = room.Qty,
                    BaseRate          = roomdetail.PackageRoomPrices.FirstOrDefault(x => x.RoomPriceID == room.RoomPriceID).SellingPrice,
                    Surcharge         = 0,
                    Supplier_TotalAmt = roomdetail.Cost * room.Qty,
                    GST = 0,
                });
            }
            if (checkout.TourPackage.TourPackagesInfo.ExtensionNight != 0)
            {
                int totalextension = checkout.TourPackage.TourPackagesInfo.ExtensionNight;
                tourproducts.Add(new ProductItem()
                {
                    ItemDetail        = "Extension",
                    ItemQty           = totalextension,
                    BaseRate          = tourProdDetail.ExtensionPrice ?? 0,
                    Surcharge         = 0,
                    Supplier_TotalAmt = (tourProdDetail.ExtensionPrice ?? 0) * totalextension,
                    GST = 0,
                });
            }

            if (PeakDateList.Count > 0)
            {
                tourproducts.Add(new ProductItem()
                {
                    ItemDetail        = "Peak season surcharge",
                    ItemQty           = 1,
                    BaseRate          = PeakDateList.FirstOrDefault().PeakSurcharge,
                    Surcharge         = 0,
                    Supplier_TotalAmt = PeakDateList.FirstOrDefault().PeakSurcharge,
                    GST = 0,
                });
            }

            ProductPricingDetail tourPricingDetail = new ProductPricingDetail
            {
                Sequence  = 5,
                Currency  = "MYR",
                Items     = tourproducts,
                Discounts = new List <DiscountDetail>(),
            };
            ProductTourPackage producttour = new ProductTourPackage()
            {
                TourPackageID      = TourPackageID,
                ContactPerson      = checkout.ContactPerson,
                TourPackageDetails = checkout.TourPackage.TourPackageDetails,
                TourPackagesInfo   = checkout.TourPackage.TourPackagesInfo,
                ProductSeq         = 5,
                PricingDetail      = tourPricingDetail,
            };

            if (checkout.TourPackage != null)
            {
                checkout.RemoveProduct(ProductTypes.TP);
            }
            checkout.InsertProduct(producttour);

            var langList        = UtilitiesService.GetTourLanguageList(TourPackageID);
            var entrances       = tourProdDetail.EntranceTickets.ToList();
            var transportDetail = tourProdDetail.TransportPackages.ToList();

            if (!((langList != null && langList.Count > 0) || (entrances != null && entrances.Count > 0) || (transportDetail != null && transportDetail.Count > 0)))
            {
                checkout.TourPackage.skipAddon = true;
            }
            if (checkout.TourPackage.skipAddon || true)
            {
                return(RedirectToAction("Contact", "TourPackage", new { tripid, affiliationId }));
            }
            else
            {
                return(RedirectToAction("Addon", "TourPackage", new { tripid, affiliationId }));
            }
        }
Example #5
0
        public ActionResult Search(ProductTourPackage prodTour, string tripid)
        {
            CheckoutProduct checkout = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid);

            int TourPackageID = checkout.TourPackage.TourPackageID;
            var tourprod      = new ProductTourPackage(TourPackageID);

            checkout.TourPackage.TourPackagesInfo = prodTour.TourPackagesInfo;

            if (tourprod.TourPackageDetails.PackageHotels.Count == 0 || tourprod.TourPackageDetails.PackageRoomTypes.Count == 0)
            {
                var tourProdDetail = checkout.TourPackage.TourPackageDetails;
                int NoOfPax        = checkout.TourPackage.TourPackagesInfo.NoOfPax;

                List <ProductItem> tourproducts = new List <ProductItem>();
                tourproducts.Add(new ProductItem()
                {
                    ItemDetail        = tourProdDetail.TourPackageName,
                    ItemQty           = NoOfPax,
                    BaseRate          = tourProdDetail.SellingPrice,
                    Surcharge         = 0,
                    Supplier_TotalAmt = tourProdDetail.Cost * NoOfPax,
                    GST = 0,
                });

                if (checkout.TourPackage.TourPackagesInfo.ExtensionNight != 0)
                {
                    int totalextension = checkout.TourPackage.TourPackagesInfo.ExtensionNight;
                    tourproducts.Add(new ProductItem()
                    {
                        ItemDetail        = "Extension",
                        ItemQty           = totalextension,
                        BaseRate          = tourProdDetail.ExtensionPrice ?? 0,
                        Surcharge         = 0,
                        Supplier_TotalAmt = (tourProdDetail.ExtensionPrice ?? 0) * totalextension,
                        GST = 0,
                    });
                }

                ProductPricingDetail tourPricingDetail = new ProductPricingDetail
                {
                    Sequence  = 5,
                    Currency  = "MYR",
                    Items     = tourproducts,
                    Discounts = new List <DiscountDetail>(),
                };
                ProductTourPackage producttour = new ProductTourPackage()
                {
                    TourPackageID      = TourPackageID,
                    TourPackageDetails = checkout.TourPackage.TourPackageDetails,
                    TourPackagesInfo   = checkout.TourPackage.TourPackagesInfo,
                    ProductSeq         = 5,
                    PricingDetail      = tourPricingDetail,
                };
                if (checkout.TourPackage != null)
                {
                    checkout.RemoveProduct(ProductTypes.TP);
                }
                checkout.InsertProduct(producttour);

                var langList        = UtilitiesService.GetTourLanguageList(TourPackageID);
                var entrances       = tourProdDetail.EntranceTickets.ToList();
                var transportDetail = tourProdDetail.TransportPackages.ToList();
                if (!((langList != null && langList.Count > 0) || (entrances != null && entrances.Count > 0) || (transportDetail != null && transportDetail.Count > 0)))
                {
                    checkout.TourPackage.skipAddon = true;
                }
                if (checkout.TourPackage.skipAddon || true)
                {
                    return(RedirectToAction("Contact", "TourPackage", new { tripid, affiliationId }));
                }
                else
                {
                    return(RedirectToAction("Addon", "TourPackage", new { tripid, affiliationId }));
                }
            }
            else
            {
                return(RedirectToAction("Hotel", "TourPackage", new { tripid, affiliationId }));
            }
        }