예제 #1
0
        //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);
        }
예제 #2
0
        //Saisir une facture
        public static void SaisirFacture(FactureBOL nouvelleFacture)
        {
            Facture nouvelleFacture1 = new Facture
            {
                IdClient         = nouvelleFacture.IdClient,
                DateFacture      = nouvelleFacture.Datefacture,
                DatePaiement     = nouvelleFacture.DatePaiement,
                CodeModePaiement = nouvelleFacture.CodeModePaiement
            };

            BDD.EnregistrerFacture(nouvelleFacture1);
        }
예제 #3
0
        //-----------------------------GESTION DES FACTURES--------------
        // Cherche les factures  selon l'id et renvoie la liste des adresses de ce dernier

        public static List <FactureBOL> GetFacture(DateTime saisieDate, int saisieClient)
        {
            List <Facture>    facture    = BDD.ChercheFactureClient(saisieDate, saisieClient);
            List <FactureBOL> facturebol = new List <FactureBOL>();

            foreach (Facture f in facture)
            {
                FactureBOL facture1 = new FactureBOL();
                facture1.Id               = f.Id;
                facture1.IdClient         = f.IdClient;
                facture1.Datefacture      = f.DateFacture;
                facture1.DatePaiement     = f.DatePaiement;
                facture1.CodeModePaiement = f.CodeModePaiement;

                facturebol.Add(facture1);
            }
            return(facturebol);
        }