コード例 #1
0
        public void SendEmails(bool withGuests)
        {
            ValidateEmail ve = new ValidateEmail();

            if (host == null || host.Length == 0)
            {
                MessageBox.Show("Please add an SMTP host. Can be a server name or an IP address.");
            }
            else if (subject == null || subject.Length == 0)
            {
                MessageBox.Show("Please add a subject");
            }
            else if ((prefixText == null || prefixText.Length == 0) && (postfixText == null || postfixText.Length == 0))
            {
                MessageBox.Show("Please add a message to your members. It can come before or after the list of names, or both.");
            }
            else if (senderEmail == null || !ve.IsValidEmail(senderEmail))
            {
                MessageBox.Show("Please add a valid sender email address.");
            }
            else if (organizerEmails == null || organizerEmails.Length == 0) //TODO: validated organizer emails
            {
                MessageBox.Show("Please add an organizer email address. (Likely the same as your sender, can be more than one.)");
            }
            else
            {
                smtp.Host = host;
                BuildEmails(withGuests);
                SaveFile();
                MessageBox.Show("Emails sent!");
            }
        }
コード例 #2
0
        public void EditGuest()
        {
            ValidateEmail ve = new ValidateEmail();

            if (name.Length == 0)
            {
                MessageBox.Show("Please enter a name.");
            }
            else if (!ve.IsValidEmail(email))
            {
                MessageBox.Show("Please enter a valid email.");
            }
            else if (phoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid phone number");
            }
            else if (adminName.Length == 0)
            {
                MessageBox.Show("Please enter an admin name.");
            }
            else if (!ve.IsValidEmail(adminEmail))
            {
                MessageBox.Show("Please enter a valid admin email.");
            }
            else if (adminPhoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid admin phone number");
            }
            else
            {
                LunchClubGuest em = file.guests.First(m => m.name.Equals(editGuest.name));
                em.name             = this.name;
                em.email            = this.email;
                em.phoneNumber      = this.phoneNumber;
                em.diet             = this.diet;
                em.adminName        = this.adminName;
                em.adminEmail       = this.adminEmail;
                em.adminPhoneNumber = this.adminPhoneNumber;

                file.Save();
                OnRequestClose(null);
            }
        }
コード例 #3
0
        public void AddGuest()
        {
            ValidateEmail ve = new ValidateEmail();

            if (name.Length == 0)
            {
                MessageBox.Show("Please enter a name.");
            }
            else if (!ve.IsValidEmail(email))
            {
                MessageBox.Show("Please enter a valid email.");
            }
            else if (phoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid phone number");
            }
            else if (adminName.Length == 0)
            {
                MessageBox.Show("Please enter an admin name.");
            }
            else if (!ve.IsValidEmail(adminEmail))
            {
                MessageBox.Show("Please enter a valid admin email.");
            }
            else if (adminPhoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid admin phone number");
            }
            else if (file.guests.FirstOrDefault(m => m.name.Equals(name)) != null)
            {
                MessageBox.Show("Member already exists under this name. If this is a new person, add a middle initial or department.");
            }
            else
            {
                file.guests.Add(new LunchClubGuest {
                    name = this.name, phoneNumber = this.phoneNumber, email = this.email, diet = this.diet, adminEmail = this.adminEmail, adminName = this.adminName, adminPhoneNumber = this.adminPhoneNumber
                });
                file.Save();
                OnRequestClose(null);
            }
        }
コード例 #4
0
 public void AddGuest()
 {
     ValidateEmail ve = new ValidateEmail();
     if (name.Length == 0)
     {
         MessageBox.Show("Please enter a name.");
     }
     else if (!ve.IsValidEmail(email))
     {
         MessageBox.Show("Please enter a valid email.");
     }
     else if (phoneNumber.Length < 5)
     {
         MessageBox.Show("Please enter a valid phone number");
     }
     else if (adminName.Length == 0)
     {
         MessageBox.Show("Please enter an admin name.");
     }
     else if (!ve.IsValidEmail(adminEmail))
     {
         MessageBox.Show("Please enter a valid admin email.");
     }
     else if (adminPhoneNumber.Length < 5)
     {
         MessageBox.Show("Please enter a valid admin phone number");
     }
     else if (file.guests.FirstOrDefault(m => m.name.Equals(name)) != null)
     {
         MessageBox.Show("Member already exists under this name. If this is a new person, add a middle initial or department.");
     }
     else
     {
         file.guests.Add(new LunchClubGuest { name = this.name, phoneNumber = this.phoneNumber, email = this.email, diet = this.diet, adminEmail = this.adminEmail, adminName = this.adminName, adminPhoneNumber = this.adminPhoneNumber });
         file.Save();
         OnRequestClose(null);
     }
 }
コード例 #5
0
        public void SendEmails(bool withGuests)
        {
            ValidateEmail ve = new ValidateEmail();

            if(host == null || host.Length == 0)
            {
                MessageBox.Show("Please add an SMTP host. Can be a server name or an IP address.");
            }
            else if (subject == null || subject.Length == 0)
            {
                MessageBox.Show("Please add a subject");
            }
            else if ((prefixText == null || prefixText.Length == 0) && (postfixText == null || postfixText.Length == 0))
            {
                MessageBox.Show("Please add a message to your members. It can come before or after the list of names, or both.");
            }
            else if (senderEmail == null || !ve.IsValidEmail(senderEmail))
            {
                MessageBox.Show("Please add a valid sender email address.");
            }
            else if (organizerEmails == null || organizerEmails.Length == 0) //TODO: validated organizer emails
            {
                MessageBox.Show("Please add an organizer email address. (Likely the same as your sender, can be more than one.)");
            }
            else
            {
                smtp.Host = host;
                BuildEmails(withGuests);
                SaveFile();
                MessageBox.Show("Emails sent!");
            }
        }
コード例 #6
0
        public void EditGuest()
        {
            ValidateEmail ve = new ValidateEmail();

            if (name.Length == 0)
            {
                MessageBox.Show("Please enter a name.");
            }
            else if (!ve.IsValidEmail(email))
            {
                MessageBox.Show("Please enter a valid email.");
            }
            else if (phoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid phone number");
            }
            else if (adminName.Length == 0)
            {
                MessageBox.Show("Please enter an admin name.");
            }
            else if (!ve.IsValidEmail(adminEmail))
            {
                MessageBox.Show("Please enter a valid admin email.");
            }
            else if (adminPhoneNumber.Length < 5)
            {
                MessageBox.Show("Please enter a valid admin phone number");
            }
            else
            {

                LunchClubGuest em = file.guests.First(m => m.name.Equals(editGuest.name));
                em.name = this.name;
                em.email = this.email;
                em.phoneNumber = this.phoneNumber;
                em.diet = this.diet;
                em.adminName = this.adminName;
                em.adminEmail = this.adminEmail;
                em.adminPhoneNumber = this.adminPhoneNumber;

                file.Save();
                OnRequestClose(null);
            }
        }