/// <summary>
        /// Determines whether the current properties for the object are valid
        /// </summary>
        /// <param name="error">Exception thrown if property is invalid</param>
        /// <returns>True if properties are valid, false if not</returns>
        protected override bool ValidateProperties(out Exception.InvalidPropertyException error)
        {
            error = null;

            if (String.IsNullOrEmpty(Name))
            {
                error = new Exception.InvalidPropertyException("PortfolioCategory.Name cannot be null");
            }

            return(error == null);
        }
        protected override bool ValidateProperties(out Exception.InvalidPropertyException error)
        {
            error = null;

            if (String.IsNullOrEmpty(Name))
            {
                error = new Exception.InvalidPropertyException("PublicAlbum.Name cannot be empty");
            }

            return(error == null);
        }
Example #3
0
        /// <summary>
        /// Determines whether the current properties for the object are valid
        /// </summary>
        /// <param name="error">Exception thrown if property is invalid</param>
        /// <returns>True if properties are valid, false if not</returns>
        protected override bool ValidateProperties(out Exception.InvalidPropertyException error)
        {
            error = null;

            if (String.IsNullOrEmpty(FirstName))
            {
                error = new Exception.InvalidPropertyException("User.FirstName cannot be empty");
            }

            if (String.IsNullOrEmpty(Surname))
            {
                error = new Exception.InvalidPropertyException("User.Surname cannot be empty");
            }

            if (String.IsNullOrEmpty(EmailAddress))
            {
                error = new Exception.InvalidPropertyException("User.EmailAddress cannot be empty");
            }

            try
            {
                System.Net.Mail.MailAddress addr = new System.Net.Mail.MailAddress(EmailAddress);
            }
            catch (System.Exception e)
            {
                error = new Exception.InvalidPropertyException("Invalid email address", e);
            }

            if (EmailAddressExists(EmailAddress))
            {
                if (IsInDatabase)
                {
                    User clone = new User(EmailAddress);

                    if (clone.UserId != UserId)
                    {
                        error = new Exception.InvalidPropertyException("EmailAddress already exists");
                    }
                }
                else
                {
                    error = new Exception.InvalidPropertyException("EmailAddress already exists");
                }
            }

            if (String.IsNullOrEmpty(Password))
            {
                error = new Exception.InvalidPropertyException("User.Password cannot be empty");
            }

            return(error == null);
        }
Example #4
0
        protected override bool ValidateProperties(out Exception.InvalidPropertyException error)
        {
            error = null;

            if (String.IsNullOrEmpty(Name))
            {
                error = new Exception.InvalidPropertyException("Error.Name property cannot be empty");
            }

            if (String.IsNullOrEmpty(Message))
            {
                error = new Exception.InvalidPropertyException("Error.Message property cannot be empty");
            }

            return(error == null);
        }
        protected override bool ValidateProperties(out Exception.InvalidPropertyException error)
        {
            error = null;

            if (Customer == null)
            {
                error = new Exception.InvalidPropertyException("Customer property cannot be null");
            }

            if (Customer.Admin)
            {
                error = new Exception.InvalidPropertyException("Cannot add an album to an Admin user");
            }

            if (String.IsNullOrEmpty(Name))
            {
                error = new Exception.InvalidPropertyException("Name property cannot be null");
            }

            return(error == null);
        }
Example #6
0
 /// <summary>
 /// Determines whether the current properties for the object are valid
 /// </summary>
 /// <param name="error">Exception thrown if property is invalid</param>
 /// <returns>True if properties are valid, false if not</returns>
 protected abstract Boolean ValidateProperties(out Exception.InvalidPropertyException error);