Example #1
0
        public ISweepStakesManager CreatingMarketingFirmWithManager()
        {
            Console.WriteLine("Would you prefer stack or queue to manage the sweepstakes. ");
            string value = Console.ReadLine();
            ISweepStakesManager manager = null;

            if (value == "Stack")
            {
                manager = new SweepStakesStackManager();
            }
            else if (value == "queue")
            {
                manager = new SweepStakesQueueManager();
            }
            return(manager);
        }
        public ISweepStakesManager GetManager(string type)
        {
            ISweepStakesManager user = null;

            switch (type)
            {
            case "Stack":
                user = new SweepStakesStackManager();
                break;

            case "Queue":
                user = new SweepStakesQueueManager();
                break;

            default:
                Console.WriteLine("Not a valid role");
                GetManager(type);
                break;
            }
            return(user);
        }
        void CreateMarketingFirmWithManager()
        {
            ISweepStakesManaager manager;

            switch (UserInterface.GetUserInput("Choose Your Manager: Stack or Queue.").ToLower())
            {
            case "stack":
                manager = new SweepStakesStackManager();
                MarketingFirm Mf = new MarketingFirm(manager);
                break;

            case "queue":
                manager = new SweepStakesQueueManager();
                Mf      = new MarketingFirm(manager);
                break;

            default:
                CreateMarketingFirmWithManager();
                break;
            }
        }
Example #4
0
        public static ISweepStakesManager GetChoiceOfManager()
        {
            string choice = UserInterface.GetUserInputFor("What kind of manager would you like to hold all of your Sweepstakes?\nType 1 for a Stack.\nType 2 for a Queue.");

            while (true)
            {
                if (choice == "1")
                {
                    SweepStakesStackManager sweepStakesStackManager = new SweepStakesStackManager();
                    return(sweepStakesStackManager);
                }
                else if (choice == "2")
                {
                    SweepStakesQueueManager sweepStakesQueueManager = new SweepStakesQueueManager();

                    return(sweepStakesQueueManager);
                }
                else
                {
                    Console.WriteLine("Invalid option, select again.");
                }
            }
        }
Example #5
0
        public void CreateMarketingFirm()
        {
            int input;

            Console.WriteLine("Press 1 for Stack management type. ");
            Console.WriteLine("Press 2 for Queue management style. ");
            input = int.Parse(Console.ReadLine());
            ISweepStakesManager manager = null;

            if (input == 1)
            {
                manager = new SweepStakesStackManager();
            }
            else if (input == 2)
            {
                manager = new SweepStakesQueueManager();
            }
            else
            {
                Console.WriteLine("Please enter a valid input. ");
                CreateMarketingFirm();
            }
            MarketingFirm marketingFirm = new MarketingFirm(manager);
        }
        public MarketingFirm(string stackorqueue) //string here for using stack or queue
        {
            ISweepstakesManager sweepstakesManager;

            switch (stackorqueue)
            {
            case "queue":
                sweepstakesManager = new SweepStakesQueueManager();
                break;

            case "stack":
                sweepstakesManager = new SweepStakesStackManager();
                break;

            default:
                return;
            }

            int choice     = 0;
            int killSwitch = 1;

            while (choice != killSwitch)
            {
                choice = UI.promptForOptions("Would you like to Add another sweepStakes?", new List <string>()
                {
                    "yes", "no"
                });

                if (choice == 0)
                {
                    Console.Write("Enter the name of the SweepStakes: ");
                    string name = Console.ReadLine();
                    sweepstakesManager.SweepStakes(name);
                }
            }

            choice = 0;

            do
            {
                SweepStakes currentSweepStakes = sweepstakesManager.GetSweepStakes();
                while (choice != killSwitch)
                {
                    Console.WriteLine($"Registering Contestants for: {currentSweepStakes.name}");
                    choice = UI.promptForOptions("Enter another Contestant?", new List <string>()
                    {
                        "yes", "no"
                    });

                    if (choice == 0)
                    {
                        Console.Write("First Name: ");
                        string firstName = Console.ReadLine();
                        Console.Write("Last Name: ");
                        string lastName = Console.ReadLine();
                        Console.Write("Email: ");
                        string email = Console.ReadLine();

                        currentSweepStakes.registerContestant(new Contestant(firstName, lastName, email));
                    }
                    if (choice == 1)
                    {
                        pickWinner(currentSweepStakes);
                    }
                }
            } while (sweepstakesManager != null);
        }