Smrf.NodeXL.ExcelTemplate.AnalyzeEmailNetworkDialog.ValidateParticipants C# (CSharp) Method

ValidateParticipants() protected method

protected ValidateParticipants ( ) : System.Boolean
return System.Boolean
    ValidateParticipants()
    {
        AssertValid();

        foreach (DataGridViewRow oRow in dgvParticipants.Rows)
        {
            if (oRow.IsNewRow)
            {
                continue;
            }

            EmailParticipantCriteria oEmailParticipantCriteria =
                DataGridViewRowToEmailParticipantCriteria(oRow);

            String sParticipant = oEmailParticipantCriteria.Participant;

            String sErrorMessage = null;

            if ( String.IsNullOrEmpty(oEmailParticipantCriteria.Participant) )
            {
                // Don't let the user check a checkbox without also specifying
                // a participant.

                if (oEmailParticipantCriteria.IncludedIn != IncludedIn.None)
                {
                    sErrorMessage = 
                        "In the list of email addresses, you checked a"
                        + " checkbox without entering an email address.  Enter"
                        + " an email address, uncheck the checkbox, or delete"
                        + " the entire row using the Delete key."
                        ;
                }
            }
            else
            {
                if ( !ValidateFilter(sParticipant) )
                {
                    sErrorMessage = 
                        "There must be at least one letter or number in an"
                        + " email address."
                        ;
                }
            }

            if (sErrorMessage != null)
            {
                dgvParticipants.CurrentCell =
                    oRow.Cells[this.colParticipant.Name];

                this.ShowWarning(sErrorMessage);

                return (false);
            }
        }

        return (true);
    }