private void AfficherSpecialites() { t_specialites = new DataTable(); t_specialites.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32"))); t_specialites.Columns.Add(new DataColumn("Spécialité")); t_specialites.Columns.Add(new DataColumn("Médecin")); List <C_t_medecins> lTmp_Med = new G_t_medecins(sConnexion).Lire("Nom"); List <C_t_specialites> lTmp_Spe = new G_t_specialites(sConnexion).Lire("NomSpe"); foreach (C_t_specialites spe in lTmp_Spe) { t_specialites.Rows.Add(spe.IDSpe, spe.NomSpe); foreach (C_t_medecins m in lTmp_Med) { if (spe.IDSpe == m.IDSpe) { t_specialites.Rows.Add(null, "", m.NomMed + " " + m.PrenomMed); } } } bs_specialites = new BindingSource(); bs_specialites.DataSource = t_specialites; dgvSpecialites.DataSource = bs_specialites; // Bloque du tri sur les colonnes \\ dgvSpecialites.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; dgvSpecialites.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; dgvSpecialites.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; // désactive le fait d'avoir la première cellule sélectionnée \\ dgvSpecialites.FirstDisplayedCell.Selected = false; }
public static BindingSource AfficherMedecins() { DataTable t_medecins = new DataTable(); //t_medecins.Columns.Add(new DataColumn("IDMed", System.Type.GetType("System.Int32"))); t_medecins.Columns.Add(new DataColumn("Nom")); t_medecins.Columns.Add(new DataColumn("Prénom")); t_medecins.Columns.Add(new DataColumn("GSM")); t_medecins.Columns.Add(new DataColumn("Spécialité")); t_medecins.Columns.Add(new DataColumn("Date de naissance")); List <C_t_medecins> lTmp_Med = new G_t_medecins(TablesDeDonnees.SConnexion).Lire("ID"); List <C_t_specialites> lTmp_Spe = new G_t_specialites(TablesDeDonnees.SConnexion).Lire("ID"); foreach (C_t_medecins m in lTmp_Med) { string Nom_Spe = ""; foreach (C_t_specialites spe in lTmp_Spe) { if (m.IDSpe == spe.IDSpe) { Nom_Spe = spe.NomSpe; break; } } t_medecins.Rows.Add(m.NomMed, m.PrenomMed, m.GSMMed.ToString(), Nom_Spe, m.DateNaisMed.Value.ToShortDateString()); } BindingSource bs_medecins = TablesDeDonnees.bs_medecins; bs_medecins.DataSource = t_medecins; return(bs_medecins); }
private void AfficherMedecins() { t_medecins = new DataTable(); t_medecins.Columns.Add(new DataColumn("IDMed", System.Type.GetType("System.Int32"))); t_medecins.Columns.Add(new DataColumn("Nom")); t_medecins.Columns.Add(new DataColumn("Prénom")); t_medecins.Columns.Add(new DataColumn("GSM")); t_medecins.Columns.Add(new DataColumn("Spécialité")); t_medecins.Columns.Add(new DataColumn("Date de naissance")); List <C_t_medecins> lTmp_Med = new G_t_medecins(sConnexion).Lire("Nom"); List <C_t_specialites> lTmp_Spe = new G_t_specialites(sConnexion).Lire("NomSpe"); foreach (C_t_medecins m in lTmp_Med) { string Nom_Spe = ""; foreach (C_t_specialites spe in lTmp_Spe) { if (m.IDSpe == spe.IDSpe) { Nom_Spe = spe.NomSpe; break; } } t_medecins.Rows.Add(m.IDMed, m.NomMed, m.PrenomMed, m.GSMMed.ToString(), Nom_Spe, m.DateNaisMed); } bs_medecins = new BindingSource(); bs_medecins.DataSource = t_medecins; dgvMedecins.DataSource = bs_medecins; }
private void AfficherSpecialites() { t_specialites = new DataTable(); t_specialites.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32"))); t_specialites.Columns.Add(new DataColumn("Spécialité")); List <C_t_specialites> lTmp_Spe = new G_t_specialites(sConnexion).Lire("NomSpe"); foreach (C_t_specialites spe in lTmp_Spe) { t_specialites.Rows.Add(spe.IDSpe, spe.NomSpe); } bs_specialites = new BindingSource(); bs_specialites.DataSource = t_specialites; dgvModifSpecialites.DataSource = bs_specialites; }
private void AfficherMedecins() { t_medecins = new DataTable(); t_medecins.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32"))); t_medecins.Columns.Add(new DataColumn("Non prénom")); t_medecins.Columns.Add(new DataColumn("Spécialité")); List <C_t_medecins> lTmp_Med = new G_t_medecins(sConnexion).Lire("NomMed"); List <C_t_specialites> lTmp_Spe = new G_t_specialites(sConnexion).Lire("NomSpe"); foreach (C_t_medecins m in lTmp_Med) { foreach (C_t_specialites s in lTmp_Spe) { if (m.IDSpe == s.IDSpe) { t_medecins.Rows.Add(m.IDMed, m.NomMed + " " + m.PrenomMed, s.NomSpe); } } } bs_medecins = new BindingSource(); bs_medecins.DataSource = t_medecins; dgvMedecinsSoi.DataSource = bs_medecins; }