Пример #1
0
 private void NavToPreviewEmail()
 {
     if (ValidTeam() && ValidTime() && ValidDuration() && ValidDate()) //checks valdation for the inputs
     {
         Database.EmailData.recipients = GetPlayerEmails();            //gets the email addresses for all the players
         //sets the body for the email address
         Database.EmailData.body    = "Upcoming " + InputTeam.Text.ToLower() + " training session:\n\nDate: " + InputDate.Text + "\nStart time: " + InputTimeH.Text + ":" + InputTimeM.Text + "\nDuration: " + InputDuration.Text + " minutes.\n\nThanks,\nWelsh Wanderers";;
         Database.EmailData.subject = "Training information"; //sets the subject for the email
         StaticDetails();                                     //sets input boxes to uneditable
         emailSent = true;
         new Views.PreviewEmail().Show();                     //Shows the Preview Email form
         EventPreviewEmail.Hide();                            //hides the email button
     }
 }
Пример #2
0
 private void EventPreviewEmail_Click(object sender, EventArgs e)
 {
     if (ListSelectedPlayers.Items.Count > 0) //Checks at least one player has been selected for the match
     {
         if (ValidInputs())                   //calls on another function to check inputs are valid
         {
             ShowPreviewEmail();              //calls on a function to open the Preview Email form
             emailSent = true;
             EventPreviewEmail.Hide();        //hides the email button
         }
     }
     else
     {
         MessageBox.Show("Please select players for this match.");
     }
 }
Пример #3
0
        private void ShowPreviewEmail()
        {
            emailSent = true;
            Database.EmailData.body    = MatchInfo();                      //Sets the body of the email by calling on another function
            Database.EmailData.subject = "Upcoming match";                 //Sets the subject of the email

            string[] emails = new string[ListSelectedPlayers.Items.Count]; //Creates array of length equal to number of players selected
            int      i      = 0;

            foreach (string player in ListSelectedPlayers.Items)
            {
                emails[i] = GetPlayerInfo(player, 5);   //Loops adding each player's email to the array by calling on a function to find their email
                ++i;
            }
            Database.EmailData.recipients = emails; //setting all the emails to send the email to

            //Navigating to the Preview Email form, hiding the email button
            new Views.PreviewEmail().Show();
            EventPreviewEmail.Hide();
        }