Example #1
0
        /// ////////////////////////////////////////
        public void SetFormuleForRelationTypeElement(CRelationTypeEntreeAgenda_TypeElementAAgenda rel, C2iExpression formule)
        {
            foreach (CParametreRelationEntreeAgenda_TypeElement relEx in m_listeParametresRelationsTypesElements)
            {
                if (relEx.Relation.Id == rel.Id)
                {
                    if (formule == null)
                    {
                        m_listeParametresRelationsChamps.Remove(relEx);
                        return;
                    }
                    relEx.FormuleLien = formule;
                    return;
                }
            }
            if (formule == null)
            {
                return;
            }
            CParametreRelationEntreeAgenda_TypeElement parametre = new CParametreRelationEntreeAgenda_TypeElement(this);

            parametre.Relation    = rel;
            parametre.FormuleLien = formule;
            m_listeParametresRelationsTypesElements.Add(parametre);
        }
 /// ////////////////////////////////////////////
 /// <param name="relation"></param>
 public CDefinitionProprieteDynamiqueElementTypeEntreeAgenda(
     CRelationTypeEntreeAgenda_TypeElementAAgenda relation
     )
     : base(
         relation.Libelle,
         relation.Id.ToString(),
         new CTypeResultatExpression(relation.TypeElements, false),
         true,
         false)
 {
 }
Example #3
0
 /// ////////////////////////////////////////
 public C2iExpression GetFormuleForRelationTypeElement(CRelationTypeEntreeAgenda_TypeElementAAgenda relation)
 {
     foreach (CParametreRelationEntreeAgenda_TypeElement relEx in m_listeParametresRelationsTypesElements)
     {
         if (relEx != null && relEx.Relation != null && relEx.Relation.Id == relation.Id)
         {
             return(relEx.FormuleLien);
         }
     }
     return(null);
 }
Example #4
0
        //-------------------------------------------------------------------
        public CObjetDonneeAIdNumerique[] GetElementsLies(CRelationTypeEntreeAgenda_TypeElementAAgenda relType)
        {
            ArrayList lst = new ArrayList();

            foreach (CRelationEntreeAgenda_ElementAAgenda rel in RelationsElementsAgenda)
            {
                if (rel.RelationTypeEntree_TypeElement.Id == relType.Id)
                {
                    lst.Add(rel.ElementLie);
                }
            }
            return((CObjetDonneeAIdNumerique[])lst.ToArray(typeof(CObjetDonneeAIdNumeriqueAuto)));
        }
Example #5
0
        public void SetElementsLies(IEnumerable elements, CRelationTypeEntreeAgenda_TypeElementAAgenda relType)
        {
            Hashtable tableOk = new Hashtable();

            foreach (CObjetDonneeAIdNumerique objet in elements)
            {
                AddElementLieSurType(objet, relType);
                tableOk[objet.Id] = true;
            }
            foreach (CObjetDonneeAIdNumerique objetLie in GetElementsLies(relType))
            {
                if (!tableOk.Contains(objetLie.Id))
                {
                    DelieElementSurType(objetLie, relType);
                }
            }
        }
Example #6
0
        public bool AddElementLie(CObjetDonneeAIdNumerique element, string strCode)
        {
            if (element == null)
            {
                return(false);
            }
            ArrayList           lst   = new ArrayList();
            CListeObjetsDonnees liste = TypeEntree.RelationsTypeElementsAAgenda;

            liste.Filtre = new CFiltreData(CRelationTypeEntreeAgenda_TypeElementAAgenda.c_champCode + "=@1", strCode);
            if (liste.Count == 0)
            {
                return(false);
            }
            CRelationTypeEntreeAgenda_TypeElementAAgenda relType = (CRelationTypeEntreeAgenda_TypeElementAAgenda)liste[0];

            return(AddElementLieSurType(element, relType));
        }
Example #7
0
        public void SetElementsLies(IEnumerable elements, string strCode)
        {
            if (elements == null)
            {
                return;
            }
            ArrayList           lst   = new ArrayList();
            CListeObjetsDonnees liste = TypeEntree.RelationsTypeElementsAAgenda;

            liste.Filtre = new CFiltreData(CRelationTypeEntreeAgenda_TypeElementAAgenda.c_champCode + "=@1", strCode);
            if (liste.Count == 0)
            {
                return;
            }
            CRelationTypeEntreeAgenda_TypeElementAAgenda relType = (CRelationTypeEntreeAgenda_TypeElementAAgenda)liste[0];

            SetElementsLies(elements, relType);
        }
Example #8
0
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }

            m_parametre = (CParametreEntreeAgenda)serializer.GetObjetAttache(typeof(CParametreEntreeAgenda));

            int nIdRelation = -1;

            if (m_relation != null)
            {
                nIdRelation = m_relation.Id;
            }
            serializer.TraiteInt(ref nIdRelation);
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                CRelationTypeEntreeAgenda_TypeElementAAgenda relation = new CRelationTypeEntreeAgenda_TypeElementAAgenda((CContexteDonnee)serializer.GetObjetAttache(typeof(CContexteDonnee)));
                if (relation.ReadIfExists(nIdRelation))
                {
                    m_relation = relation;
                }
                else
                {
                    relation = null;                    //Si la relation n'existe plus, elle sera supprimée du paramètre
                }
            }

            I2iSerializable objet = m_formuleLien;

            result        = serializer.TraiteObject(ref objet);
            m_formuleLien = (C2iExpression)objet;

            return(result);
        }