示例#1
0
 public Contestant  PrintContestantInfo(Contestant contestant)
 {
     UserInterface.DisplayInline(contestant.firstName);
     UserInterface.DisplayInline(contestant.lastName);
     UserInterface.DisplayInline(contestant.email);
     UserInterface.DisplayInline(contestant.registrationNumber);
     return(contestant);
 }
        private void WorkOnColleciton()
        {
            SweepStakes working = sweepstakescolleciton.GetSweepStakes();

            UserInterface.DisplayOnly("you are now working on " + working.name);
            UserInterface.DisplayInline("what would you like to do?");
            UserInterface.DisplayInline("1.Continue to add contestants.");
            string input = UserInterface.GetInputInline("Choose your selection, invalid input returns to previous menu.");

            if (input.Trim() == "1")
            {
                working.ContinueAddContestants();
            }
            sweepstakescolleciton.insertSweepstakes(working);
        }
        private void SetupHandler()
        {
            bool   correctinput = true;
            string message      = "What type of sweepstakes management will your company use? stack or queue";

            do
            {
                if (!correctinput)
                {
                    message = "Invalid handler, please try again. Stack or queue, s/q";
                }

                UserInterface.DisplayInline(message);
                correctinput = ChooseHandler(Console.ReadLine());
            } while (!correctinput);
            UserInterface.Clear();
        }
示例#4
0
        public void Notify(string[] company, string body, SmtpClient smtpClient)
        {
            MimeMessage message = new MimeMessage()
            {
                Sender  = new MailboxAddress(company[0], company[1]),
                Subject = "A winner has been chosen",
                Body    = new TextPart(TextFormat.Plain)
                {
                    Text = body
                }
            };

            message.To.Add(new MailboxAddress(email));


            smtpClient.Send(message);
            UserInterface.DisplayInline("Message was sent to " + email);
        }
        private void Runsweepstakes()
        {
            do
            {
                bool baduser = true;
                UserInterface.DisplayOnly("Welcome to the " + name + " Sweepstakes management portal");
                UserInterface.DisplayInline("Here you can create and manage sweepstakes.");
                UserInterface.DisplayInline("1.Create a new sweepstakes.");
                if (sweepstakescolleciton.Getcount() > 0)
                {
                    UserInterface.DisplayInline("2.Work on a previous sweepstake");
                    UserInterface.DisplayInline("3.Finalize and choose winner of next sweepstake");
                }

                do
                {
                    string input = UserInterface.GetInputInline("Enter choice.");
                    baduser = RunSweepstakesInput(input);
                } while (baduser);
            }while (true);
        }
        private bool ConfigEmail()
        {
            bool   output = false;
            string input  = UserInterface.GetinputClear("Will your company send emails to all contestants?");

            if (input.Trim() == "y" || input.Trim() == "yes")
            {
                string badinput = "";
                do
                {
                    output     = true;
                    company[0] = name;
                    company[1] = UserInterface.GetEmail("Enter the address the gmail address your company sends email from. This account must have less secure application acess enabled.");
                    company[2] = UserInterface.GetInputInline("enter the password associated with this acocunt.  Get it right, or you will be mad later.");
                    UserInterface.DisplayInline("");
                    UserInterface.DisplayInline(company[0]);
                    UserInterface.DisplayInline(company[1]);
                    UserInterface.DisplayInline(company[2]);
                    badinput = UserInterface.GetInputInline("are these values correct?");
                } while (badinput.Trim().ToLower() != "y" && badinput.Trim().ToLower() != "yes");
            }
            return(output);
        }