if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave n'est ouverte"); } else { // // Recupere la liste des vins de la cave // ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); float bottles = 0; float evaluatePrice = 0; float buyPrice = 0; for (int i = 0; i < wines.Count; i++) { Wine w = (Wine)wines[i]; if(w.ManualManagement) { bottles+= w.RackItems.Count; evaluatePrice+= (w.EvaluatePrice * w.RackItems.Count); } else { bottles+= w.Bottles; evaluatePrice+= (w.EvaluatePrice * w.Bottles); } // Fiche achats consos for (int j = 0; j < w.Purchases.Count; j++) { PurchaseSales psales = (PurchaseSales)w.Purchases[j]; buyPrice += psales.Amount; } } // // Affichage // MessageBox.Show("Nombre de bouteilles en cave : " + bottles.ToString() + "\n" + "Valeur estimation : " + evaluatePrice.ToString("F") + " €" + "\n" + "Total achat : " + buyPrice.ToString("F") + " €"); }