Ejemplo n.º 1
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;
                }
            }
        }
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo 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
            //----------

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