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 Bunifu.Framework.UI; using GestionDeCommerceInfoClasseBDDNCouches; using GestionDeCommerceInfoClasseBDDNCouches.DataLayer; namespace Gestion_de_commerce_Informatique { public partial class Form1 : Form { Object panRightControl; BDDAccesUtilisateur bddUser = new BDDAccesUtilisateur(@"Data Source=(localdb)\MSSQLLOcalDB;Initial Catalog=GestionCommerceInfo;Integrated Security=True"); private DataTable dtPersonne; private BindingSource bsPersonne; public Form1() { InitializeComponent(); panRightControl = new DashBoard(); this.panRight.Controls.Add((Control)panRightControl); } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } private void btn_Click(object sender, EventArgs e) { BunifuFlatButton button = (BunifuFlatButton)sender; btnUserMannager.Normalcolor = btnCommande.Normalcolor = btnConfig.Normalcolor = btnDashBoard.Normalcolor = btnStock.Normalcolor = Color.Transparent; button.Normalcolor = Color.FromArgb(100, 0, 0, 0); switch (button.Text) { case "DashBoard": this.panRight.Controls.Remove((Control)panRightControl); panRightControl = new DashBoard(); this.panRight.Controls.Add((Control)panRightControl); break; case "Commande": this.panRight.Controls.Remove((Control)panRightControl); panRightControl = new Commande(); this.panRight.Controls.Add((Control)panRightControl); break; case "Stock": break; case "Configuration": break; case "Gestion utilisateurs": this.panRight.Controls.Remove((Control)panRightControl); panRightControl = new GestionUtilisateurs(); this.panRight.Controls.Add((Control)panRightControl); DataGridView dgvUser = ((GestionUtilisateurs)panRightControl).DgvUser; RemplirDVG(dgvUser); break; } } private void RemplirDVG(DataGridView dgv) { dtPersonne = new DataTable(); dtPersonne.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32"))); dtPersonne.Columns.Add("Nom"); List lusers; lusers = bddUser.ListUtilisateurs(Utilisateur.Tri_E.NONE); foreach (Utilisateur Tmp in lusers) dtPersonne.Rows.Add(Tmp.ID, $"{Tmp.Prenom} {Tmp.Nom}"); bsPersonne = new BindingSource(); bsPersonne.DataSource = dtPersonne; dgv.DataSource = bsPersonne; } } }