public void Load_State_Years() { MySqlConnection conn = new MySqlConnection(Authentification.MyString); conn.Open(); string req = "SELECT id_annee,annee,etat_annee,date, date_ouverture,date_cloture FROM annee "; MySqlDataAdapter da = new MySqlDataAdapter(req, conn); DataTable dtable = new DataTable(); da.Fill(dtable); GDV_Gestion.RowStyle.HorizontalAlign = HorizontalAlign.Center; if (dtable.Rows.Count > 0) { GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); } else { dtable.Rows.Add(dtable.NewRow()); GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); GDV_Gestion.Rows[0].Cells.Clear(); GDV_Gestion.Rows[0].Cells.Add(new TableCell()); GDV_Gestion.Rows[0].Cells[0].ColumnSpan = dtable.Columns.Count; GDV_Gestion.Rows[0].Cells[0].Text = "Aucune année académique n’a été créée à cette date"; GDV_Gestion.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } conn.Close(); }
private void Liste_Departemts_Affectes_In_GridView(int id_annee, int id_faculte) { id_annee_combo = id_annee; id_faculte_combo = id_faculte; MySqlConnection conn = new MySqlConnection(Authentification.MyString); conn.Open(); string req = "SELECT departement_par_faculte.id_departement, departement.departement" + " FROM departement_par_faculte INNER JOIN departement ON departement_par_faculte.id_departement = departement.id_departement" + " WHERE departement_par_faculte.id_annee=@id_annee AND departement_par_faculte.id_faculte=@id_faculte"; MySqlCommand cmd = new MySqlCommand(req, conn); cmd.Parameters.AddWithValue("@id_annee", id_annee); cmd.Parameters.AddWithValue("@id_faculte", id_faculte); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dtable = new DataTable(); da.Fill(dtable); GDV_Gestion.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Center; if (dtable.Rows.Count > 0) { GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); } else { dtable.Rows.Add(dtable.NewRow()); GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); GDV_Gestion.Rows[0].Cells.Clear(); GDV_Gestion.Rows[0].Cells.Add(new TableCell()); GDV_Gestion.Rows[0].Cells[0].ColumnSpan = dtable.Columns.Count; GDV_Gestion.Rows[0].Cells[0].Text = "Aucun departemnt n’a été affecté"; GDV_Gestion.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } conn.Close(); }
private void Facultes_Affectes_In_GridView(int id_annee) { MySqlConnection conn = new MySqlConnection(Authentification.MyString); conn.Open(); string req = "SELECT faculte_par_annee.id_faculte, faculte.faculte, faculte.type sigle" + " FROM faculte INNER JOIN faculte_par_annee ON faculte.id_faculte = faculte_par_annee.id_faculte" + " WHERE faculte_par_annee.id_annee=@id_annee"; MySqlCommand cmd = new MySqlCommand(req, conn); cmd.Parameters.AddWithValue("@id_annee", id_annee); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dtable = new DataTable(); da.Fill(dtable); GDV_Gestion.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Center; GDV_Gestion.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Center; if (dtable.Rows.Count > 0) { GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); } else { dtable.Rows.Add(dtable.NewRow()); GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); GDV_Gestion.Rows[0].Cells.Clear(); GDV_Gestion.Rows[0].Cells.Add(new TableCell()); GDV_Gestion.Rows[0].Cells[0].ColumnSpan = dtable.Columns.Count; GDV_Gestion.Rows[0].Cells[0].Text = "Aucune faculte/institut n’a été affecté"; GDV_Gestion.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } conn.Close(); }
private void Classes_par_Departement(int id_annee, int id_faculte, int id_departement, int operation) { id_annee_combo = id_annee; id_faculte_combo = id_faculte; id_departement_combo = id_departement; int id_operation = operation; MySqlConnection conn = new MySqlConnection(Authentification.MyString); conn.Open(); string req = "SELECT classe_par_departement.id_classe, classe.classe,classe_par_departement.etat_avancement " + " FROM classe_par_departement INNER JOIN classe ON classe_par_departement.id_classe = classe.id_classe" + " WHERE classe_par_departement.id_annee=@id_annee AND classe_par_departement.id_faculte=@id_faculte AND classe_par_departement.id_departement=@id_departement"; MySqlCommand cmd = new MySqlCommand(req, conn); cmd.Parameters.AddWithValue("@id_annee", id_annee); cmd.Parameters.AddWithValue("@id_faculte", id_faculte); cmd.Parameters.AddWithValue("@id_departement", id_departement); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dtable = new DataTable(); da.Fill(dtable); switch (id_operation) { case 1: GDV_Gestion.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Center; GDV_Gestion.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Center; GDV_Gestion.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Center; if (dtable.Rows.Count > 0) { GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); } else { dtable.Rows.Add(dtable.NewRow()); GDV_Gestion.DataSource = dtable; GDV_Gestion.DataBind(); GDV_Gestion.Rows[0].Cells.Clear(); GDV_Gestion.Rows[0].Cells.Add(new TableCell()); GDV_Gestion.Rows[0].Cells[0].ColumnSpan = dtable.Columns.Count; GDV_Gestion.Rows[0].Cells[0].Text = "Aucune classe dans ce départemnt"; GDV_Gestion.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } break; case 2: GDV_Etat_Avancement.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Center; GDV_Etat_Avancement.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Center; GDV_Etat_Avancement.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Center; if (dtable.Rows.Count > 0) { GDV_Etat_Avancement.DataSource = dtable; GDV_Etat_Avancement.DataBind(); } else { dtable.Rows.Add(dtable.NewRow()); GDV_Etat_Avancement.DataSource = dtable; GDV_Etat_Avancement.DataBind(); GDV_Etat_Avancement.Rows[0].Cells.Clear(); GDV_Etat_Avancement.Rows[0].Cells.Add(new TableCell()); GDV_Etat_Avancement.Rows[0].Cells[0].ColumnSpan = dtable.Columns.Count; GDV_Etat_Avancement.Rows[0].Cells[0].Text = "Aucune classe dans ce départemnt"; GDV_Etat_Avancement.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; } break; } conn.Close(); }