public static Facture GetFacture(int Ref) { Facture F = new Facture(); cmd = new MySqlCommand(" Select * from facture where Fref = ? ", DBconnection.Cnn); cmd.Parameters.Add(new MySqlParameter("Fref", Ref)); MySqlDataReader Lire = cmd.ExecuteReader(); while (Lire.Read()) { F.Ref = int.Parse(Lire["Fref"].ToString()); F.IdClient = int.Parse(Lire["IdC"].ToString()); F.DateF = DateTime.Parse(Lire["DateF"].ToString()); F.Montant = float.Parse(Lire["MontantTotal"].ToString()); } Lire.Close(); return(F); }
public static void AfficherBulanReglements(DataTable T, int Ref) { T = DAL.GetDetailReglements(Ref); Facture F = DAL.GetFacture(Ref); Double S = 0, Reste = 0; foreach (DataRow row in T.Rows) { S += Double.Parse(row["Montant"].ToString()); // Somme des Montant } Reste = (F.Montant - S); Console.WriteLine(" Montant total des reglements : " + S); if (Reste < 0) { Console.WriteLine(" Vous avez une dette envers le Client de : " + Reste); } else { Console.WriteLine(" Reste à payer : " + Reste); } }