using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using GestionDeCommerceInfoClasseBDDNCouches; using GestionDeCommerceInfoClasseBDDNCouches.DataLayer; namespace Gestion_de_commerce_Informatique { public partial class ConfigCommande : Form { BDDAccesArticle bbdArt = new BDDAccesArticle(Settings1.Default.ChaineDeConnection); BDDAccesPanier bddPanier = new BDDAccesPanier(Settings1.Default.ChaineDeConnection); BDDAccesUtilisateur bddUser = new BDDAccesUtilisateur(Settings1.Default.ChaineDeConnection); private DataTable dtLSTArticle; private BindingSource bsLSTArticle; Panier panier; public ConfigCommande() { panier = new Panier(); InitializeComponent(); List users = bddUser.ListUtilisateurs(Utilisateur.Tri_E.NONE); foreach(Utilisateur user in users) { cbUser.Items.Add(user); } cbTypeCommande.Items.Add(Panier.Type_E.Vente); cbTypeCommande.Items.Add(Panier.Type_E.Achat); cbStatus.Items.Add(Panier.Status_E.NULL); cbStatus.Items.Add(Panier.Status_E.Commander); cbStatus.Items.Add(Panier.Status_E.Envoyer); cbStatus.Items.Add(Panier.Status_E.Recu); bsLSTArticle = new BindingSource(); dtLSTArticle = new DataTable(); dtLSTArticle.Columns.Add(new DataColumn("idLSTART", System.Type.GetType("System.Int32"))); dtLSTArticle.Columns.Add("Designation", typeof(Panier.LSTArticle)); dtLSTArticle.Columns.Add("prixHTVAPc"); dtLSTArticle.Columns.Add("Quantitee"); dtLSTArticle.Columns.Add("PrixTotHTVA"); } private void visualComboBox1_SelectedIndexChanged(object sender, EventArgs e) { } private void bunifuFlatButton1_Click(object sender, EventArgs e) { this.Close(); } private void RemplirDVG(DataGridView dgv) { dtLSTArticle = new DataTable(); dtLSTArticle.Columns.Add(new DataColumn("idLSTART", System.Type.GetType("System.Int32"))); dtLSTArticle.Columns.Add("Designation", typeof(Panier.LSTArticle)); dtLSTArticle.Columns.Add("prixHTVAPc"); dtLSTArticle.Columns.Add("Quantitee"); dtLSTArticle.Columns.Add("PrixTotHTVA"); List larticles; larticles = bddPanier.listeArticlePanier(panier.idPanier); foreach (Panier.LSTArticle Tmp in larticles) dtLSTArticle.Rows.Add(Tmp.id, Tmp, $"{Math.Round(Tmp.prixHTVAPC, 2)}€",Tmp.quantitee, Tmp.prixHTVATot); bsLSTArticle.DataSource = dtLSTArticle; dgv.DataSource = bsLSTArticle; } public void RemplirDVG() { RemplirDVG(dgvLSTArt); } private void pbAdd_Click(object sender, EventArgs e) { ConfigLSTArt win = new ConfigLSTArt(dtLSTArticle); bsLSTArticle.DataSource = dtLSTArticle; dgvLSTArt.DataSource = bsLSTArticle; win.ShowDialog(); } } }