2018-06-05 12:59:35 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2018-06-05 17:20:36 +02:00
|
|
|
|
using GestionDeCommerceInfoClasseBDDNCouches;
|
|
|
|
|
using GestionDeCommerceInfoClasseBDDNCouches.DataLayer;
|
2018-06-05 12:59:35 +02:00
|
|
|
|
|
|
|
|
|
namespace Gestion_de_commerce_Informatique
|
|
|
|
|
{
|
|
|
|
|
public partial class GestionUtilisateurs : UserControl
|
|
|
|
|
{
|
|
|
|
|
public DataGridView DgvUser
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return dgvUser;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.dgvUser = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-05 17:20:36 +02:00
|
|
|
|
private DataTable dtPersonne;
|
|
|
|
|
private BindingSource bsPersonne;
|
|
|
|
|
BDDAccesUtilisateur bddUser = new BDDAccesUtilisateur(@"Data Source=(localdb)\MSSQLLOcalDB;Initial Catalog=GestionCommerceInfo;Integrated Security=True");
|
2018-06-05 12:59:35 +02:00
|
|
|
|
public GestionUtilisateurs()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2018-06-05 17:20:36 +02:00
|
|
|
|
bsPersonne = new BindingSource();
|
2018-06-05 12:59:35 +02:00
|
|
|
|
this.BackColor = Color.Transparent;
|
2018-06-05 17:20:36 +02:00
|
|
|
|
RemplirDVG(dgvUser);
|
2018-06-05 12:59:35 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dgvUser_CellContentClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
object sendser = sender;
|
|
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
2018-06-05 17:20:36 +02:00
|
|
|
|
|
|
|
|
|
private void txtBoxRecherche_OnTextChange(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void lblAddUser_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ConfigurationUtilisateur ajoutUtilisateur = new ConfigurationUtilisateur(bddUser);
|
|
|
|
|
ajoutUtilisateur.ShowDialog();
|
|
|
|
|
dtPersonne.Rows.Add(ajoutUtilisateur.user.ID, $"{ajoutUtilisateur.user.Prenom} {ajoutUtilisateur.user.Nom}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtBoxRecherche_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (txtBoxRecherche.text == "Recherche")
|
|
|
|
|
txtBoxRecherche.text = "";
|
|
|
|
|
}
|
|
|
|
|
private void RemplirDVG(DataGridView dgv)
|
|
|
|
|
{
|
|
|
|
|
dtPersonne = new DataTable();
|
|
|
|
|
dtPersonne.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
|
|
|
|
|
dtPersonne.Columns.Add("Nom");
|
|
|
|
|
List<Utilisateur> lusers;
|
|
|
|
|
lusers = bddUser.ListUtilisateurs(Utilisateur.Tri_E.NONE);
|
|
|
|
|
foreach (Utilisateur Tmp in lusers)
|
|
|
|
|
dtPersonne.Rows.Add(Tmp.ID, $"{Tmp.Prenom} {Tmp.Nom}");
|
|
|
|
|
|
|
|
|
|
bsPersonne.DataSource = dtPersonne;
|
|
|
|
|
dgv.DataSource = bsPersonne;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtBoxRecherche_KeyUp(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string rowFilter = string.Format("[{0}] LIKE '%{1}%'", "Nom", txtBoxRecherche.text);//https://10tec.com/articles/datagridview-filter.aspx
|
|
|
|
|
dtPersonne.DefaultView.RowFilter = rowFilter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dgvUser_CellContentClick_1(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2018-06-05 12:59:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|