예제 #1
0
            //customizing the default activity validation
            public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
            {
                // Create a new collection for storing the validation errors
                ValidationErrorCollection validationErrors = base.ValidateProperties(manager, obj);


                SendEmailActivity activity = obj as SendEmailActivity;

                if (activity != null)
                {
                    // Validate the Email and SMTP Properties
                    this.ValidateEmailProperties(validationErrors, activity);
                    this.ValidateSMTPProperties(validationErrors, activity);
                }
                return(validationErrors);
            }
예제 #2
0
        private void ValidateSMTPProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
        {
            // Validate the SMTPHost property
            if (String.IsNullOrEmpty(activity.SmtpHost))
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.SmtpHostProperty.Name));
            }

            // Validate the Port property
            if (activity.Port == 0)
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.PortProperty.Name));
            }
            else if (activity.Port < 1)
            {
                validationErrors.Add(new ValidationError("Invalid Port Number",
                    InvalidSMTPPort, false, SendEmailActivity.PortProperty.Name));
            }
        }
예제 #3
0
        private void ValidateEmailProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
        {
            // Validate the To property
            if (String.IsNullOrEmpty(activity.To))
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.ToProperty.Name));

            }
            else if (!activity.To.Contains("@"))
            {
                validationErrors.Add(new ValidationError("Invalid To e-mail address", InvalidToAddress, false, SendEmailActivity.ToProperty.Name));

            }

            // Validate the From property
            if (String.IsNullOrEmpty(activity.From))
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.FromProperty.Name));
            }
            else if (!activity.From.Contains("@"))
            {
                validationErrors.Add(new ValidationError("Invalid From e-mail address", InvalidFromAddress, false, SendEmailActivity.FromProperty.Name));

            }
        }
예제 #4
0
            private void ValidateSMTPProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
            {
                // Validate the SMTPHost property
                if (String.IsNullOrEmpty(activity.SmtpHost))
                {
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.SmtpHostProperty.Name));
                }

                // Validate the Port property
                if (activity.Port == 0)
                {
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.PortProperty.Name));
                }
                else if (activity.Port < 1)
                {
                    validationErrors.Add(new ValidationError("Invalid Port Number",
                                                             InvalidSMTPPort, false, SendEmailActivity.PortProperty.Name));
                }
            }
예제 #5
0
            private void ValidateEmailProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
            {
                // Validate the To property
                if (String.IsNullOrEmpty(activity.To))
                {
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.ToProperty.Name));
                }
                else if (!activity.To.Contains("@"))
                {
                    validationErrors.Add(new ValidationError("Invalid To e-mail address", InvalidToAddress, false, SendEmailActivity.ToProperty.Name));
                }

                // Validate the From property
                if (String.IsNullOrEmpty(activity.From))
                {
                    validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.FromProperty.Name));
                }
                else if (!activity.From.Contains("@"))
                {
                    validationErrors.Add(new ValidationError("Invalid From e-mail address", InvalidFromAddress, false, SendEmailActivity.FromProperty.Name));
                }
            }