Exemplo n.º 1
0
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();


            //----------
            //YOUR CODE - set up everything

            List <ITravelAgency> TravelAgencies = new List <ITravelAgency>
            {
                new PolandTravel(accomodationData, tripsData, photosData, reviewData, rd),
                new ItalyTravel(accomodationData, tripsData, photosData, reviewData, rd),
                new FranceTravel(accomodationData, tripsData, photosData, reviewData, rd)
            };

            List <IAdvertising> AdvertisingAgencies = new List <IAdvertising>
            {
                new TextAdvertisingAgency(TravelAgencies, rd),
                new GraphicAdvertisingAgency(TravelAgencies, rd)
            };

            OfferWebsite offerWebsite = new OfferWebsite(AdvertisingAgencies, rd);



            //----------

            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                offerWebsite.GetNewOffers();
                //----------

                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();



            //----------
            //YOUR CODE - set up everything
            ITravelAgency polandTravelAgency = new PolandTravel(new TravelAgency(accomodationData, reviewData, photosData, tripsData), tripsData);
            ITravelAgency italyTravelAgency  = new ItalyTravel(new TravelAgency(accomodationData, reviewData, photosData, tripsData), tripsData);
            ITravelAgency franceTravelAgency = new FranceTravel(new TravelAgency(accomodationData, reviewData, photosData, tripsData), tripsData);
            Random        random             = new Random();

            //----------

            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                IAdvertisingAgency textAdvertisingAgency = new TextAdvertisingAgency();
                textAdvertisingAgency.CreateOffer(polandTravelAgency, 2, true, random.Next(1, 5));
                textAdvertisingAgency.CreateOffer(italyTravelAgency, 3, false, -1);
                textAdvertisingAgency.CreateOffer(franceTravelAgency, 2, true, random.Next(1, 5));
                IAdvertisingAgency graphicalAdvertisingAgency = new GraphicalAdvertisingAgency();
                graphicalAdvertisingAgency.CreateOffer(polandTravelAgency, 2, false, -1);
                graphicalAdvertisingAgency.CreateOffer(italyTravelAgency, 2, true, random.Next(1, 5));
                graphicalAdvertisingAgency.CreateOffer(franceTravelAgency, 2, true, random.Next(1, 5));

                IOfferWebsite offerWebsite = new OfferWebsite();
                offerWebsite.AddAgency(textAdvertisingAgency);
                offerWebsite.AddAgency(graphicalAdvertisingAgency);
                //----------

                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
Exemplo n.º 3
0
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();

            //----------
            //YOUR CODE - set up everything
            ITravelAgency[] travelAgencies =
            {
                new PolandTravel(accomodationData, reviewData, photosData, tripsData, rd),
                new ItalyTravel(accomodationData,  reviewData, photosData, tripsData, rd),
                new FranceTravel(accomodationData, reviewData, photosData, tripsData, rd)
            };

            IAdvertisingAgency[] advertisingAgencies = { new GraphicOffersAgency(1, 3), new TextOffersAgency(2, 2) };
            //----------

            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                OfferWebsite offerWebsite = new OfferWebsite();

                for (int i = 1; i <= WebsitePermanentOfferCount; i++)
                {
                    offerWebsite.AddOffer(advertisingAgencies[rd.Next(0, 2)].CreatePermanentOffer(travelAgencies[rd.Next(0, 3)]));
                }

                for (int i = 1; i <= WebsiteTemporaryOfferCount; i++)
                {
                    offerWebsite.AddOffer(advertisingAgencies[rd.Next(0, 2)].CreateTemporaryOffer(travelAgencies[rd.Next(0, 3)]));
                }
                //----------

                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
Exemplo n.º 4
0
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();

            //----------
            //YOUR CODE - set up everything
            PolandTravel         hehe           = new PolandTravel(accomodationData, reviewData, photosData, tripsData);
            FranceTravel         hihi           = new FranceTravel(accomodationData, reviewData, photosData, tripsData);
            ItalyTravel          hoho           = new ItalyTravel(accomodationData, reviewData, photosData, tripsData);
            List <ITravelAgency> travelAgencies = new List <ITravelAgency>();

            travelAgencies.Add(hehe);
            travelAgencies.Add(hihi);
            travelAgencies.Add(hoho);
            GraphicAdvertisingAgency  kuryszatan          = new GraphicAdvertisingAgency(travelAgencies, 2, 2);
            TextAdvertisingAgency     tpn25spychacz       = new TextAdvertisingAgency(travelAgencies, 3, 2);
            GraphicAdvertisingAgency  bialymongol         = new GraphicAdvertisingAgency(travelAgencies, 6, 1);
            TextAdvertisingAgency     elektrycznywegorz   = new TextAdvertisingAgency(travelAgencies, 4, 1);
            List <IAdvertisingAgency> advertisingAgencies = new List <IAdvertisingAgency>();

            advertisingAgencies.Add(kuryszatan);
            advertisingAgencies.Add(tpn25spychacz);
            advertisingAgencies.Add(bialymongol);
            advertisingAgencies.Add(elektrycznywegorz);
            //----------

            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                //----------
                OfferWebsite offerWebsite = new OfferWebsite(advertisingAgencies, WebsiteTemporaryOfferCount, WebsitePermanentOfferCount);
                offerWebsite.PrepareOffers();

                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
Exemplo n.º 5
0
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();

            //----------
            //YOUR CODE - set up everything
            TakingElement taker = new TakingElement(accomodationData, tripsData, photosData, reviewData);
            Agency        pl    = new AgencyPL(new FactoryPL(taker), new Random(rd.Next(1, 10086)));
            Agency        fr    = new AgencyFR(new FactoryFR(taker), new Random(rd.Next(1, 10086)));
            Agency        it    = new AgencyIT(new FactoryIT(taker), new Random(rd.Next(1, 10086)));

            OfferWebsite offerWebsite = new OfferWebsite(WebsiteTemporaryOfferCount, WebsitePermanentOfferCount);

            offerWebsite.AddAgc(pl);
            offerWebsite.AddAgc(fr);
            offerWebsite.AddAgc(it);
            offerWebsite.AddOffers();
            //----------

            while (true)
            {
                Console.Clear();
                //----------
                //YOUR CODE - run
                //----------

                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();

                if (HandleInput())
                {
                    break;
                }
            }
            Console.ReadLine();
        }
Exemplo n.º 6
0
        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();


            OfferWebsite offerWebsite;

            AdvertisingAgency[] advertisingAgencies =
            {
                new AdvertisingTextAgency(2,    2),
                new AdvertisingTextAgency(1,    2),
                new AdvertisingGraphicAgency(3, 1),
                new AdvertisingGraphicAgency(4, 3)
            };

            ITravelAgency[] travelAgencies =
            {
                new PolandTravelAgency(accomodationData, reviewData, photosData, tripsData),
                new ItalyTravelAgency(accomodationData,  reviewData, photosData, tripsData),
                new FranceTravelAgency(accomodationData, reviewData, photosData, tripsData)
            };

            while (true)
            {
                Console.Clear();


                offerWebsite = new OfferWebsite();
                AdvertisingAgency tmpAdvertisingAgency;
                ITravelAgency     tmpTravelAgency;

                for (int i = 0; i < WebsitePermanentOfferCount; i++)
                {
                    tmpAdvertisingAgency = advertisingAgencies[rd.Next() % advertisingAgencies.Length];
                    tmpTravelAgency      = travelAgencies[rd.Next() % travelAgencies.Length];
                    offerWebsite.AddOffer(tmpAdvertisingAgency.CreateOffer(tmpTravelAgency, false));
                }

                for (int i = 0; i < WebsiteTemporaryOfferCount; i++)
                {
                    tmpAdvertisingAgency = advertisingAgencies[rd.Next() % advertisingAgencies.Length];
                    tmpTravelAgency      = travelAgencies[rd.Next() % travelAgencies.Length];
                    offerWebsite.AddOffer(tmpAdvertisingAgency.CreateOffer(tmpTravelAgency, true));
                }

                offerWebsite.Present();
                offerWebsite.Present();
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
Exemplo n.º 7
0
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();


            //----------
            //YOUR CODE - set up everything
            OfferWebsite              offerWebsite        = new OfferWebsite();
            List <ITravelAgency>      travelAgencies      = new List <ITravelAgency>();
            List <IAdvertisingAgency> advertisingAgencies = new List <IAdvertisingAgency>();

            travelAgencies.Add(new PolandTravelAgency(rd, photosData, reviewData, accomodationData, tripsData));
            travelAgencies.Add(new ItalyTravelAgency(rd, photosData, reviewData, accomodationData, tripsData));
            travelAgencies.Add(new FranceTravelAgency(rd, photosData, reviewData, accomodationData, tripsData));
            for (int i = 0; i < WebsitePermanentOfferCount + WebsiteTemporaryOfferCount; ++i)
            {
                switch (rd.Next(1, 3))
                {
                case 1:
                    advertisingAgencies.Add(new GraphicAdvertisingAgency(rd, rd.Next(3, 7), rd.Next(1, 5), travelAgencies));
                    break;

                case 2:
                    advertisingAgencies.Add(new TextAdvertisingAgency(rd, rd.Next(3, 7), rd.Next(1, 5), travelAgencies));
                    break;
                }
            }
            for (int i = 0; i < WebsitePermanentOfferCount; ++i)
            {
                offerWebsite.AddOffer(advertisingAgencies[i].CreatePermanentTripOffer());
            }
            for (int i = 0; i < WebsiteTemporaryOfferCount; ++i)
            {
                offerWebsite.AddOffer(advertisingAgencies[i + WebsitePermanentOfferCount].CreateTemporaryTripOffer());
            }
            //----------

            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                //----------

                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }
Exemplo n.º 8
0
        //----------
        //YOUR CODE - additional fileds/properties/methods
        //----------

        public void Run()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            (
                BookingDatabase accomodationData,
                TripAdvisorDatabase tripsData,
                ShutterStockDatabase photosData,
                OysterDatabase reviewData
            ) = Init.Init.Run();


            //----------
            //YOUR CODE - set up everything
            //----------

            IAdvertisingAgency[] adAgencies = new IAdvertisingAgency[] {
                new GraphicsAgency(2, 4),
                new GraphicsAgency(3, 3),
                new GraphicsAgency(4, 2),
                new TextAgency(6, 3),
                new TextAgency(2, 2),
                new TextAgency(1, 5),
            };

            ITravelAgency[] travelAgencies = new ITravelAgency[] {
                new FranceTravel(accomodationData, photosData, tripsData, reviewData, rd),
                new PolandTravel(accomodationData, photosData, tripsData, reviewData, rd),
                new ItalyTravel(accomodationData, photosData, tripsData, reviewData, rd),
            };


            while (true)
            {
                Console.Clear();

                //----------
                //YOUR CODE - run
                //----------

                IWebsite offerWebsite = new OfferWebsite();

                IAdvertisingAgency adAgency;

                ITravelAgency travelAgency;


                for (int i = 0; i < WebsitePermanentOfferCount; i++)
                {
                    adAgency     = adAgencies[rd.Next(0, adAgencies.Length)];
                    travelAgency = travelAgencies[rd.Next(0, travelAgencies.Length)];
                    offerWebsite.AddOffer(adAgency.PrepareOffer(travelAgency));
                }

                for (int i = 0; i < WebsiteTemporaryOfferCount; i++)
                {
                    adAgency     = adAgencies[rd.Next(0, adAgencies.Length)];
                    travelAgency = travelAgencies[rd.Next(0, travelAgencies.Length)];
                    offerWebsite.AddOffer(adAgency.PrepareTemporaryOffer(travelAgency));
                }


                //uncomment
                Console.WriteLine("\n\n=======================FIRST PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================SECOND PRESENT======================");
                offerWebsite.Present();
                Console.WriteLine("\n\n=======================THIRD PRESENT======================");
                offerWebsite.Present();


                if (HandleInput())
                {
                    break;
                }
            }
        }