示例#1
0
        //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));
        }