Ejemplo n.º 1
0
        /// <summary>
        /// Remplit les zones de base liées à ce type pour une entrée de Agenda
        /// </summary>
        /// <param name="entree"></param>
        /// <param name="element"></param>
        /// <returns></returns>
        public CResultAErreur InitEntreeManuelleFor(CEntreeAgenda entree, CObjetDonneeAIdNumerique element)
        {
            CResultAErreur result = CResultAErreur.True;

            if (entree == null)
            {
                result.EmpileErreur(I.T("Fill an empty Diary Entry is impossible|345"));
                return(result);
            }
            if (element == null)
            {
                result.EmpileErreur(I.T("Entry creation on null element is impossible|346"));
                return(result);
            }
            entree.TypeEntree = this;
            foreach (CRelationTypeEntreeAgenda_TypeElementAAgenda relation in RelationsTypeElementsAAgenda)
            {
                if (relation.TypeElements == element.GetType() && relation.LienMaitre)
                {
                    CRelationEntreeAgenda_ElementAAgenda newRel = new CRelationEntreeAgenda_ElementAAgenda(entree.ContexteDonnee);
                    newRel.CreateNewInCurrentContexte();
                    newRel.RelationTypeEntree_TypeElement = relation;
                    newRel.ElementLie   = element;
                    newRel.EntreeAgenda = entree;
                    return(result);
                }
            }
            result.EmpileErreur(I.T("No relation on @1 type exists for Diary Entry Type @2|347", element.GetType() + Libelle));
            return(result);
        }
Ejemplo n.º 2
0
 //////////////////////////////////////////////////////////////////////////
 public CVisuEntreeAgenda(CRelationEntreeAgenda_ElementAAgenda relation)
 {
     m_entree    = relation.EntreeAgenda;
     m_role      = relation.RelationTypeEntree_TypeElement.Role;
     m_objetLie  = relation.ElementLie;
     m_dateDebut = m_entree.DateDebut;
     m_dateFin   = m_entree.DateFin;
 }
Ejemplo n.º 3
0
        public IRelationElementALien_Element GetNewRelation(IElementALien elementALien, CObjetDonneeAIdNumerique elementLie)
        {
            CRelationEntreeAgenda_ElementAAgenda rel = new CRelationEntreeAgenda_ElementAAgenda(elementALien.ContexteDonnee);

            rel.ElementLie   = (CObjetDonneeAIdNumerique)elementLie;
            rel.RelationType = this;
            rel.EntreeAgenda = (CEntreeAgenda)elementALien;
            return(rel);
        }
Ejemplo n.º 4
0
 //////////////////////////////////////////////////////////////////////////
 public CVisuEntreeAgenda(CRelationEntreeAgenda_ElementAAgenda relation, DateTime dtDebut,
                          DateTime dtfin)
 {
     m_entree    = (CEntreeAgenda)relation.EntreeAgenda;
     m_role      = relation.RelationTypeEntree_TypeElement.Role;
     m_objetLie  = relation.ElementLie;
     m_dateDebut = dtDebut;
     m_dateFin   = dtfin;
 }
Ejemplo n.º 5
0
        public bool AddElementLieSurType(CObjetDonneeAIdNumerique element, IRelationTypeElementALien_TypeElement relType)
        {
            if (element == null)
            {
                return(false);
            }
            Hashtable tableRelationsExistantes = new Hashtable();
            CRelationEntreeAgenda_ElementAAgenda laRelation = null;

            foreach (CRelationEntreeAgenda_ElementAAgenda rel in RelationsElementsAgenda)
            {
                if (rel.RelationTypeEntree_TypeElement.Id == relType.Id)
                {
                    laRelation = rel;
                    tableRelationsExistantes[rel.ElementLie] = rel;
                }
            }

            bool bCreate = false;

            if (relType.Multiple && element != null)
            {
                if (tableRelationsExistantes[element] == null)
                {
                    bCreate = true;
                }
            }
            else
            {
                if (tableRelationsExistantes.Count != 0)
                {
                    laRelation.ElementLie = element;
                }
                else
                {
                    bCreate = true;
                }
            }
            if (bCreate)
            {
                CRelationEntreeAgenda_ElementAAgenda rel = new CRelationEntreeAgenda_ElementAAgenda(ContexteDonnee);
                rel.CreateNewInCurrentContexte();
                rel.EntreeAgenda = this;
                rel.ElementLie   = element;
                rel.RelationTypeEntree_TypeElement = (CRelationTypeEntreeAgenda_TypeElementAAgenda)relType;
            }
            return(true);
        }