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(); }
public static void Main(string[] args) { Sweepstakes sweepstakes = new Sweepstakes("testSweepstakes"); Contestant testContestant1 = new Contestant(); testContestant1.firstName = "nate"; Contestant testContestant2 = new Contestant(); testContestant2.firstName = "mike"; Contestant testContestant3 = new Contestant(); testContestant3.firstName = "nevin"; sweepstakes.contestants.Add(1, testContestant1); sweepstakes.contestants.Add(2, testContestant2); sweepstakes.contestants.Add(3, testContestant3); Contestant winner = sweepstakes.PickWinner(); Console.WriteLine(winner); Console.ReadLine(); sweepstakes.PrintContestantInfo(testContestant1); //SweepstakesQueueManager thing = new SweepstakesQueueManager(); //SweepstakesStackManager thing1 = new SweepstakesStackManager(); string managerType = UserInterface.GetSweepstakesManagerType(); ISweepstakesManager newManager = SweepstakesFactory.SelectSweepstakesManager(managerType); MarketingFirm marketingFirm = new MarketingFirm(newManager); }
public void EndSweepstakes() { Sweepstakes finishedSweepstakes = sweepstakesManager.GetSweepstakes(); Contestant winner = finishedSweepstakes.PickWinner(); finishedSweepstakes.PrintContestantInfo(winner); }
public void Run() { Sweepstakes ss = GetSweepstakes(); Contestant winner = ss.PickWinner(); ss.PrintContestantInfo(winner); }
public void PickWinners(Sweepstakes currentSweep) { bool pickwinner = UI.AskPickWinner(currentSweep); if (pickwinner) { Contestant winner = currentSweep.PickWinner(); currentSweep.PrintContestantInfo(winner); Console.ReadLine(); //AlertResults(currentSweep, winner); Console.Clear(); } }
public void PickAWinner(Random rng) { if (listOfSweeps.Count < 1) { return; } //Which sweepstakes? UserInterface.DisplaySweeps(listOfSweeps); string userInput = UserInterface.GetUserInputFor("Which sweepstakes would you like to pick a winner 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]; activeSweep = _manager.GetSweepstakes(userInput); } } if (activeSweep == null) { UserInterface.DisplaySweeps(listOfSweeps); userInput = UserInterface.GetUserInputFor("Which sweepstakes would you like to pick a winner for?\n\nType 'cancel' to cancel..."); } } if (userInput == "cancel") { return; } bool isEmpty = activeSweep.CheckIfContestantsIsEmpty(); //Randomly generate int to pick contestant from dictionary based on their key if (isEmpty == false) { sweepWinner = activeSweep.PickWinner(rng); } else { UserInterface.DisplayContestantsIsEmptyError(); Console.ReadKey(); Console.Clear(); return; } activeSweep.PrintContestantInfo(sweepWinner); //Notify all contestants of their win/loss //Integrate the mailAPI activeSweep.SendEmailToWinner(sweepWinner); activeSweep.SendEmailToLosers(); activeSweep = null; }