예제 #1
0
        /// <summary>
        /// Send a Mail Blast to the mailing list
        /// Reference:
        /// </summary>
        /// <param name="sweepstake"></param>
        public void SendMailBlast(Sweepstake sweepstake)
        {
            Console.WriteLine("Preparing to send e-mail blast!");
            string emailSmtpServer   = UserInterface.ShowPrompt("Enter an SMTP server e.g. smtp.gmail.com:");
            string emailUserName     = UserInterface.ShowPrompt("Enter e-mail username: "******"Enter e-mail password: "******"Winner! You win the " + sweepstake.GetSweepstakeName();

            emailMessage.Body = "You are the winner " + currentWinner.firstName;

            smtpServer.Port        = 587;
            smtpServer.Credentials = new NetworkCredential(emailUserName, emailUserPassword);
            smtpServer.EnableSsl   = true;

            smtpServer.Send(emailMessage);
        }
예제 #2
0
        /// <summary>
        /// A marketing and promotions method to bring in cash to the casino
        /// </summary>
        /// <param name="sweepstake"></param>
        private void PromoteSweepstake(Sweepstake sweepstake)
        {
            UserInterface.ShowDrawingWinner();
            sweepstake.PickWinner();

            UserInterface.ShowWinnerAnnouncement();
            Console.WriteLine(sweepstake.GetSweepstakeName());
            sweepstake.PrintContestantInfo(sweepstake.GetContestantWinner());

            UserInterface.ShowMailingList();
            SendMailBlast(sweepstake);
        }
예제 #3
0
        /// <summary>
        /// Show the alert to the contestants
        /// </summary>
        /// <param name="sweepstake"></param>
        public void AlertContestants(Sweepstake sweepstake)
        {
            foreach (KeyValuePair <int, Contestant> contestant in sweepstake.GetSweepstakeContestants())
            {
                bool isContestantWinner;
                isContestantWinner = contestant.Value == sweepstake.GetContestantWinner();

                if (isContestantWinner)
                {
                    UserInterface.ShowLooser();
                }
                else
                {
                    UserInterface.ShowWinner();
                }
            }
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private Sweepstake CreateSweepstake()
        {
            bool       isCreateMoreSweepstakes = true;
            Sweepstake nextSweepstake          = new Sweepstake(UserInterface.ShowPrompt("Enter a sweepstake name: "));

            UserInterface.ShowContestantCreation();
            while (isCreateMoreSweepstakes)
            {
                Contestant newContestant = new Contestant();
                nextSweepstake.RegisterContestant(newContestant);

                string sweepstakeChoice;
                sweepstakeChoice = UserInterface.ShowPrompt("Add more contestants? Y/N: ");

                if (sweepstakeChoice.Equals("N") || sweepstakeChoice.Equals("n"))
                {
                    isCreateMoreSweepstakes = false;
                }
            }
            return(nextSweepstake);
        }
 public void InsertSweepstakes(Sweepstake sweepstake)
 {
     sweepStakeDatabase.Enqueue(sweepstake);
 }
 public void InsertSweepstakes(Sweepstake sweepstake)
 {
     sweepStakeDatabase.Push(sweepstake);
 }