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 })); } }
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 })); } }