コード例 #1
0
ファイル: CLotValorisation.cs プロジェクト: ykebaili/Timos
        //--------------------------------------------------------------------
        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);
                }
            }
        }
コード例 #2
0
ファイル: CLotValorisation.cs プロジェクト: ykebaili/Timos
        //--------------------------------------------------------------------
        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é);
                }
            }
        }
コード例 #3
0
ファイル: CLigneCommande.cs プロジェクト: ykebaili/Timos
 //------------------------------------------------------
 public double CalculeTonCoutPuisqueTuNeCalculePasAPartirDesSourcesDeCout(bool bCoutReel)
 {
     if (bCoutReel)
     {
         foreach (CLigneLivraisonEquipement ligneLiv in LignesLivraison)
         {
             if (ligneLiv.LivraisonEquipement != null)
             {
                 CValorisationElement valo = ligneLiv.LivraisonEquipement.GetValorisation(ElementCommandé);
                 if (valo != null)
                 {
                     double fQte = 0;
                     if (ElementCommandé is CTypeEquipement)
                     {
                         fQte = Quantite;
                     }
                     if (ElementCommandé is CTypeConsommable)
                     {
                         //TODO calculer la valeur de consommable
                     }
                     return(fQte * valo.Valeur);
                 }
             }
         }
         return(0);
     }
     else
     {
         if (TypeConsommable != null)
         {
             return(TypeConsommable.GetValuationForDate(Commande.DateCommande, new CValeurUnite(Quantite, "")));
         }
         if (TypeEquipement != null)
         {
             return(TypeEquipement.GetValuationForDate(Commande.DateCommande) * Quantite);
         }
         return(0);
     }
 }