示例#1
0
        //--------------------------------------------------------------------
        public void AjouterEquipementsDepuisCommandeInCurrentContext(CCommande commande)
        {
            if (commande == null)
            {
                return;
            }
            HashSet <IElementCommandable> setCommandablesPresents = new HashSet <IElementCommandable>();

            foreach (CValorisationElement val in Valorisations)
            {
                IElementCommandable eltCom = val.ElementValorisé as IElementCommandable;
                if (eltCom != null)
                {
                    setCommandablesPresents.Add(eltCom);
                }
            }
            foreach (CLigneCommande ligne in commande.Lignes)
            {
                if (ligne.ElementCommandé != null &&
                    !setCommandablesPresents.Contains(ligne.ElementCommandé))
                {
                    CValorisationElement valo = new CValorisationElement(ContexteDonnee);
                    valo.CreateNewInCurrentContexte();
                    valo.ElementValorisé = ligne.ElementCommandé;
                    valo.LotValorisation = this;
                    setCommandablesPresents.Add(ligne.ElementCommandé);
                }
            }
        }
示例#2
0
        //--------------------------------------------------------------------
        public void AjouterEquipementsDepuisLivraisonInCurrentContext(CLivraisonEquipement livraison)
        {
            if (livraison == null)
            {
                return;
            }
            HashSet <int> setPresents = new HashSet <int>();

            foreach (CValorisationElement val in Valorisations)
            {
                if (val.TypeEquipement != null)
                {
                    setPresents.Add(val.TypeEquipement.Id);
                }
            }
            foreach (CLigneLivraisonEquipement ligne in livraison.Lignes)
            {
                if (ligne.Equipement != null && ligne.Equipement.TypeEquipement != null &&
                    !setPresents.Contains(ligne.Equipement.TypeEquipement.Id))
                {
                    CValorisationElement valo = new CValorisationElement(ContexteDonnee);
                    valo.CreateNewInCurrentContexte();
                    valo.TypeEquipement  = ligne.Equipement.TypeEquipement;
                    valo.LotValorisation = this;
                    setPresents.Add(ligne.Equipement.TypeEquipement.Id);
                }
            }
        }