예제 #1
0
        protected override bool EvaluateIsValid()
        {
            string email = GetControlValidationValue(ControlToValidate);

            if (email.Length < 1 || email.Length > 100)
            {
                if (email.Length == 0)
                {
                    ErrorMessage = "You must enter an e-mail address.";
                }
                else
                {
                    ErrorMessage = "Your e-mail address must be between 1 and 100 characters long.";
                }
                return(false);
            }

            if (email == _allowedEmail)
            {
                return(true);
            }

            string folder;
            int    webID = WebSolutionDB.GetWebIDAndFolder(Page.Request.Url.Host, out folder);

            if (UserDB.EmailExists(email, webID))
            {
                ErrorMessage = "This e-mail is already in-use.";
                return(false);
            }

            return(true);
        }
예제 #2
0
        protected override bool EvaluateIsValid()
        {
            string alias = GetControlValidationValue(ControlToValidate);

            if (alias.Length < 1 || alias.Length > 100)
            {
                if (alias.Length == 0)
                {
                    ErrorMessage = "Please enter an alias.";
                }
                else
                {
                    ErrorMessage = "Please enter an alias between 1 and 100 characters long.";
                }
                return(false);
            }

            if (alias == _allowedAlias)
            {
                return(true);
            }

            string folder;
            int    webID = WebSolutionDB.GetWebIDAndFolder(Page.Request.Url.Host, out folder);

            if (UserDB.AliasExists(alias, webID))
            {
                ErrorMessage = "Alias already in-use.";
                return(false);
            }

            return(true);
        }
예제 #3
0
 protected virtual void Initialise()
 {
     _webID       = WebSolutionDB.GetWebIDAndFolder(Page.Request.Url.Host, out _webFolder);
     _documentID  = Convert.ToInt32(Page.Request.QueryString["DocumentID"]);
     _initialised = true;
 }