Exemplo n.º 1
0
        /// <summary>
        /// Méthode permettant de valider les chaînes de caractère,
        /// valeur null, longueur maxi, alphaonly
        /// </summary>
        /// <returns></returns>
        private bool Val_Name()
        {
            int i = 0;

            if (NameRubric == ForumBase.String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Rubric.NameRubric", "Le nom de la rubrique est requis"));
                i++;
            }
            if (NameRubric.Length > 50)
            {
                this.ValidationErrors.Add(new ValidationError("Rubric.NameRubric", "Le nom de la rubrique doit contenir 50 caractères au maximum"));
                i++;
            }
            if (!AuditTool.IsAlpha(NameRubric))
            {
                this.ValidationErrors.Add(new ValidationError("Rubric.NameRubric", "Le nom de la rubrique ne peut contenir de chiffres"));
                i++;
            }
            if (i > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Méthode permettant de valider les chaînes de caractères,
        /// valeur null, longueur maxi, alphaonly
        /// </summary>
        /// <returns></returns>
        private bool Val_Name()
        {
            int i = 0;

            if (NameUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.NameUser", "Le nom est requis"));
                i++;
            }
            else
            {
                if (NameUser.Length > 50)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.NameUser", "Le nom doit contenir 50 caractères au maximum"));
                    i++;
                }
                if (!AuditTool.IsAlpha(NameUser))
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.NameUser", "Le nom ne peut contenir de chiffres"));
                    i++;
                }
            }


            if (FirstnameUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.FirstNameUser", "Le prénom est requis"));
                i++;
            }
            else
            {
                if (FirstnameUser.Length > 50)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.FirstNameUser", "Le prénom doit contenir 50 caractères au maximum"));
                    i++;
                }
                if (!AuditTool.IsAlpha(FirstnameUser))
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.FirstNameUser", "Le prénom ne peut contenir de chiffres"));
                    i++;
                }
            }


            if (LoginUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.LoginUser", "L'identifiant est requis"));
                i++;
            }
            else
            {
                if (LoginUser.Length > 50)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.LoginUser", "L'identifiant doit contenir 50 caractères au maximum"));
                    i++;
                }
            }
            if (PwdUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.PwdUser", "Le mot de passe est requis"));
                i++;
            }
            else
            {
                if (PwdUser.Length > 50)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.PwdUser", "Le mot de passe doit contenir 50 caractères au maximum"));
                    i++;
                }
            }
            if (KeywordUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.KeywordUser", "Le mot-clé est requis"));
                i++;
            }
            else
            {
                if (KeywordUser.Length > 50)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.KeywordUser", "Le mot-clé doit contenir 50 caractères au maximum"));
                    i++;
                }
            }
            if (i > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }