Esempio n. 1
0
        static void Main(string[] args)
        {
            ISweepstakesManager managerProgram;
            string managerStyle = UserInterface.ChooseManagerProgram();

            managerProgram = ManagerFactory.ChooseManagerProgram(managerStyle);
            MarketingFirm bigShotMarketingFirm = new MarketingFirm(managerProgram);


            string      sweepstakesGame = "freeCandy";
            Sweepstakes sweepstakes     = new Sweepstakes(sweepstakesGame);
            Contestant  c1 = new Contestant("Luke", "F", "*****@*****.**");
            Contestant  c2 = new Contestant("Jon", "Doe", "*****@*****.**");
            Contestant  c3 = new Contestant("Jane", "Doe", "*****@*****.**");

            sweepstakes.RegisterContestant(c1);
            sweepstakes.RegisterContestant(c2);
            sweepstakes.RegisterContestant(c3);

            Console.WriteLine("\n");
            UserInterface.PrintContestantUI(c1);
            UserInterface.PrintContestantUI(c2);
            UserInterface.PrintContestantUI(c3);
            Console.WriteLine(sweepstakes.dictionaryContestant.Count);
            Console.ReadLine();
            sweepstakes.PickWinner();
            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string      name        = "mike";
            Sweepstakes sweepstakes = new Sweepstakes(name);
            Contestant  contestant  = new Contestant();

            contestant.emailAddress = "*****@*****.**";
            contestant.firstName    = "Mike";
            contestant.lastName     = "Jordan";
            sweepstakes.RegisterContestant(contestant);
            Contestant contestant1 = new Contestant();

            contestant1.emailAddress = "*****@*****.**";
            contestant1.firstName    = "PaHoua";
            contestant1.lastName     = "Lee";
            sweepstakes.RegisterContestant(contestant1);
            Contestant contestant2 = new Contestant();

            contestant2.emailAddress = "*****@*****.**";
            contestant2.firstName    = "Mai";
            contestant2.lastName     = "Chang";
            sweepstakes.RegisterContestant(contestant2);

            string winner = sweepstakes.PickWinner();

            Console.WriteLine("1st " + winner);
            winner = sweepstakes.PickWinner();
            Console.WriteLine("2nd " + winner);
            winner = sweepstakes.PickWinner();
            Console.WriteLine("3rd " + winner);

            sweepstakes.PrintContestantInfo(contestant);
            sweepstakes.PrintContestantInfo(contestant1);
            sweepstakes.PrintContestantInfo(contestant2);


            sweepstakes.NotifyEachContestants();
            sweepstakes.NotifyWinnerEmail(contestant);

            Console.ReadLine();

            Contestant contestant3 = new Contestant();

            contestant3.firstName = UserInterface.FirstName();
            Console.ReadLine();
            contestant3.lastName = UserInterface.LastName();
            Console.ReadLine();
            contestant3.emailAddress = UserInterface.EmailAddress();
            Console.ReadLine();

            UserInterface.DisplayConstestantInfo(contestant3);

            string user = UserInterface.PickSweepstakesTypeManager(); //variable to store input of manager type

            Console.ReadLine();
        }
Esempio n. 3
0
        public void RegisterAContestant(Random rng)
        {
            if (listOfSweeps.Count < 1)
            {
                return;
            }
            //Which sweepstakes?
            string userInput;

            UserInterface.DisplaySweeps(listOfSweeps);
            userInput = UserInterface.GetUserInputFor("Which sweepstakes would you like to register a contestant for?\n\nType 'cancel' to cancel...");
            while (activeSweep == null && userInput != "cancel")
            {
                for (int i = 0; i < listOfSweeps.Count; i++)
                {
                    if (listOfSweeps[i].Name == userInput)
                    {
                        activeSweep = listOfSweeps[i];
                    }
                }
                if (activeSweep == null)
                {
                    UserInterface.DisplaySweeps(listOfSweeps);
                    userInput = UserInterface.GetUserInputFor("Which sweepstakes would you like to register a contestant for?\n\nType 'cancel' to cancel...");
                }
            }
            if (userInput == "cancel")
            {
                return;
            }
            //Ask if you would like to manually add one or generate random contestants
            do
            {
                userInput = UserInterface.DisplayMenu("What would you like to do?\n\na) Add one contestant\nb) Generate 50 random contestants\nc) Done registering contestants");
                if (Comparer <string> .Default.Compare(userInput, "a") == 0)
                {
                    //Manually add one contestant
                    string     firstName     = UserInterface.GetUserInputFor("What is the contestant's first name?");
                    string     lastName      = UserInterface.GetUserInputFor("What is the contestant's last name?");
                    string     emailAddress  = UserInterface.GetUserInputFor("What is the contestant's email address?");
                    Contestant newContestant = new Contestant(firstName, lastName, emailAddress, idIncrementer++);
                    activeSweep.RegisterContestant(newContestant);
                }
                if (Comparer <string> .Default.Compare(userInput, "b") == 0)
                {
                    RegisterRandomContestants(rng);
                }
            } while (Comparer <string> .Default.Compare(userInput, "c") != 0);
            activeSweep = null;
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Simulation    simulation       = new Simulation();
            MarketingFirm marketingFirmOne = simulation.CreateMarketingFirmWithManager();
            //Sweepstakes winCruise = marketingFirmOne.CreateSweepstake();
            Sweepstakes winNewHouse = marketingFirmOne.CreateSweepstake();

            //marketingFirmOne.Manager.InsertSweepstakes(winCruise);
            marketingFirmOne.Manager.InsertSweepstakes(winNewHouse);
            //winCruise.RegisterContestant();
            winNewHouse.RegisterContestant();
            //winCruise.RegisterContestant();
            winNewHouse.RegisterContestant();
            //winNewHouse.RegisterContestant();
            //winNewHouse.RegisterContestant();
            //Contestant winner = winCruise.PickWinner();
            //Contestant otherWinner = winNewHouse.PickWinner();
            //Console.WriteLine(winner.registrationNumber);
            winNewHouse.Notify();


            Console.ReadLine();
        }
Esempio n. 5
0
        public void SetupSweepstake(Sweepstakes sweepstake)
        {
            for (int i = 0; i < sweepstake.maxNumber; i++)
            {
                Contestant newContestant = new Contestant();

                UserInterface.NewLine();
                Console.WriteLine("Welcome to the " + sweepstake.name + " Sweepstakes!");
                UserInterface.NewLine();

                Console.WriteLine("Contestant #" + (i + 1) + ", Please enter your name and email address.");
                sweepstake.RegisterContestant(newContestant);
                sweepstake.contestNameDict.Add(newContestant.RegistrationNum, (newContestant.FirstName + " " + newContestant.LastName));
                sweepstake.contestEmailDict.Add(newContestant.RegistrationNum, newContestant.EmailAddress);
            }
        }
Esempio n. 6
0
 public void UpdateSweepstakes()
 {
     for (int i = 0; i < numberOfSweepstakes; i++)
     {
         Sweepstakes currentSweep = GetSweepstakes();
         bool        updateSweep  = UI.UpdateCurrentSweepBool(currentSweep);
         if (updateSweep)
         {
             int newContestants = UI.NewContestants(currentSweep);
             for (int j = 0; j < newContestants; j++)
             {
                 Contestant newContestant = new Contestant();
                 currentSweep.RegisterContestant(newContestant);
             }
             PickWinners(currentSweep);
         }
     }
 }
Esempio n. 7
0
 public void AddContestant()
 {
     currentSweepstakes.RegisterContestant(UI.ContestantSetUp());
 }