public ActionResult Addon(ProductTourPackage prodTour, string tripid) { CheckoutProduct checkout = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid); checkout.TourPackage.TourPackagesInfo.EntranceID = prodTour.TourPackagesInfo.EntranceID; checkout.TourPackage.TourPackagesInfo.LanguageID = prodTour.TourPackagesInfo.LanguageID; checkout.TourPackage.TourPackagesInfo.SpecialRequest = prodTour.TourPackagesInfo.SpecialRequest; checkout.TourPackage.TourPackagesInfo.TransportPackageID = prodTour.TourPackagesInfo.TransportPackageID; int NoOfPax = checkout.TourPackage.TourPackagesInfo.NoOfPax; var tourProdDetail = checkout.TourPackage.TourPackageDetails; checkout.TourPackage.PricingDetail.Items.RemoveAll(x => x.ItemDetail.Contains("Tour Guide:") || x.ItemDetail.Contains("Entrances Ticket:") || x.ItemDetail.Contains("Transport Package: ")); if (checkout.TourPackage.TourPackagesInfo.LanguageID != 0) { var languages = UtilitiesService.GetTourLanguageList(checkout.TourPackage.TourPackagesInfo.LanguageID); var lang = languages.FirstOrDefault(x => x.LanguageID == checkout.TourPackage.TourPackagesInfo.LanguageID); checkout.TourPackage.PricingDetail.Items.Add(new ProductItem() { ItemDetail = "Tour Guide: " + lang.Language, ItemQty = 1, BaseRate = lang.TourLanguagePrices.FirstOrDefault().SellingPrice, Surcharge = 0, Supplier_TotalAmt = lang.TourLanguagePrices.FirstOrDefault().Cost, GST = 0, }); } if (checkout.TourPackage.TourPackagesInfo.EntranceID != 0) { var entranceDetail = tourProdDetail.EntranceTickets.Where(x => x.EntranceID == checkout.TourPackage.TourPackagesInfo.EntranceID).FirstOrDefault(); checkout.TourPackage.PricingDetail.Items.Add(new ProductItem() { ItemDetail = "Entrances Ticket: " + entranceDetail.Ticket, ItemQty = NoOfPax, BaseRate = entranceDetail.SellingPrice, Surcharge = 0, Supplier_TotalAmt = entranceDetail.Cost * NoOfPax, GST = 0, }); } if (checkout.TourPackage.TourPackagesInfo.TransportPackageID != 0) { var transportDetail = tourProdDetail.TransportPackages.Where(x => x.TransportPackageID == checkout.TourPackage.TourPackagesInfo.TransportPackageID).FirstOrDefault(); checkout.TourPackage.PricingDetail.Items.Add(new ProductItem() { ItemDetail = "Transport Package: " + transportDetail.Description, ItemQty = NoOfPax, BaseRate = transportDetail.SellingPrice, Surcharge = 0, Supplier_TotalAmt = transportDetail.Cost * NoOfPax, GST = 0, }); } return(RedirectToAction("Contact", "TourPackage", new { tripid, affiliationId })); }
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 })); }
public ActionResult UpdateTourAddonPrice(string tripid, int transportID = 0, int entranceID = 0, int languageID = 0) { CheckoutProduct checkout = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid); dynamic obj = new System.Dynamic.ExpandoObject(); var tourInfo = checkout.TourPackage.TourPackageDetails; int NoOfPax = checkout.TourPackage.TourPackagesInfo.NoOfPax; var displayhtml = ""; decimal tourprice = checkout.TourPackage.PricingDetail.ProductTotalAmount; decimal entrancePrice = 0; decimal transportPrice = 0; decimal languagePrice = 0; if (transportID != 0) { var transportDetail = tourInfo.TransportPackages.Where(x => x.TransportPackageID == transportID).FirstOrDefault(); transportPrice = transportDetail.SellingPrice * NoOfPax; displayhtml += "<li class='reservation-room tpaddon'><span>" + transportDetail.Description + " x " + NoOfPax + "</span>"; displayhtml += "<span>MYR" + transportPrice.ToString("n2") + "</span></li>"; } if (entranceID != 0) { var entranceDetail = tourInfo.EntranceTickets.Where(x => x.EntranceID == entranceID).FirstOrDefault(); transportPrice = entranceDetail.SellingPrice * NoOfPax; displayhtml += "<li class='reservation-room addon'><span>" + entranceDetail.Ticket + " x " + NoOfPax + "</span>"; displayhtml += "<span>MYR" + transportPrice.ToString("n2") + "</span></li>"; } if (languageID != 0) { var languages = UtilitiesService.GetTourLanguageList(checkout.TourPackage.TourPackagesInfo.LanguageID); var lang = languages.FirstOrDefault(x => x.LanguageID == checkout.TourPackage.TourPackagesInfo.LanguageID); transportPrice = lang.TourLanguagePrices.FirstOrDefault().SellingPrice *NoOfPax; displayhtml += "<li class='reservation-room addon'><span>" + lang.Language + "</span>"; displayhtml += "<span>MYR" + transportPrice.ToString("n2") + "</span></li>"; } decimal ttlprice = tourprice + entrancePrice + languagePrice + transportPrice; obj.ttl = ttlprice.ToString("n2"); obj.ttlper = NoOfPax != 0 ? (ttlprice / NoOfPax).ToString("n2") : "0.00"; obj.roomdesc = displayhtml; return(Content(JsonConvert.SerializeObject(obj), "application/json")); }
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 })); } }