コード例 #1
0
ファイル: HomeController.cs プロジェクト: e2ard/PricingTool
        //public string GetEconomyPdf(SearchFilters searchFilters)
        //{
        //    DateTime sDate = searchFilters.PuDate;
        //    DateTime eDate = searchFilters.DoDate;
        //    EcoBookings s = new EcoBookings(Const.Locations[searchFilters.Location].EcoBoking);
        //    JSourceReader s1 = new JSourceReader();
        //    sDate = sDate.AddDays(1);
        //    eDate = eDate.AddDays(1);
        //    s.InitDate(sDate);

        //    int numOfIterations = (eDate - sDate).Days;

        //    List<string> links = s.GetGeneratedLinksByDate(sDate, eDate);
        //    List<JOffer> minOffers = new List<JOffer>();
        //    Dictionary<string, Dictionary<string, JOffer>> offerMap = new Dictionary<string, Dictionary<string, JOffer>>();

        //    for (int i = 0; i < links.Count; i++)
        //        offerMap.Add(links[i], new Dictionary<string, JOffer>());

        //    List<Thread> threads = new List<Thread>();
        //    for (int i = 0; i < links.Count; i++)
        //    {
        //        JSourceReader reader = new JSourceReader();
        //        List<JOffer> offers = reader.GetBookingOffers(
        //                            reader.GetBookingsSource(links.ElementAt(i), links.ElementAt(i)));

        //        offerMap[links.ElementAt(i)] =
        //                reader.GetMapNorwegian(offers);

        //    }
        //    return CreatePdf(s, offerMap);
        //}

        public string GetExpediaPdf(SearchFilters searchFilters)
        {
            DateTime      sDate = searchFilters.PuDate;
            DateTime      eDate = searchFilters.DoDate;
            Expedia       s     = new Expedia(Const.Locations[searchFilters.Location].EcoBoking);
            JSourceReader s1    = new JSourceReader();

            sDate = sDate.AddDays(1);
            eDate = eDate.AddDays(1);
            s.InitDate(sDate);

            int numOfIterations = (eDate - sDate).Days;

            List <string> links     = s.GetGeneratedLinksByDate(sDate, eDate);
            List <JOffer> minOffers = new List <JOffer>();
            Dictionary <string, Dictionary <string, JOffer> > offerMap = new Dictionary <string, Dictionary <string, JOffer> >();

            for (int i = 0; i < links.Count; i++)
            {
                offerMap.Add(links[i], new Dictionary <string, JOffer>());
            }

            List <Thread> threads = new List <Thread>();

            for (int i = 0; i < links.Count; i++)
            {
                JSourceReader reader = new JSourceReader();
                List <JOffer> offers = reader.GetExpediaOffers(
                    reader.GetExpediaSource(links.ElementAt(i)));

                offerMap[links.ElementAt(i)] =
                    reader.GetMapNorwegian(offers);
            }
            return(CreatePdf(s, offerMap));
        }
コード例 #2
0
ファイル: SiteManager.cs プロジェクト: Snappey/Scraper
        /// <summary>
        /// Registers each of the individual implementation of the sites
        /// </summary>
        public void Register()
        {
            IHG ihg = new IHG(scraper);

            Sites.Add(ihg);

            HolidayInn holidayInn = new HolidayInn(scraper);

            Sites.Add(holidayInn);

            CrownePlaza crownePlaza = new CrownePlaza(scraper);

            Sites.Add(crownePlaza);

            HoteldotCom hoteldotCom = new HoteldotCom(scraper);

            Sites.Add(hoteldotCom);

            Booking booking = new Booking(scraper);

            Sites.Add(booking);

            Expedia expedia = new Expedia(scraper);

            Sites.Add(expedia);
        }
コード例 #3
0
        public HDSInterfaces.HotelImage GenerateHotelImage(Expedia.HotelShoppingServiceReference.HotelImage rawImage)
        {
            HDSInterfaces.HotelImage image = new HDSInterfaces.HotelImage{
                                                                            Id           = rawImage.hotelImageId,
                                                                            Description  = rawImage.caption,
                                                                            URL          = rawImage.url,
                                                                            UrlThumbnail = rawImage.thumbnailUrl,
                                                                            Width        = (int)rawImage.width,
                                                                            Height       = (int)rawImage.height,
                                                                         };

            return image;
        }
コード例 #4
0
        public HDSInterfaces.RoomRate GenerateRoomRate(Expedia.HotelShoppingServiceReference.HotelRateInfo rawRate)
        {
            RoomRate roomRate = new RoomRate();
            roomRate.TotalRate = new Rate
            {
                CurrencyCode = rawRate.ChargeableRateInfo.currencyCode,
                SellRate = rawRate.ChargeableRateInfo.total,      //this is total include tax
            };
            //tax total
            if (rawRate.ChargeableRateInfo.surchargeTotalSpecified)
                roomRate.TotalRate.TaxAndServiceFee = rawRate.ChargeableRateInfo.surchargeTotal;

            //rate daily
            roomRate.NightlyRate = new List<Rate>();
            foreach (NightlyRate rawNightlyRate in rawRate.ChargeableRateInfo.NightlyRatesPerRoom.NightlyRate)
            {
                HDSInterfaces.Rate rate = new Rate{
                                                    SellRate            = rawNightlyRate.rate,
                                                    BaseRate            = rawNightlyRate.baseRate,
                                                    CurrencyCode        = roomRate.TotalRate.CurrencyCode,
                                                    IsPromotionIncluded = rawNightlyRate.promo
                                                 };

                roomRate.NightlyRate.Add(rate);
            }

            return roomRate;
        }