/// ////////////////////////////////////////////
        public CRelationTypeEntreeAgenda_TypeElementAAgenda GetRelationTypeElement(CTypeEntreeAgenda typeEntree)
        {
            int nId = Int32.Parse(NomPropriete);

            foreach (CRelationTypeEntreeAgenda_TypeElementAAgenda rel in typeEntree.RelationsTypeElementsAAgenda)
            {
                if (rel.Id == nId)
                {
                    return(rel);
                }
                if (rel.Libelle.ToUpper() == Nom.ToUpper())
                {
                    return(rel);
                }
            }
            return(null);
        }
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            NettoieFormulesLienEtChamps();
            int nIdTypeEntree = -1;

            if (TypeEntree != null)
            {
                nIdTypeEntree = TypeEntree.Id;
            }
            serializer.TraiteInt(ref nIdTypeEntree);
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                if (nIdTypeEntree != -1)
                {
                    CTypeEntreeAgenda typeEntree = new CTypeEntreeAgenda((CContexteDonnee)serializer.GetObjetAttache(typeof(CContexteDonnee)));
                    if (typeEntree.ReadIfExists(nIdTypeEntree))
                    {
                        m_typeEntree = typeEntree;
                    }
                }
            }
            if (TypeEntree == null)
            {
                result.EmpileErreur(I.T("The entry type is incorrect|30081"));
                return(result);
            }

            I2iSerializable objet = m_formuleCommentaires;

            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleCommentaires = (C2iExpression)objet;

            objet  = m_formuleDateDebut;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleDateDebut = (C2iExpression)objet;

            objet  = m_formuleDateFin;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleDateFin = (C2iExpression)objet;

            objet  = m_formuleLibelle;
            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_formuleLibelle = (C2iExpression)objet;

            serializer.TraiteBool(ref m_bSansHoraires);
            serializer.TraiteBool(ref m_bEtatAuto);

            int nEtat = m_etatInitial.EtatInt;

            serializer.TraiteInt(ref nEtat);
            m_etatInitial = new CEtatEntreeAgenda((EtatEntreeAgenda)nEtat);

            serializer.AttacheObjet(typeof(CParametreEntreeAgenda), this);

            result = serializer.TraiteArrayListOf2iSerializable(m_listeParametresRelationsChamps);
            if (!result)
            {
                return(result);
            }
            result = serializer.TraiteArrayListOf2iSerializable(m_listeParametresRelationsTypesElements);
            if (!result)
            {
                return(result);
            }
            foreach (CParametreRelationEntreeAgenda_TypeElement parametre in m_listeParametresRelationsTypesElements.ToArray())
            {
                if (parametre.Relation == null)
                {
                    m_listeParametresRelationsChamps.Remove(parametre);
                }
            }


            serializer.DetacheObjet(typeof(CParametreEntreeAgenda), this);

            //Supprime les relations à type éléments invalides
            foreach (CParametreRelationEntreeAgenda_TypeElement rel in (IEnumerable)m_listeParametresRelationsChamps.Clone())
            {
                if (rel.Relation == null)
                {
                    m_listeParametresRelationsChamps.Remove(rel);
                }
            }


            if (nVersion == 1)
            {
                //Ancienne référence de la date
                objet  = null;
                result = serializer.TraiteObject(ref objet);
                string strDummy = "";
                serializer.TraiteString(ref strDummy);
            }

            if (nVersion >= 3)
            {
                objet  = (I2iSerializable)m_formuleCle;
                result = serializer.TraiteObject(ref objet);
                if (!result)
                {
                    return(result);
                }
                m_formuleCle = (C2iExpression)objet;
            }
            if (nVersion >= 4)
            {
                serializer.TraiteInt(ref m_nMinutesRappel);
            }
            return(result);
        }