protected void Page_Load(object sender, EventArgs e) { String sqlDa = "SELECT Nom, Prenom, DateCreee FROM Personnes"; gridviewId.DataSource = donnees.GetDataSet(sqlDa); gridviewId.DataBind(); }
/// <summary> /// Methode pou ou chwazi sujet pou mete nan textbox /// </summary> void choisirSujet() { string remplirdrop = "SELECT '1-Choisissez un Sujet' as Categorie UNION SELECT DISTINCT Categorie from Classes group by Categorie Order By Categorie"; DataSet ds = new DataSet(); ds = donnees.GetDataSet(remplirdrop); this.DrchoisirSujet.DataSource = ds; DrchoisirSujet.DataValueField = "Categorie"; DrchoisirSujet.DataBind(); DropDownListOption2.Enabled = false; DropDownListOptionhoraire2.Enabled = false; }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "Etudiants dans la session courante") { String sqlDa = "SELECT Nom FROM Personnes WHERE Etudiant = 1 order by Nom ASC"; donnees = new BaseDeDonnees(); lstTousEtudiants.DataSource = donnees.GetDataSet(sqlDa); lstTousEtudiants.DataTextField = "Nom"; lstTousEtudiants.DataBind(); } else if (DropDownList1.SelectedValue == "Tous les Etudiants") { string sqlDa = "SELECT PersonneID, Nom + ', ' + Prenom + ', ' + DDN + ', ' +Telephone1 as NomComplet FROM Personnes WHERE Etudiant = 1 ORDER BY Nom, Prenom"; donnees = new BaseDeDonnees(); lstTousEtudiants.DataSource = donnees.GetDataSet(sqlDa); lstTousEtudiants.DataTextField = "Prenom"; lstTousEtudiants.DataBind(); } //else if (DropDownList1.SelectedValue == "Liste par défaut") //{ // String sqlDa = "SELECT Nom +' , '+ Prenom as NomComplet FROM Personnes WHERE Etudiant = 1 order by Nom"; // donnees = new BaseDeDonnees(); // lstTousEtudiants.DataSource = donnees.GetDataSet(sqlDa); // lstTousEtudiants.DataTextField = "NomComplet"; // lstTousEtudiants.DataBind(); //} }
protected void Recherche_TextChanged1(object sender, EventArgs e) { String sqlDa = "select DISTINCT Nom +', ' + Prenom as NomComplet, Nom, Prenom, DateCreee FROM Personnes where Nom LIKE '%' +'" + Recherche.Text + "'+ '%' OR Prenom LIKE '%'+'" + Recherche.Text + "' + '%' OR Nom+' '+ Prenom LIKE '%'+'" + Recherche.Text + "'+ '%'"; BaseDeDonnees donne = new BaseDeDonnees(); lstTousEtudiant.DataSource = donne.GetDataSet(sqlDa); lstTousEtudiant.DataBind(); }
void RemplirDroppdownhoraire() { string remplirdropop = "Select 0 As SessionID, '3-Choisissez Un Horaire' As SessionName from Sessions UNION Select SessionID, JourRencontre + ': ' + Heures As SessionName FROM Sessions WHERE Actif = 1 AND ClasseID = " + DropDownListNiveau.SelectedValue; BaseDeDonnees dropdownoptionheur = new BaseDeDonnees(); DataSet da = new DataSet(); da = dropdownoptionheur.GetDataSet(remplirdropop); this.DropDownListOptionhoraire1.DataSource = da; DropDownListOptionhoraire1.DataValueField = "SessionID"; DropDownListOptionhoraire1.DataTextField = "SessionName"; DropDownListOptionhoraire1.DataBind(); }
void RemplirDroppdownhoraire1() { String remplirdropop = "Select SessionID, JourRencontre + ': ' + Heures As SessionName From Sessions Where Actif = 1"; BaseDeDonnees dropdownoptionheur1 = new BaseDeDonnees(); DataSet dc = new DataSet(); dc = dropdownoptionheur1.GetDataSet(remplirdropop); this.DropDownListOptionhoraire2.DataSource = dc; DropDownListOptionhoraire2.DataValueField = "SessionName"; DropDownListOptionhoraire2.DataBind(); DropDownListOptionhoraire2.Items.Insert(0, new ListItem("Choisir Autre Horaire")); }
void remplireniveau() { //String remplirdropop = "Select SessionID, JourRencontre + ': ' + Heures As SessionName From Sessions Where Actif = 1"; string remplirdropop = string.Format("SELECT -1 as ClasseID, '2-Choisissez Une Classe' as NomClasse UNION SELECT ClasseID, NomClasse from Classes WHERE Categorie ='{0}'", DrchoisirSujet.SelectedValue); BaseDeDonnees dropdownoptionheur1 = new BaseDeDonnees(); DataSet dc = new DataSet(); dc = dropdownoptionheur1.GetDataSet(remplirdropop); this.DropDownListNiveau.DataSource = dc; DropDownListNiveau.DataValueField = "ClasseID"; DropDownListNiveau.DataTextField = "NomClasse"; DropDownListNiveau.DataBind(); }
public void SelectActifProf() { string sSql = "SELECT CONCAT (Nom,Prenom) , Nom +' '+ Prenom as NomProfActif,PersonneID FROM Personnes WHERE Professeur = 1 "; donnees = new BaseDeDonnees(); //DataTable ds = new DataTable(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sSql); this.ChProfActifID.DataSource = ds; ChProfActifID.DataValueField = "PersonneID"; ChProfActifID.DataTextField = "NomProfActif"; ChProfActifID.DataBind(); }
//Method Search public void SearchBox() { String search1 = txtSearch.Text.Trim().ToLower().ToString(); if (!string.IsNullOrEmpty(search1) && search1.Contains(lstTousEtudiants.Text)) { String sSql = "select DISTINCT PersonneID, Nom +', ' + Prenom as NomComplet, Nom, Prenom FROM Personnes where Nom LIKE '%' +'" + search1 + "'+ '%' OR Prenom LIKE '%'+'" + search1 + "' + '%' OR Nom+' '+ Prenom LIKE '%'+'" + search1 + "'+ '%'"; donnees = new BaseDeDonnees(); lstTousEtudiants.DataSource = donnees.GetDataSet(sSql); lstTousEtudiants.DataTextField = "NomComplet"; lstTousEtudiants.DataBind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageBox", "alert('Le nom que vous chercher n'existe pas a la classe');", true); } }
private void RemplirListeClassesSessions() { string sSql = "SELECT SessionID, JourRencontre + ': ' + Heures '++' As SessionName FROM Sessions WHERE Actif = 1"; donnees = new BaseDeDonnees(); DataSet ds = new DataSet(); //DataTable ds = new DataTable(); ds = donnees.GetDataSet(sSql); // lstToutEtudiant.Rows.(ds); //SqlDataAdapter da = new SqlDataAdapter(sSql, sqlConn); //DataTable dTable = new DataTable(); // da.Fill(dTable); this.lstClasseAjouter.DataSource = ds; lstClasseAjouter.DataValueField = "SessionID"; lstClasseAjouter.DataTextField = "SessionName"; lstClasseAjouter.DataBind(); }
private void RemplirClassePourEtudiantChoissi() { string sSql = "SELECT E.EtudiantsCourantsID, S.SessionID, S.JourRencontre + ': ' + S.Heures As SessionName FROM Sessions S,Classes C, EtudiantsCourants E WHERE S.ClasseID = C.ClasseID AND S.SessionID = E.SessionID AND S.Actif = 1 AND PersonneID = " + lstTousEtudiant.SelectedValue; donnees = new BaseDeDonnees(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sSql); // lstToutEtudiant.Rows.(ds); //SqlDataAdapter da = new SqlDataAdapter(sSql, sqlConn); DataTable dTable = new DataTable(); // da.Fill(dTable); this.lstClasseEnlver.DataSource = ds; lstClasseEnlver.DataValueField = "EtudiantsCourantsID"; lstClasseEnlver.DataTextField = "SessionName"; lstClasseEnlver.DataBind(); }
/// <summary> /// Cette méthode permet d'afficher la liste de options dans une dropdownliste /// </summary> public void RemplirSujet() { if (ListeCours.SelectedValue != null) { string sSql = "SELECT '1-Choisissez un Sujet' as Categorie UNION SELECT DISTINCT Categorie from Classes group by Categorie Order By Categorie"; DataSet ds = new DataSet(); ds = donnees.GetDataSet(sSql); this.ListeCours.DataSource = ds.Tables[0]; ListeCours.DataTextField = "Categorie"; ListeCours.DataBind(); } }
public void RemplirLesList() { // string sSql = "SELECT DISTINCT Nom, Prenom, P.PersonneID, Nom + ', ' + Prenom as NomComplet FROM Personnes P, EtudiantsCourants E WHERE P.PersonneID = E.PersonneID AND Etudiant = 1 ORDER BY Nom, Prenom, NomComplet, P.PersonneID"; String sSql = "SELECT CONCAT(Nom,' ',Prenom ) AS NomComplet FROM Personnes WHERE Etudiant = 1"; // string sSql = "SELECT DISTINCT Nom, Prenom, P.PersonneID, Nom + ' ' + Prenom as NomComplet FROM Personnes P, EtudiantsCourants E WHERE P.PersonneID = E.PersonneID AND Etudiant = 1 ORDER BY Nom, Prenom, NomComplet, P.PersonneID"; donnees = new BaseDeDonnees(); DataSet ds = new DataSet(); //DataTable ds = new DataTable(); ds = donnees.GetDataSet(sSql); // BaseDeDonnees [] Table ; // lstToutEtudiant.Rows.(ds); this.lstTousEtudiant.DataSource = ds; //lstTousEtudiant.DataValueField = "PersonneID"; lstTousEtudiant.DataTextField = "NomComplet"; lstTousEtudiant.DataBind(); }
void RemplirDropProfesseur() { try { string sSql = "SELECT -1 as PersonneID, 'Choisir professeur pour la classe' as Nom UNION SELECT PersonneID, Nom + ', ' + Prenom AS Nom from Personnes WHERE Professeur = 1"; donnees = new BaseDeDonnees(); //DataTable ds = new DataTable(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sSql); this.DrpProfesseurName.DataSource = ds; DrpProfesseurName.DataValueField = "PersonneID"; DrpProfesseurName.DataTextField = "Nom"; DrpProfesseurName.DataBind(); //dJourDeClasse.Items.Insert(0, new ListItem("Choisir le(s) jour(s) de classe", "0")); } catch (Exception ex) { string sError = ex.Message.ToString(); Debug.WriteLine(sError); sError = ""; } }
void RemplirDropdownClasse() { try { string sql = "SELECT ClasseID, NomClasse FROM Classes"; donnees = new BaseDeDonnees(); //DataTable ds = new DataTable(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sql); this.NomClasse.DataSource = ds; NomClasse.DataValueField = "ClasseID"; NomClasse.DataTextField = "NomClasse"; NomClasse.DataBind(); NomClasse.Items.Insert(0, new ListItem("Choisir la Classe", "0")); } catch (Exception ex) { string sError = ex.Message.ToString(); Debug.WriteLine(sError); sError = ""; } }
void RemplirDropdownJourDeClasse() { try { string sql = "SELECT JourID,JourDescription FROM JoursDeClasses"; donnees = new BaseDeDonnees(); //DataTable ds = new DataTable(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sql); this.dJourDeClasse.DataSource = ds; dJourDeClasse.DataValueField = "JourID"; dJourDeClasse.DataTextField = "JourDescription"; dJourDeClasse.DataBind(); dJourDeClasse.Items.Insert(0, new ListItem("Choisir le(s) jour(s) de classe", "0")); } catch (Exception ex) { string sError = ex.Message.ToString(); Debug.WriteLine(sError); sError = ""; } }
public void Dernier_Etudiant_Inscrit() { //String remplirdropop = "Select SessionID, JourRencontre + ': ' + Heures As SessionName From Sessions Where Actif = 1"; //string sSql = "SELECT PersonneID, Nom + ', ' + Prenom as NomComplet FROM Personnes WHERE Etudiant = 1 ORDER BY Nom, Prenom"; BaseDeDonnees donnees = new BaseDeDonnees(); String user = BaseDeDonnees.GetWindowsUser(); // String Administrator = System.Security.Principal.WindowsIdentity.GetCurrent().Name; //String sSql = "SELECT PersonneID, Nom + ', ' + Prenom as NomComplet From Personnes WHERE Etudiant = 1 AND CreeParUsername = '******' AND PersonneID = (Select MAX(Personnes.PersonneID) From Personnes)"; String sSql = ("SELECT PersonneID,Nom + ' ' + Prenom + '---' + replace(convert(nvarchar,Isnull(DDN,'')), '1900-01-01', 'N/A') as NomComplet From Personnes, DatesSessionCourante D WHERE Etudiant = 1 AND D.actif = 1 AND CreeParUsername = '******' order by Personnes.PersonneID DESC"); //'" + user.Trim(); //String sSql = String.Format("SELECT P.PersonneID, P.Nom + ', ' + P.Prenom + '--' + replace(convert(nvarchar,Isnull(P.DDN,'')), '1900-01-01', 'N/A') as NomComplet " + // "FROM Personnes P,EtudiantsCourants E,DatesSessionCourante D, Sessions S WHERE E.PersonneID = P.PersonneID AND E.SessionID = S.SessionID AND Etudiant = 1 AND D.actif = 1 ORDER BY NomComplet"); DataSet dc = new DataSet(); dc = donnees.GetDataSet(sSql); this.lstEtudiant.DataSource = dc; lstEtudiant.DataValueField = "PersonneID"; lstEtudiant.DataTextField = "NomComplet"; lstEtudiant.DataBind(); this.lstEtudiant.SelectedIndex = 0; }
void RemplirDropHeure() { try { donnees = new BaseDeDonnees(); string sSql = string.Format("SELECT -1 as HeureID, 'Cliquez pour Choisir' as HeureDescription UNION SELECT HeureID, HeureDescription from HeuresDeClasses H, Classes C WHERE C.ClasseID = {0} AND H.Categorie = C.Categorie", NomClasse.SelectedValue.ToString()); // String sSql = "SELECT -1 as HeureID, 'Cliquez pour Choisir' as HeureDescription UNION SELECT HeureID, HeureDescription from HeuresDeClasses H, Classes C WHERE C.ClasseID = ClasseID AND H.Categorie = C.Categorie"; //DataTable ds = new DataTable(); DataSet ds = new DataSet(); ds = donnees.GetDataSet(sSql); this.DropHeureDeClasse.DataSource = ds; DropHeureDeClasse.DataValueField = "HeureID"; DropHeureDeClasse.DataTextField = "HeureDescription"; DropHeureDeClasse.DataBind(); // DropHeureDeClasse.Items.Insert(0, new ListItem("Choisir l'heure de classe", "0")); } catch (Exception ex) { string sError = ex.Message.ToString(); Debug.WriteLine(sError); sError = ""; } }