//Exporter factures en XML public static bool EnregistreFacturesXML(int saisieClient) { List <Facture> listeFacture = BDD.AfficheListeFacture(saisieClient); List <FactureBOL> factureBOL = new List <FactureBOL>(); foreach (Facture f in listeFacture) { FactureBOL facture1 = new FactureBOL(); facture1.Id = f.Id; facture1.IdClient = f.IdClient; facture1.Datefacture = f.DateFacture; facture1.DatePaiement = f.DatePaiement; facture1.CodeModePaiement = f.CodeModePaiement; facture1.MontantFacture = f.LigneFacture.Sum(c => (double)c.Quantite * (1 - (double)c.TauxTVA) * (double)c.MontantHT * (1 - (double)c.TauxReduction)); factureBOL.Add(facture1); } XmlSerializer xmlserialise = new XmlSerializer(typeof(List <FactureBOL>), new XmlRootAttribute("ListeFactures")); using (var sw = new StreamWriter(@"..\..\XML_Liste_Facture_Client" + saisieClient + ".xml")) { xmlserialise.Serialize(sw, factureBOL); } return(true); }