public void AjoutHistorique(object sender, EventArgs e) { M_HistoriqueCours temp = new M_HistoriqueCours(m_Bourse.LastDate(), m_Bourse.LastPrice()); m_HistoriqueCours.Add(temp); _dataGridHistorique.ClearValue(ListView.ItemsSourceProperty); _dataGridHistorique.ItemsSource = m_HistoriqueCours; _dataGridHistorique.ScrollIntoView(_dataGridHistorique.Items[_dataGridHistorique.Items.Count - 1]); }
private void MiseAJourBenef() { if (listeAchat.Count != 0) { for (int i = 0; i < listeAchat.Count; i++) { double dernier = Convert.ToDouble(m_Bourse.LastPrice()); double prixAchat = listeAchat[i].PrixAchat; if (listeAchat[i].Type == Transaction.Achat) // ACHAT { benefPerte = dernier - prixAchat; } else // VENTE { benefPerte = prixAchat - dernier; } listeAchat[i].BenefAchat = benefPerte; listeAchat[i].TotalAchat = benefPerte * listeAchat[i].QuantiteAchat; this.BenefPerte = benefPerte; } // Mise a jour pour les gains et gains total } }
private void boutonVente_Click(object sender, RoutedEventArgs e) { id++; M_Bourse bourse = mv_Bourse.GetM_Bourse(); double benef = 0; int quantite = Convert.ToInt32(Quantite.Value); double total = 0; M_Achat temp = new M_Achat(Transaction.Vente, id, DateTime.Now.ToString("hh:mm:ss"), quantite, Convert.ToDouble(bourse.LastPrice()), benef, total); mv_Achat.AjoutAchat(temp); }