コード例 #1
0
ファイル: Rubric.cs プロジェクト: SebDev2I/Forum
        /// <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);
            }
        }
コード例 #2
0
ファイル: Registered.cs プロジェクト: SebDev2I/Forum
        /// <summary>
        /// Méthode permettant de vérifier le format email
        /// </summary>
        /// <returns></returns>
        private bool Val_Email()
        {
            int i = 0;

            if (EmailUser == String_NullValue)
            {
                this.ValidationErrors.Add(new ValidationError("Registered.EmailUser", "L'email est requis"));
                i++;
            }
            else
            {
                if (!AuditTool.IsEmail(EmailUser))
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.EmailUser", "L'email n'est pas valide"));
                    i++;
                }
                if (EmailUser.Length > 100)
                {
                    this.ValidationErrors.Add(new ValidationError("Registered.EmailUser", "L'email doit contenir 100 caractères au maximum"));
                    i++;
                }
            }

            if (i > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #3
0
 /// <summary>
 /// Constructeur pour mapper dto en Message
 /// </summary>
 /// <param name="dto"></param>
 /// <param name="objuser"></param>
 public Message(MessageDTO dto, Registered objuser) : this()
 {
     IdMessage      = dto.IdMessage;
     IdTopic        = dto.IdTopic;
     ObjUser        = objuser;
     DateMessage    = dto.DateMessage;
     ContentMessage = AuditTool.StringToRtf(dto.ContentMessage);
     DTO            = dto;
 }
コード例 #4
0
 /// <summary>
 /// Constructeur pour mapper dto en Topic
 /// </summary>
 /// <param name="dto"></param>
 /// <param name="objuser"></param>
 /// <param name="objrubric"></param>
 public Topic(TopicDTO dto, Registered objuser, Rubric objrubric) : this()
 {
     IdTopic    = dto.IdTopic;
     ObjUser    = objuser;
     ObjRubric  = objrubric;
     DateTopic  = dto.DateTopic;
     TitleTopic = dto.TitleTopic;
     DescTopic  = AuditTool.StringToRtf(dto.DescTopic);
     DTO        = dto;
 }
コード例 #5
0
 /// <summary>
 /// Constructeur complet
 /// </summary>
 /// <param name="idmessage"></param>
 /// <param name="idtopic"></param>
 /// <param name="objuser"></param>
 /// <param name="datemessage"></param>
 /// <param name="contentmessage"></param>
 public Message(int idmessage, int idtopic, Registered objuser, DateTime datemessage, string contentmessage) : this()
 {
     IdMessage          = idmessage;
     IdTopic            = idtopic;
     ObjUser            = objuser;
     DateMessage        = datemessage;
     ContentMessage     = AuditTool.RtfToString(contentmessage);
     DTO                = new MessageDTO();
     DTO.IdMessage      = idmessage;
     DTO.IdTopic        = idtopic;
     DTO.IdUser         = objuser.IdUser;
     DTO.DateMessage    = datemessage;
     DTO.ContentMessage = ContentMessage;
 }
コード例 #6
0
 /// <summary>
 /// Constructeur complet
 /// </summary>
 /// <param name="idtopic"></param>
 /// <param name="objuser"></param>
 /// <param name="objrubric"></param>
 /// <param name="datetopic"></param>
 /// <param name="titletopic"></param>
 /// <param name="desctopic"></param>
 public Topic(int idtopic, Registered objuser, Rubric objrubric, DateTime datetopic, string titletopic, string desctopic) : this()
 {
     IdTopic        = idtopic;
     ObjUser        = objuser;
     ObjRubric      = objrubric;
     DateTopic      = datetopic;
     TitleTopic     = titletopic;
     DescTopic      = AuditTool.RtfToString(desctopic);
     DTO            = new TopicDTO();
     DTO.IdTopic    = idtopic;
     DTO.IdUser     = objuser.IdUser;
     DTO.IdRubric   = objrubric.IdRubric;
     DTO.DateTopic  = datetopic;
     DTO.TitleTopic = titletopic;
     DTO.DescTopic  = DescTopic;
 }
コード例 #7
0
ファイル: Registered.cs プロジェクト: SebDev2I/Forum
        /// <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);
            }
        }