Exemplo n.º 1
0
 public void NotifyContestants(Contestant contestant)
 {
     foreach (KeyValuePair <int, Contestant> entry in contestants)
     {
         if (entry.Key == contestant.RegistrationNumber)
         {
             contestant.Notify("Congrats " + entry.Value.FirstName + " " + entry.Value.LastName + " You've Won The " + name + " Sweepstakes");
         }
         else
         {
             contestant.Notify("Sorry " + entry.Value.FirstName + " " + entry.Value.LastName + " You Didn't Win The " + name + " Sweepstakes");
         }
     }
 }
Exemplo n.º 2
0
        private void MailNotify(SweepStakes sweepstakes, Contestant winner)
        {
            if (emailflag)
            {
                SmtpClient smtpClient = new MailKit.Net.Smtp.SmtpClient();
                smtpClient.Connect("smtp.gmail.com", 587, MailKit.Security.SecureSocketOptions.Auto);
                smtpClient.Authenticate(company[1], company[2]);

                foreach (Contestant loser in sweepstakes)
                {
                    if (loser.email != winner.email)
                    {
                        loser.Notify(company, winner.firstName + " has won " + sweepstakes.name, smtpClient);
                    }
                }
                winner.Notify(company, "You have won " + sweepstakes.name + ", Contact us to claim your prize.", smtpClient);
                smtpClient.Disconnect(true);
            }
        }
Exemplo n.º 3
0
        public void NotifyContestantsResults()
        {
            SweepStakes sweep  = marketingFirm._manager.GetSweepstakes();
            Contestant  winner = sweep.PickWinner();

            winner.winStatus = true;

            bool winnerPrinted = false;

            foreach (KeyValuePair <int, Contestant> contestant in sweep.contestants)
            {
                if (contestant.Value.winStatus && !winnerPrinted)
                {
                    winner.Notify(contestant.Value, winner);
                    winnerPrinted = true;
                }
                else
                {
                    contestant.Value.Notify(contestant.Value, winner);
                }
            }
        }