Beispiel #1
0
        //variables

        //constructor

        //method
        public void CreateMarketingFirmWithManager()
        {
            ISweepstakesManager stack         = new SweepstakesStackManager();
            ISweepstakesManager queue         = new SweepstakesQueueManager();
            MarketingFirm       marketingFirm = new MarketingFirm(queue);
            MarketingFirm       marketing     = new MarketingFirm(stack);
        }
Beispiel #2
0
 public Factory()
 {
     stackManager = new SweepstakesStackManager();
     queueManager = new SweepstakesQueueManager();
     sweepstakes  = new Sweepstakes();
     firm         = new MarketingFirm();
 }
        public static ISweepstakesManager Factory(string input)
        {
            bool ssManagerChooser           = false;
            ISweepstakesManager sweepstakes = null;

            while (ssManagerChooser == false)
            {
                switch (input)
                {
                case "queue":
                    sweepstakes      = new SweepstakesQueueManager();
                    ssManagerChooser = true;
                    break;

                case "stack":
                    sweepstakes      = new SweepstakesStackManager();
                    ssManagerChooser = true;
                    break;

                default:
                    UserInterface.DisplayText("Improper input try again...");
                    break;
                }
            }
            return(sweepstakes);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // instantiate marketing firm
            ISweepstakesManager sweepstakesManagerQueue = new SweepstakesQueueManager();
            ISweepstakesManager sweepstakesManagerStack = new SweepstakesStackManager();

            // marketting does functionality upon injection
            MarketingFirm marketingFirm = new MarketingFirm(UserInterface.StackOrQueuePrompt());;  // interchangable with sweepstakesManagerStack depending on the user's choice
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            SweepstakesQueueManager test = new SweepstakesQueueManager();

            test.GetNextSweepstakesWinner();
            SweepstakesStackManager testStack = new SweepstakesStackManager();

            testStack.GetNextSweepstakesWinner();
            Console.ReadKey();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            SweepStakes             sweepstakes  = new SweepStakes();
            Contestant              contestant   = new Contestant();
            SweepstakesQueueManager queueManager = new SweepstakesQueueManager();
            SweepstakesStackManager stackManager = new SweepstakesStackManager();

            sweepstakes.addContestant();
            sweepstakes.RegisterContestant(contestant);
            sweepstakes.PrintContestantInfo(contestant);
            queueManager.GetNextSweepstakesWinner();
            stackManager.GetNextSweepstakesWinner();
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            string managerType = UserInterface.ChooseStackOrQueue();
            ISweepstakesManager manager;

            if (managerType == "stack")
            {
                manager = new SweepstakesStackManager();
            }
            else if (managerType == "queue")
            {
                manager = new SweepstakesQueueManager();
            }
            else
            {
                return;
            }
        }
Beispiel #8
0
        public static ISweepstakesManager GetSweepstakesManager()
        {
            string dataStoreType     = UI.PickDataManagerType();
            ISweepstakesManager temp = null;

            if (dataStoreType == "queue")
            {
                SweepstakeQueueManager sweepstakeQueueManager = new SweepstakeQueueManager();
                temp = sweepstakeQueueManager;
            }
            else if (dataStoreType == "stack")
            {
                SweepstakesStackManager sweepstakesStackManager = new SweepstakesStackManager();
                temp = sweepstakesStackManager;
            }

            return(temp);
        }
Beispiel #9
0
        public ISweepstakesManager CreateSweepstakesManager(String sweepstakesType)
        {
            ISweepstakesManager newSweepstakes;

            if (sweepstakesType == "Q")
            {
                newSweepstakes = new SweepstakesQueueManager();
                return(newSweepstakes);
            }
            else if (sweepstakesType == "S")
            {
                newSweepstakes = new SweepstakesStackManager();
                return(newSweepstakes);
            }
            else
            {
                return(null);
            }
        }
Beispiel #10
0
        public static ISweepstakesManager PickManager(string manager)
        {
            ISweepstakesManager user = null;

            switch (manager)
            {
            case "stack":
                user = new SweepstakesStackManager();
                break;

            case "queue":
                user = new SweepstakesQueueManager();
                break;

            default:
                return(PickManager(User_Interface.AskForManager()));;
            }
            return(user);
        }
 public static ISweepstakesManager FactoryDecider()
 {
     ISweepstakesManager manager;
     string choice = UserInterface.GetManagerOption();
     if (choice == "stack")
     {
         manager = new SweepstakesStackManager();
         return manager;
     }
     else if (choice == "queue")
     {
         manager = new SweepstakesQueueManager();
         return manager;
     }
     else
     {
         Console.WriteLine("Not a valid option.");
         return FactoryDecider();
     }
 }
Beispiel #12
0
        public static ISweepstakesManager ManagerFactory(string choice)
        {
            ISweepstakesManager _manager = null;

            switch (choice)
            {
            case "stack":
                _manager = new SweepstakesStackManager();
                break;

            case "queue":
                _manager = new SweepstakesQueueManager();
                break;

            default:
                Console.WriteLine("Please choose a valid Option");
                ManagerFactory(choice);
                break;
            }
            return(_manager);
        }
Beispiel #13
0
        public static ISweepstakesManager PickManager()
        {
            ISweepstakesManager pickManager;
            string pick;

            do
            {
                Console.WriteLine("How would you like your sweepstakes to be managed? stack or queue?");
                pick = Console.ReadLine().ToLower();
            }while (pick != "stack" && pick != "queue");
            if (pick == "stack")
            {
                pickManager = new SweepstakesStackManager();
                return(pickManager);
            }
            else if (pick == "queue")
            {
                pickManager = new SweepstakesQueueManager();
                return(pickManager);
            }
            return(null);
        }
        public static ISweepstakesManager GetManager()
        {
            string userInput;
            ISweepstakesManager manager;

            Console.WriteLine("What kind of manager would you like to create?\n[1]Stack\n[2]Queue");
            userInput = Console.ReadLine();
            switch (userInput)
            {
            case "1":
                manager = new SweepstakesStackManager();
                break;

            case "2":
                manager = new SweepstakesQueueManager();
                break;

            default:
                DisplayErrorMessage();
                return(GetManager());
            }
            return(manager);
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            Console.WriteLine("would you like to use a stack or queue to store your sweepstakes?");
            string userInput = Console.ReadLine();
            ISweepstakesManager sweepStakesManager;


            switch (userInput)
            {
            case "queue":
                sweepStakesManager = new SweepstakesQueueManager();
                MarketingFirm MFQ = new MarketingFirm(sweepStakesManager);
                break;

            case "stack":
                sweepStakesManager = new SweepstakesStackManager();
                MarketingFirm MFS = new MarketingFirm(sweepStakesManager);
                break;

            default:
                break;
            }
        }