Exemplo n.º 1
0
    protected void afficherLesDonnees()
    {
        PPGestionnaires gestionnaires = new PPGestionnaires();

        lblgestionnaires.Text = gestionnaires.Values.Count.ToString() + " donnée(s)";
        PPDetailsCommandes detailsCommandes = new PPDetailsCommandes();

        lbldetailscommandes.Text = detailsCommandes.Values.Count.ToString() + " donnée(s)";
        PPCommandes commandes = new PPCommandes();

        lblcommandes.Text = commandes.Values.Count.ToString() + " donnée(s)";
        PPPoidsLivraisons poidLivraison = new PPPoidsLivraisons();

        lblpoidslivraisons.Text = poidLivraison.Values.Count.ToString() + " donnée(s)";
        PPTypesLivraison typeLivraison = new PPTypesLivraison();

        lbltypeslivraison.Text = typeLivraison.Values.Count.ToString() + " donnée(s)";
        PPTypesPoids typePoids = new PPTypesPoids();

        lbltypespoids.Text = typePoids.Values.Count.ToString() + " donnée(s)";
        PPVendeursClients vendeursClients = new PPVendeursClients();

        lblvendeursclients.Text = vendeursClients.Values.Count.ToString() + " donnée(s)";
        PPArticlesEnPanier articlesEnPanier = new PPArticlesEnPanier();

        lblarticlesenpanier.Text = articlesEnPanier.Values.Count.ToString() + " donnée(s)";
        PPClients clients = new PPClients();

        lblclients.Text = clients.Values.Count.ToString() + " donnée(s)";
        PPProduits produits = new PPProduits();

        lblproduits.Text = produits.Values.Count.ToString() + " donnée(s)";
        PPVendeurs vendeurs = new PPVendeurs();

        lblvendeurs.Text = vendeurs.Values.Count.ToString() + " donnée(s)";
        PPCategories categories = new PPCategories();

        lblcategories.Text = categories.Values.Count.ToString() + " donnée(s)";
        PPHistoriquePaiements historique = new PPHistoriquePaiements();

        lblhistoriquepaiements.Text = historique.Values.Count.ToString() + " donnée(s)";
        PPTaxeFederale taxeFed = new PPTaxeFederale();

        lbltaxefederale.Text = taxeFed.Values.Count.ToString() + " donnée(s)";
        PPTaxeProvinciale taxeProv = new PPTaxeProvinciale();

        lbltaxeprovinciale.Text = taxeProv.Values.Count.ToString() + " donnée(s)";
        if ((gestionnaires.Values.Count > 0) || (detailsCommandes.Values.Count > 0) || (commandes.Values.Count > 0) || (poidLivraison.Values.Count > 0) || (typeLivraison.Values.Count > 0) ||
            (typePoids.Values.Count > 0) || (vendeursClients.Values.Count > 0) || (articlesEnPanier.Values.Count > 0) || (clients.Values.Count > 0) || (produits.Values.Count > 0) ||
            (vendeurs.Values.Count > 0) || (categories.Values.Count > 0) || (historique.Values.Count > 0) || (taxeFed.Values.Count > 0) || (taxeProv.Values.Count > 0))
        {
            idCreerDatabase.Enabled = false;
            idViderDatabase.Enabled = true;
        }
        else
        {
            idCreerDatabase.Enabled = true;
            idViderDatabase.Enabled = false;
        }
    }
Exemplo n.º 2
0
    protected void remplirCommandes(XNamespace ss, XElement worksheet)
    {
        PPCommandes commandes = new PPCommandes();

        foreach (XElement row in worksheet.Descendants(ss + "Row"))
        {
            List <String> arrayStr = new List <string>();
            foreach (XElement cell in row.Descendants(ss + "Data"))
            {
                arrayStr.Add(cell.Value);
            }
            if (arrayStr.Count() == 12)
            {
                commandes.Add(new Commande(null)
                {
                    NoCommande           = Convert.ToInt64(arrayStr[0]),
                    NoClient             = Convert.ToInt64(arrayStr[1]),
                    NoVendeur            = Convert.ToInt32(arrayStr[2]),
                    DateCommande         = DateTime.Parse(arrayStr[3]),
                    CoutLivraison        = Convert.ToDecimal(arrayStr[4]),
                    TypeLivraison        = Convert.ToInt16(arrayStr[5]),
                    MontantTotAvantTaxes = Convert.ToDecimal(arrayStr[6]),
                    TPS            = Convert.ToDecimal(arrayStr[7]),
                    TVQ            = Convert.ToDecimal(arrayStr[8]),
                    PoidsTotal     = Convert.ToDecimal(arrayStr[9]),
                    Statut         = arrayStr[10],
                    NoAutorisation = arrayStr[11]
                });
            }
        }
    }
Exemplo n.º 3
0
    public static void GenererPDF()
    {
        PPCommandes commandes = new PPCommandes();

        foreach (Commande commande in commandes.Values)
        {
            new GestionPDF(commande).GeneratePDF();
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Session.IsClient())
        {
            Response.Redirect(SessionManager.RedirectConnexionLink);
        }

        Client client = Session.GetClient();

        PPCommandes        commandes        = new PPCommandes();
        PPDetailsCommandes detailsCommandes = new PPDetailsCommandes();
        PPVendeurs         vendeurs         = new PPVendeurs();
        PPTypesLivraison   typesLivraison   = new PPTypesLivraison();

        var listeCommandes = from commande in commandes.Values
                             join vendeur in vendeurs.Values on commande.NoVendeur equals vendeur.NoVendeur
                             join typeLivraison in typesLivraison.Values on commande.TypeLivraison equals typeLivraison.CodeLivraison
                             where commande.NoClient == client.NoClient
                             let listeDetails = detailsCommandes.Values.Where(x => x.NoCommande == commande.NoCommande)
                                                select new { Commande = commande, TypeLivraison = typeLivraison, Vendeur = vendeur, Details = listeDetails };

        pnlContent.CardDyn(
            "", "mb-3",
            lbl => lbl.Text = "Historique des commandes",
            body =>
        {
            Table table         = body.TableDyn("", "table table-padding");
            TableHeaderRow hrow = table.ThrDyn();
            hrow.ThdDyn("No Commande");
            hrow.ThdDyn("Nom du vendeur");
            hrow.ThdDyn("Date de la commande");
            hrow.ThdDyn("Prix total avant taxes");

            foreach (var commande in listeCommandes)
            {
                TableRow row = table.TrDyn();

                TableCell cellBtnCommande = row.TdDyn();
                string path = $"Factures/{commande.Commande.NoCommande}.pdf";
                if (File.Exists(Server.MapPath($"~/{path}")))
                {
                    cellBtnCommande.BtnClientDyn("", commande.Commande.NoCommande.ToString(), $"window.open('/{path}'); return false;", "btn btn-outline-secondary btn-block");
                }
                else
                {
                    cellBtnCommande.BtnClientDyn("", commande.Commande.NoCommande.ToString(), $"window.open('/Factures/defaut.pdf'); return false", "btn btn-outline-secondary btn-block");
                }

                TableCell cellLinkVendeur = row.TdDyn();
                cellLinkVendeur.HlinkDYN("", $"~/Pages/Client/Catalogue.aspx?NoVendeur={commande.Vendeur.NoVendeur}", commande.Vendeur.NomAffaires);

                row.TdDyn(commande.Commande.DateCommande.ToString());
                row.TdDyn(commande.Commande.MontantTotAvantTaxes.Value.ToString("N2") + "$");
            }
        });
    }
Exemplo n.º 5
0
    protected void ViderBD()
    {
        PPGestionnaires gestionnaires = new PPGestionnaires();

        gestionnaires.RemoveAll();
        PPDetailsCommandes detailsCommandes = new PPDetailsCommandes();

        detailsCommandes.RemoveAll();
        PPCommandes commandes = new PPCommandes();

        commandes.RemoveAll();
        PPPoidsLivraisons poidLivraison = new PPPoidsLivraisons();

        poidLivraison.RemoveAll();
        PPTypesLivraison typeLivraison = new PPTypesLivraison();

        typeLivraison.RemoveAll();
        PPTypesPoids typePoids = new PPTypesPoids();

        typePoids.RemoveAll();
        PPVendeursClients vendeursClients = new PPVendeursClients();

        vendeursClients.RemoveAll();
        PPArticlesEnPanier articlesEnPanier = new PPArticlesEnPanier();

        articlesEnPanier.RemoveAll();
        PPClients clients = new PPClients();

        clients.RemoveAll();
        PPProduits produits = new PPProduits();

        produits.RemoveAll();
        PPVendeurs vendeurs = new PPVendeurs();

        vendeurs.RemoveAll();
        PPCategories categories = new PPCategories();

        categories.RemoveAll();
        PPHistoriquePaiements historique = new PPHistoriquePaiements();

        historique.RemoveAll();
        PPTaxeFederale taxeFed = new PPTaxeFederale();

        taxeFed.RemoveAll();
        PPTaxeProvinciale taxeProv = new PPTaxeProvinciale();

        taxeProv.RemoveAll();
        afficherLesDonnees();
    }
Exemplo n.º 6
0
    private void btnLivre(object sender, EventArgs e)
    {
        Button      btn           = (Button)sender;
        long        idCommande    = long.Parse(btn.ID.Replace("btnLivre", "").ToString());
        PPCommandes commandeLivre = dbContext.PPCommandes.Where(c => c.NoCommande == idCommande).First();

        commandeLivre.Statut = "1";
        try
        {
            dbContext.SaveChanges();
            creerPage();
        }
        catch (Exception ex)
        {
        }
    }
Exemplo n.º 7
0
    protected void livrerCommande(object sender, CommandEventArgs e)
    {
        PPCommandes commandes = new PPCommandes();

        foreach (Commande commande in commandes.Values)
        {
            if (commande.NoCommande.ToString().Equals(e.CommandArgument.ToString()))
            {
                Response.Write("ici");
                commande.Statut = "1";
                commandes.NotifyUpdated(commande);
            }
        }
        commandes.Update();
        Response.Write(e.CommandArgument.ToString());
        Response.Redirect(Request.RawUrl);
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Session.IsVendeur())
        {
            Response.Redirect(SessionManager.RedirectConnexionLink);
        }

        Vendeur vendeur = Session.GetVendeur();

        //Requetes pour commandes non traitées
        PPCommandes        commandes = new PPCommandes();
        PPDetailsCommandes details   = new PPDetailsCommandes();
        PPClients          clients   = new PPClients();

        var commandesVendeur = from commande in commandes.Values
                               join monClient in clients.Values on commande.NoClient equals monClient.NoClient
                               where commande.NoVendeur == vendeur.NoVendeur && commande.Statut == "0"
                               orderby commande.DateCommande ascending
                               let lstDetails = details.Values.Where(x => x.NoCommande == commande.NoCommande).ToList()
                                                select new { Commande = commande, Client = monClient, Details = lstDetails };

        //Commandes
        int indexCom = 0;

        //commandes non-traitées

        if (commandesVendeur.Count() > 0)
        {
            foreach (var com in commandesVendeur)
            {
                TableRow row          = new TableRow();
                long?    noCommande   = com.Commande.NoCommande;
                string   nomClient    = com.Client.Prenom + " " + com.Client.Nom;
                DateTime dateCommande = com.Commande.DateCommande.Value;

                decimal poidsCommande = com.Commande.PoidsTotal.Value;

                PPHistoriquePaiements historique = new PPHistoriquePaiements();
                //requete pour aller cherche le montant dans l'historique
                var montant = from montantHisto in historique.Values
                              where montantHisto.NoCommande == com.Commande.NoCommande
                              select montantHisto.MontantVenteAvantLivraison;

                decimal montantCom = montant.First().Value;

                TableCell cellNom = new TableCell();

                /* cellNom.Text = "Marcel Leboeuf";
                 * cellNom.Attributes.Add("OnClick", "window.location.assign('http://www.google.com');");*/

                string nomPDF = "";

                if (File.Exists(Server.MapPath("~/Factures/" + noCommande.ToString() + ".pdf")))
                {
                    nomPDF = noCommande.ToString() + ".pdf";
                }
                else
                {
                    nomPDF = "defaut.pdf";
                }

                cellNom.Text = nomClient;
                cellNom.Attributes.Add("OnClick", "ouvrirPDF('" + nomPDF + "');");
                row.Cells.Add(cellNom);


                TableCell cellDate = new TableCell();
                cellDate.Text = dateCommande.ToString("yyyy/MM/dd");
                cellDate.Attributes.Add("OnClick", "ouvrirPDF('" + nomPDF + "');");
                row.Cells.Add(cellDate);

                TableCell cellPrix = new TableCell();
                cellPrix.Text = montantCom.ToString("N2") + " $";
                cellPrix.Attributes.Add("OnClick", "ouvrirPDF('" + nomPDF + "');");
                row.Cells.Add(cellPrix);

                TableCell cellStatut = new TableCell();
                cellStatut.Text = poidsCommande.ToString("N2") + " Lbs";
                cellStatut.Attributes.Add("OnClick", "ouvrirPDF('" + nomPDF + "');");
                row.Cells.Add(cellStatut);


                //modal (il faut faire référence à la div à cet effet dans le front-hand.
                modal(panelAvecModal, "myModal" + indexCom.ToString(), noCommande.ToString(), "btnAnnulerLiv" + indexCom.ToString(), "Livraison", "Voulez-vous vraiment confirmer la livraison de cette commande? (" + noCommande.ToString() + ")", true);

                TableCell cellBtn   = row.TdDyn();
                Button    btnLivrer = cellBtn.BtnDyn("", "Prêt à livrer", null, "btn btn-secondary btn-block btn-sm");

                btnLivrer.OnClientClick = "return false;";
                btnLivrer.Attributes.Add("data-toggle", "modal");
                btnLivrer.Attributes.Add("data-target", "#Contenu_ContenuPrincipal_myModal" + indexCom.ToString());

                row.Cells.Add(cellBtn);

                tableCommandesNonTraitee.Rows.Add(row);
                indexCom++;
            }
        }
        else
        {
            tableCommandesNonTraitee.Visible = false;
            divBTN.Visible = false;
            pnCommandesClient.LblDyn("", "Vous n'avez aucune commande non traité", "h4 text-info ml-3");
        }

        //historique commandes
        var commandesVendeurH = from commande in commandes.Values
                                join monClient in clients.Values on commande.NoClient equals monClient.NoClient
                                where commande.NoVendeur == vendeur.NoVendeur && commande.Statut == "1"
                                orderby commande.DateCommande descending
                                let lstDetails = details.Values.Where(x => x.NoCommande == commande.NoCommande).ToList()
                                                 select new { Commande = commande, Client = monClient, Details = lstDetails };

        int index = 0;

        if (commandesVendeurH.Count() > 0)
        {
            foreach (var com in commandesVendeurH)
            {
                string nomPDF     = "";
                long?  noCommande = com.Commande.NoCommande.Value;

                if (File.Exists(Server.MapPath("~/Factures/" + noCommande.ToString() + ".pdf")))
                {
                    nomPDF = noCommande.ToString() + ".pdf";
                }
                else
                {
                    nomPDF = "defaut.pdf";
                }
                TableRow row = new TableRow();
                row.Attributes.Add("OnClick", "ouvrirPDF('" + nomPDF + "');");

                string   nomClient    = com.Client.Prenom + " " + com.Client.Nom;
                DateTime dateCommande = com.Commande.DateCommande.Value;

                decimal poidsCommande = com.Commande.PoidsTotal.Value;

                PPHistoriquePaiements historique = new PPHistoriquePaiements();
                //requete pour aller cherche le montant dans l'historique
                var montant = from montantHisto in historique.Values
                              where montantHisto.NoCommande == com.Commande.NoCommande
                              select montantHisto.MontantVenteAvantLivraison;

                decimal montantCom = montant.First().Value;

                TableCell cellNom = new TableCell();

                /* cellNom.Text = "Marcel Leboeuf";
                 * cellNom.Attributes.Add("OnClick", "window.location.assign('http://www.google.com');");*/
                cellNom.Text = nomClient;
                row.Cells.Add(cellNom);


                TableCell cellDate = new TableCell();
                cellDate.Text = dateCommande.ToString("yyyy/MM/dd");
                row.Cells.Add(cellDate);

                TableCell cellPrix = new TableCell();
                cellPrix.Text = montantCom.ToString("N2") + " $";
                row.Cells.Add(cellPrix);

                TableCell cellStatut = new TableCell();
                cellStatut.Text = poidsCommande.ToString("N2") + " Lbs";
                row.Cells.Add(cellStatut);


                //modal (il faut faire référence à la div à cet effet dans le front-hand.
                modal(panelAvecModal, "myModalH" + index.ToString(), "btnOkLivH" + index.ToString(), "btnAnnulerLivH" + index.ToString(), "Livraison", "Voulez-vous vraiment confirmer la livraison de cette commande? (" + nomClient + ")", true);
                tableHistorique.Rows.Add(row);
                index++;
            }
        }
        else
        {
            tableHistorique.Visible = false;
            divBTN2.Visible         = false;
            pnCommandesTraitees.LblDyn("", "Vous n'avez aucune commande dans l'historique", "h4 text-info ml-3");
        }
    }
    protected void btnImporterDonnees_Click(object sender, EventArgs e)
    {
        bool binOK = true;

        using (var transaction = dbContext.Database.BeginTransaction())
        {
            try
            {
                XDocument document = XDocument.Load(Server.MapPath("\\static\\xml\\PPVendeurs.xml"));
                XElement  racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPVendeurs"))
                {
                    PPVendeurs vendeur = new PPVendeurs();
                    vendeur.NoVendeur         = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    vendeur.NomAffaires       = element.Descendants("NomAffaires").Single().Value;
                    vendeur.Nom               = element.Descendants("Nom").Single().Value;
                    vendeur.Prenom            = element.Descendants("Prenom").Single().Value;
                    vendeur.Rue               = element.Descendants("Rue").Single().Value;
                    vendeur.Ville             = element.Descendants("Ville").Single().Value;
                    vendeur.Province          = element.Descendants("Province").Single().Value;
                    vendeur.CodePostal        = element.Descendants("CodePostal").Single().Value;
                    vendeur.Pays              = element.Descendants("Pays").Single().Value;
                    vendeur.Tel1              = element.Descendants("Tel1").Single().Value;
                    vendeur.Tel2              = element.Descendants("Tel2").Single().Value == "NULL" ? null : element.Descendants("Tel2").Single().Value;
                    vendeur.AdresseEmail      = element.Descendants("AdresseEmail").Single().Value;
                    vendeur.MotDePasse        = element.Descendants("MotDePasse").Single().Value;
                    vendeur.PoidsMaxLivraison = int.Parse(element.Descendants("PoidsMaxLivraison").Single().Value);
                    vendeur.LivraisonGratuite = decimal.Parse(element.Descendants("LivraisonGratuite").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    vendeur.Taxes             = element.Descendants("Taxes").Single().Value == "1" ? true : false;
                    if (element.Descendants("Pourcentage").Single().Value == "NULL")
                    {
                        vendeur.Pourcentage = null;
                    }
                    else
                    {
                        vendeur.Pourcentage = decimal.Parse(element.Descendants("Pourcentage").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    }
                    vendeur.Configuration = element.Descendants("Configuration").Single().Value;
                    if (element.Descendants("DateCreation").Single().Value == "NULL")
                    {
                        vendeur.DateCreation = null;
                    }
                    else
                    {
                        vendeur.DateCreation = DateTime.Parse(element.Descendants("DateCreation").Single().Value);
                    }
                    if (element.Descendants("DateMAJ").Single().Value == "NULL")
                    {
                        vendeur.DateMAJ = null;
                    }
                    else
                    {
                        vendeur.DateMAJ = DateTime.Parse(element.Descendants("DateMAJ").Single().Value);
                    }

                    if (element.Descendants("Statut").Single().Value == "NULL")
                    {
                        vendeur.Statut = null;
                    }
                    else
                    {
                        vendeur.Statut = short.Parse(element.Descendants("Statut").Single().Value);
                    }

                    dbContext.PPVendeurs.Add(vendeur);

                    XDocument configuration = new XDocument();
                    XElement  urlImage      = new XElement("urlImage");
                    urlImage.Value = "image_magasin.jpg";
                    XElement couleurFond = new XElement("couleurFond");
                    couleurFond.Value = "#ffffff";
                    XElement couleurTexte = new XElement("couleurTexte");
                    couleurTexte.Value = "#000000";
                    configuration.Add(new XElement("configuration", urlImage, couleurFond, couleurTexte));
                    configuration.Save(Server.MapPath("\\static\\xml\\" + vendeur.Configuration));
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPClients.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPClients"))
                {
                    PPClients client = new PPClients();
                    client.NoClient     = long.Parse(element.Descendants("NoClient").Single().Value);
                    client.AdresseEmail = element.Descendants("AdresseEmail").Single().Value;
                    client.MotDePasse   = element.Descendants("MotDePasse").Single().Value;
                    client.Nom          = element.Descendants("Nom").Single().Value == "NULL" ? null : element.Descendants("Nom").Single().Value;
                    client.Prenom       = element.Descendants("Prenom").Single().Value == "NULL" ? null : element.Descendants("Prenom").Single().Value;
                    client.Rue          = element.Descendants("Rue").Single().Value == "NULL" ? null : element.Descendants("Rue").Single().Value;
                    client.Ville        = element.Descendants("Ville").Single().Value == "NULL" ? null : element.Descendants("Ville").Single().Value;
                    client.Province     = element.Descendants("Province").Single().Value == "NULL" ? null : element.Descendants("Province").Single().Value;
                    client.CodePostal   = element.Descendants("CodePostal").Single().Value == "NULL" ? null : element.Descendants("CodePostal").Single().Value;
                    client.Pays         = element.Descendants("Pays").Single().Value == "NULL" ? null : element.Descendants("Pays").Single().Value;
                    client.Tel1         = element.Descendants("Tel1").Single().Value == "NULL" ? null : element.Descendants("Tel1").Single().Value;
                    client.Tel2         = element.Descendants("Tel2").Single().Value == "NULL" ? null : element.Descendants("Tel2").Single().Value;
                    client.DateCreation = DateTime.Parse(element.Descendants("DateCreation").Single().Value);
                    if (element.Descendants("DateMAJ").Single().Value == "NULL")
                    {
                        client.DateMAJ = null;
                    }
                    else
                    {
                        client.DateMAJ = DateTime.Parse(element.Descendants("DateMAJ").Single().Value);
                    }
                    client.NbConnexions = short.Parse(element.Descendants("NbConnexions").Single().Value);
                    if (element.Descendants("DateDerniereConnexion").Single().Value == "NULL")
                    {
                        client.DateDerniereConnexion = null;
                    }
                    else
                    {
                        client.DateDerniereConnexion = DateTime.Parse(element.Descendants("DateDerniereConnexion").Single().Value);
                    }
                    client.Statut = short.Parse(element.Descendants("Statut").Single().Value);

                    dbContext.PPClients.Add(client);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPCategories.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPCategories"))
                {
                    PPCategories categorie = new PPCategories();
                    categorie.NoCategorie = int.Parse(element.Descendants("NoCategorie").Single().Value);
                    categorie.Description = element.Descendants("Description").Single().Value;
                    categorie.Details     = element.Descendants("Details").Single().Value;

                    dbContext.PPCategories.Add(categorie);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPProduits.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPProduits"))
                {
                    PPProduits produit = new PPProduits();
                    produit.NoProduit     = long.Parse(element.Descendants("NoProduit").Single().Value);
                    produit.NoVendeur     = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    produit.NoCategorie   = int.Parse(element.Descendants("NoCategorie").Single().Value);
                    produit.Nom           = element.Descendants("Nom").Single().Value;
                    produit.Description   = element.Descendants("Description").Single().Value;
                    produit.Photo         = element.Descendants("Photo").Single().Value;
                    produit.PrixDemande   = decimal.Parse(element.Descendants("PrixDemande").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    produit.NombreItems   = short.Parse(element.Descendants("NombreItems").Single().Value);
                    produit.Disponibilité = element.Descendants("Disponibilit_").Single().Value == "1" ? true : false;
                    if (element.Descendants("DateVente").Single().Value == "NULL")
                    {
                        produit.DateVente = null;
                    }
                    else
                    {
                        produit.DateVente = DateTime.Parse(element.Descendants("DateVente").Single().Value);
                    }
                    if (element.Descendants("PrixVente").Single().Value == "NULL")
                    {
                        produit.PrixVente = null;
                    }
                    else
                    {
                        produit.PrixVente = decimal.Parse(element.Descendants("PrixVente").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    }
                    produit.Poids        = decimal.Parse(element.Descendants("Poids").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    produit.DateCreation = DateTime.Parse(element.Descendants("DateCreation").Single().Value);
                    if (element.Descendants("DateMAJ").Single().Value == "NULL")
                    {
                        produit.DateMAJ = null;
                    }
                    else
                    {
                        produit.DateMAJ = DateTime.Parse(element.Descendants("DateMAJ").Single().Value);
                    }

                    dbContext.PPProduits.Add(produit);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPArticlesEnPanier.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPArticlesEnPanier"))
                {
                    PPArticlesEnPanier articleEnPanier = new PPArticlesEnPanier();
                    articleEnPanier.NoPanier     = long.Parse(element.Descendants("NoPanier").Single().Value);
                    articleEnPanier.NoClient     = long.Parse(element.Descendants("NoClient").Single().Value);
                    articleEnPanier.NoVendeur    = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    articleEnPanier.NoProduit    = long.Parse(element.Descendants("NoProduit").Single().Value);
                    articleEnPanier.DateCreation = DateTime.Parse(element.Descendants("DateCreation").Single().Value);
                    articleEnPanier.NbItems      = short.Parse(element.Descendants("NbItems").Single().Value);

                    dbContext.PPArticlesEnPanier.Add(articleEnPanier);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPTypesPoids.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPTypesPoids"))
                {
                    PPTypesPoids typePoids = new PPTypesPoids();
                    typePoids.CodePoids = short.Parse(element.Descendants("CodePoids").Single().Value);
                    typePoids.PoidsMin  = decimal.Parse(element.Descendants("PoidsMin").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    typePoids.PoidsMax  = decimal.Parse(element.Descendants("PoidsMax").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));

                    dbContext.PPTypesPoids.Add(typePoids);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPTypesLivraison.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPTypesLivraison"))
                {
                    PPTypesLivraison typeLivraison = new PPTypesLivraison();
                    typeLivraison.CodeLivraison = short.Parse(element.Descendants("CodeLivraison").Single().Value);
                    typeLivraison.Description   = element.Descendants("Description").Single().Value;

                    dbContext.PPTypesLivraison.Add(typeLivraison);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPPoidsLivraisons.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPPoidsLivraisons"))
                {
                    PPPoidsLivraisons poidsLivraison = new PPPoidsLivraisons();
                    poidsLivraison.CodeLivraison = short.Parse(element.Descendants("CodeLivraison").Single().Value);
                    poidsLivraison.CodePoids     = short.Parse(element.Descendants("CodePoids").Single().Value);
                    poidsLivraison.Tarif         = decimal.Parse(element.Descendants("Tarif").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));

                    dbContext.PPPoidsLivraisons.Add(poidsLivraison);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPCommandes.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPCommandes"))
                {
                    PPCommandes commande = new PPCommandes();
                    commande.NoCommande           = long.Parse(element.Descendants("NoCommande").Single().Value);
                    commande.NoClient             = long.Parse(element.Descendants("NoClient").Single().Value);
                    commande.NoVendeur            = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    commande.DateCommande         = DateTime.Parse(element.Descendants("DateCommande").Single().Value);
                    commande.CoutLivraison        = decimal.Parse(element.Descendants("CoutLivraison").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    commande.TypeLivraison        = short.Parse(element.Descendants("TypeLivraison").Single().Value);
                    commande.MontantTotAvantTaxes = decimal.Parse(element.Descendants("MontantTotAvantTaxes").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    commande.TPS            = decimal.Parse(element.Descendants("TPS").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    commande.TVQ            = decimal.Parse(element.Descendants("TVQ").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    commande.PoidsTotal     = decimal.Parse(element.Descendants("PoidsTotal").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    commande.Statut         = element.Descendants("Statut").Single().Value;
                    commande.NoAutorisation = element.Descendants("NoAutorisation").Single().Value;

                    dbContext.PPCommandes.Add(commande);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPDetailsCommandes.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPDetailsCommandes"))
                {
                    PPDetailsCommandes detailCommande = new PPDetailsCommandes();
                    detailCommande.NoDetailCommandes = long.Parse(element.Descendants("NoDetailCommandes").Single().Value);
                    detailCommande.NoCommande        = long.Parse(element.Descendants("NoCommande").Single().Value);
                    detailCommande.NoProduit         = long.Parse(element.Descendants("NoProduit").Single().Value);
                    detailCommande.PrixVente         = decimal.Parse(element.Descendants("PrixVente").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    detailCommande.Quantité          = short.Parse(element.Descendants("Quantit_").Single().Value);

                    dbContext.PPDetailsCommandes.Add(detailCommande);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPVendeursClients.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPVendeursClients"))
                {
                    PPVendeursClients vendeurClient = new PPVendeursClients();
                    vendeurClient.NoVendeur  = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    vendeurClient.NoClient   = long.Parse(element.Descendants("NoClient").Single().Value);
                    vendeurClient.DateVisite = DateTime.Parse(element.Descendants("DateVisite").Single().Value);

                    dbContext.PPVendeursClients.Add(vendeurClient);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPHistoriquePaiements.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPHistoriquePaiements"))
                {
                    PPHistoriquePaiements historiquePaiement = new PPHistoriquePaiements();
                    historiquePaiement.NoHistorique = long.Parse(element.Descendants("NoHistorique").Single().Value);
                    historiquePaiement.MontantVenteAvantLivraison = decimal.Parse(element.Descendants("MontantVenteAvantLivraison").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    historiquePaiement.NoVendeur      = long.Parse(element.Descendants("NoVendeur").Single().Value);
                    historiquePaiement.NoClient       = long.Parse(element.Descendants("NoClient").Single().Value);
                    historiquePaiement.NoCommande     = long.Parse(element.Descendants("NoCommande").Single().Value);
                    historiquePaiement.DateVente      = DateTime.Parse(element.Descendants("DateVente").Single().Value);
                    historiquePaiement.NoAutorisation = element.Descendants("NoCommande").Single().Value;
                    historiquePaiement.FraisLesi      = decimal.Parse(element.Descendants("FraisLesi").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    historiquePaiement.Redevance      = decimal.Parse(element.Descendants("Redevance").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    historiquePaiement.FraisLivraison = decimal.Parse(element.Descendants("FraisLivraison").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    historiquePaiement.FraisTPS       = decimal.Parse(element.Descendants("FraisTPS").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));
                    historiquePaiement.FraisTVQ       = decimal.Parse(element.Descendants("FraisTVQ").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));

                    dbContext.PPHistoriquePaiements.Add(historiquePaiement);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPTaxeProvinciale.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPTaxeProvinciale"))
                {
                    PPTaxeProvinciale taxeProvinciale = new PPTaxeProvinciale();
                    taxeProvinciale.NoTVQ            = byte.Parse(element.Descendants("NoTVQ").Single().Value);
                    taxeProvinciale.DateEffectiveTVQ = DateTime.Parse(element.Descendants("DateEffectiveTVQ").Single().Value);
                    taxeProvinciale.TauxTVQ          = decimal.Parse(element.Descendants("TauxTVQ").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));

                    dbContext.PPTaxeProvinciale.Add(taxeProvinciale);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPTaxeFederale.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPTaxeFederale"))
                {
                    PPTaxeFederale taxeFederale = new PPTaxeFederale();
                    taxeFederale.NoTPS            = byte.Parse(element.Descendants("NoTPS").Single().Value);
                    taxeFederale.DateEffectiveTPS = DateTime.Parse(element.Descendants("DateEffectiveTPS").Single().Value);
                    taxeFederale.TauxTPS          = decimal.Parse(element.Descendants("TauxTPS").Single().Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator));

                    dbContext.PPTaxeFederale.Add(taxeFederale);
                }

                document = XDocument.Load(Server.MapPath("\\static\\xml\\PPGestionnaires.xml"));
                racine   = document.Element("dataroot");
                foreach (var element in racine.Elements("PPGestionnaires"))
                {
                    PPGestionnaires gestionnaire = new PPGestionnaires();
                    gestionnaire.ID         = long.Parse(element.Descendants("ID").Single().Value);
                    gestionnaire.courriel   = element.Descendants("courriel").Single().Value;
                    gestionnaire.motDePasse = element.Descendants("motDePasse").Single().Value;

                    dbContext.PPGestionnaires.Add(gestionnaire);
                }

                dbContext.SaveChanges();
                transaction.Commit();

                lblMessage.Text     = "Les données du jeu d'essai ont été importées.";
                divMessage.CssClass = "alert alert-success alert-margins";
            }
            catch (DbUpdateException ex)
            {
                transaction.Rollback();

                if (ex.InnerException is UpdateException && ex.InnerException.InnerException is SqlException)
                {
                    lblMessage.Text = "Une erreur s'est produite lors de l'importation du jeu d'essai. Les données n'ont pas été importées. Voici l'erreur : " + ex.InnerException.InnerException.Message;
                }
                else
                {
                    lblMessage.Text = "Une erreur s'est produite lors de l'importation du jeu d'essai. Les données n'ont pas été importées. Voici l'erreur : " + ex.Message;
                }
                divMessage.CssClass = "alert alert-danger alert-margins";
                binOK = false;
            }
            catch (Exception ex)
            {
                transaction.Rollback();

                lblMessage.Text     = "Une erreur s'est produite lors de l'importation du jeu d'essai. Les données n'ont pas été importées. Voici l'erreur : " + ex.Message;
                divMessage.CssClass = "alert alert-danger alert-margins";
                binOK = false;
            }
        }

        divMessage.Visible = true;

        remplirTableau(true);

        if (binOK)
        {
            btnImporterDonnees.Visible = false;
            btnViderBD.Visible         = true;
        }
    }