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();
            //}
        }
Exemplo n.º 2
0
        protected void BtnAddClasse_Click(object sender, EventArgs e)
        {
            donnees = new BaseDeDonnees();
            string[] sTemp = new string[2];
            // Split date Debut and Date fin
            String ChaineDeConnexion = ConfigurationManager.ConnectionStrings["connection"].ToString();
            string sSql = "SELECT SessionDateID, Convert(varchar, SessionDateDebut) + ' - ' + Convert(varchar,SessionDateFin) AS SessionDate from DatesSessionCourante WHERE Actif = 1  ORDER BY SessionDateDebut DESC";

            donnees.GetDataReader(sSql);
            SqlDataAdapter da     = new SqlDataAdapter(sSql, ChaineDeConnexion);
            DataTable      dTable = new DataTable();

            da.Fill(dTable);

            //DataTableReader dt = donnees;

            DataTableReader dr = dTable.CreateDataReader();


            if (dr != null)
            {
                dr.Read();
                sTemp = dr["SessionDate"].ToString().Split('-');
                lblDateDebut.InnerText = sTemp[0].Trim();
                lblDateFin.InnerText   = sTemp[1].Trim();
            }

            // Fin
            try
            {
                if (!ToutBagayPaAnfom())
                {
                    lblError.InnerText = ("Toutes les Informations sont obligatoires Pour Continuer !!!");
                }
                else
                {
                    lblError.InnerText = string.Empty;
                    string sSql1 = string.Format("INSERT INTO Sessions(ClasseID, ProfesseurID, MaxEtudiants, JourRencontre, Heures, " +
                                                 "MontantParticipation, DateCommence, DateFin, byUsername) VALUES ({0},{1},{2},'{3}','{4}',{5},'{6}','{7}','{8}')",
                                                 NomClasse.SelectedItem.Value, DrpProfesseurName.SelectedItem.Value, txtMaxEtudiant.Text, dJourDeClasse.SelectedItem.Text,
                                                 DropHeureDeClasse.SelectedItem.Text, txtMontant.Text, lblDateDebut.InnerText, lblDateFin.InnerText, BaseDeDonnees.GetWindowsUser()); //donnees.GetWindowsUser()

                    if (donnees.IssueCommand(sSql1))
                    {
                        lblSucces.Text = "Données sauvegardees avec succes !!";
                        ResetToutBagay();   // Pou ka rantre lòt donnees
                    }
                    else
                    {
                        lblError.InnerText = "ERROR: Données PAS Sauvegardées -- Voir Un Technicien!!!";
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.InnerText = ("ERROR: Données PAS Sauvegardées " + ex);
            }
        }
        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();
        }
        /// <summary>
        /// methode pou ajouter etudiant nan class
        /// </summary>
        void ajouteretudiant()
        {
            exceptionclick();
            // Save info in ClassSession table


            string sSql = "";

            Response.Write(string.Empty);
            if (SessionRemplie())
            {
                lblMessage.Text = "Classe Remplie, Plus de places !!!";
            }
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert(' Classe Remplie, Plus de places !!! ');", true);

            else
            {
                try
                {
                    SqlParameter paramSessionID = new SqlParameter("@SessionID", SqlDbType.Int);
                    paramSessionID.Value = int.Parse(DropDownListOptionhoraire1.SelectedValue);
                    SqlParameter paramStudentID = new SqlParameter("@PersonneID", SqlDbType.Int);
                    paramStudentID.Value = int.Parse(lstEtudiant.SelectedValue);
                    SqlParameter paramUserId = new SqlParameter("@CreeParUsername", SqlDbType.VarChar);
                    paramUserId.Value = BaseDeDonnees.GetWindowsUser();

                    sSql = "INSERT INTO EtudiantsCourants (SessionID, PersonneID, CreeParUsername) VALUES (@SessionID, @PersonneID, @CreeParUsername)";

                    if (donnees.IssueCommandWithParams(sSql, paramSessionID, paramStudentID, paramUserId))
                    {
                        lblMessage.Text = "Succès: Etudiant Inscrit!";
                        //  ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert(' Succès: Etudiant Inscrit! ');", true);
                        choisirSujet();
                        DropDownListNiveau.Items.Clear();
                        DropDownListOptionhoraire1.Items.Clear();
                        btneffacer();
                        lstEtudiant.Items.Clear();
                        btnsauvegarder.Enabled = true;
                    }
                    else
                    {
                        lblMessage.Text = "ERREUR: Etudiant n'est pas inscrit!";
                        // ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert(' ERREUR: Etudiant n'est pas inscrit! ');", true);
                    }

                    //Redirect to another page
                }
                catch (Exception ex)
                {
                    Response.Write("ERROR: " + ex.Message);
                }
            }
        }
        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();
        }
        protected void btnTerminer_Click(object sender, EventArgs e)
        {
            // Save info in ClassSession table
            string sSql = "";

            if (SessionRemplie())
            {
                lblMessage.Text = ("");
            }

            else
            {
                try
                {
                    SqlParameter paramSessionID = new SqlParameter("@SessionID", SqlDbType.Int);
                    paramSessionID.Value = int.Parse(ListeHoraire.SelectedValue);
                    SqlParameter paramStudentID = new SqlParameter("@PersonneID", SqlDbType.Int);
                    paramStudentID.Value = int.Parse(lstClasse.SelectedValue);
                    SqlParameter paramUserId = new SqlParameter("@CreeParUsername", SqlDbType.VarChar);
                    paramUserId.Value = BaseDeDonnees.GetWindowsUser();

                    sSql = "INSERT INTO EtudiantsCourants (SessionID, PersonneID, CreeParUsername) VALUES (@SessionID, @PersonneID, @CreeParUsername)";


                    if (donnees.IssueCommandWithParams(sSql, paramSessionID, paramStudentID, paramUserId))
                    {
                        lblMessage.Text = ("Succès: étudiant inscrit avec succès!!!");
                    }
                    else
                    {
                        lblMessage.Text = ("Les Conditions sont-elles réunies?\n 1- Vérifier si l'étudiant n'est pas déjà inscrit dans la classe. \n 2-Avez-vous choisi les options à gauche de ta fenêtre? 3- Vérifier si l'étudiant est élligible pour la classe\n 4- Ou voir un technicien. ");
                    }

                    //Redirect to another page
                }
                catch (Exception ex)
                {
                    //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message + "');", true);
                    lblMessage.Text = ("Les Conditions sont-elles réunies?\n 1- Vérifier si vous avez choisi l'option, " +
                                       "l'horaire et la classe vous voulez inscrire l'étudiant.\n 2- Vérifier si l'étudiant est élligible pour la classe " + ex.Message);
                }
            }
        }
        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();
        }
Exemplo n.º 14
0
 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 = "";
     }
 }
Exemplo n.º 15
0
 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 = "";
     }
 }
Exemplo n.º 16
0
 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 = "";
     }
 }
        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;
        }
Exemplo n.º 18
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 = "";
     }
 }
        void selectcount()
        {
            String user  = BaseDeDonnees.GetWindowsUser().ToString().Trim();
            String sTemp = "";
            string sql   = "SELECT count(CreeParUsername)  as countuser FROM Personnes   where DateCreee= CONVERT(date, getdate())  and CreeParUsername ='******'";

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, ChaineDeConnexion);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                DataTableReader dr = dt.CreateDataReader();
                if (dr != null)
                {
                    dr.Read();
                    sTemp = dr["countuser"].ToString().Trim();
                    LblCount.ForeColor = System.Drawing.Color.Green;
                    LblCount.Text      = " Vous avez inscrit  " + sTemp + "  Etudiant(s) Pour Aujourd' ! ";
                }
            }catch (Exception e)
            {
                lblSucces.Text = ("Error: No database connection");
            }
        }
        protected void Edit()
        {
            int    etu     = 1;
            int    prof    = 0;
            int    addstaf = 0;
            string mydate;
            string sSql       = "";
            string sStudentID = "";

            lblMessage.Text = string.Empty;

            sPersonneID = txtPersonneID.Text;
            try
            {
                // ToutbagayOk();
                SqlParameter paramPersonneID = new SqlParameter("@PersonneID", SqlDbType.Int);
                if (Request["pid"] != null) // Existing student
                {
                    sStudentID            = Request["pid"].ToString();
                    paramPersonneID.Value = int.Parse(sStudentID);
                }
                else if (sPersonneID != String.Empty)
                {
                    sStudentID            = sPersonneID; // Was selected in list box of existing students/personnes
                    paramPersonneID.Value = int.Parse(sStudentID);
                }
                mydate = DateTime.Now.ToString("MM.dd.yyyy");
                SqlParameter nomparam = new SqlParameter("@Nom", DbType.String.ToString());
                nomparam.Value = txtNom.Text;
                SqlParameter prenomparam = new SqlParameter("@Prenom", DbType.String.ToString());
                prenomparam.Value = txtPrenom.Text;
                SqlParameter ddnparam = new SqlParameter("@DDN", DbType.String.ToString());
                ddnparam.Value = txtdate.Text;
                SqlParameter niveauetudeparam = new SqlParameter("@NiveauEtude", DbType.String.ToString());
                niveauetudeparam.Value = txtetude.Text;
                SqlParameter telephoneparam = new SqlParameter("@Telephone1", DbType.String.ToString());
                telephoneparam.Value = txttelephone.Text;
                SqlParameter emailparam = new SqlParameter("@Email", DbType.String.ToString());
                emailparam.Value = txtemail.Text;
                SqlParameter numeromaisonparam = new SqlParameter("@AdresseExtra", DbType.String.ToString());
                numeromaisonparam.Value = txtnumeromaison.Text;
                SqlParameter Adresserueparam = new SqlParameter("@AdresseRue", DbType.String.ToString());
                Adresserueparam.Value = txtrue.Text;
                SqlParameter Villeparam = new SqlParameter("@Ville", DbType.String.ToString());
                Villeparam.Value = txtville.Text;
                SqlParameter Remarqueparam = new SqlParameter("@Remarque", DbType.String.ToString());
                Remarqueparam.Value = txtRemarque.InnerText;
                SqlParameter UserIdparam = new SqlParameter("@CreeParUsername", DbType.String.ToString());
                UserIdparam.Value = BaseDeDonnees.GetWindowsUser();
                SqlParameter datecreparam = new SqlParameter("@DateCreee", DbType.Date);
                datecreparam.Value = mydate;
                SqlParameter profparam = new SqlParameter("@Professeur", DbType.Int32.ToString());
                profparam.Value = prof;
                SqlParameter etudiantparam = new SqlParameter("@Etudiant", DbType.Int32.ToString());
                etudiantparam.Value = etu;
                SqlParameter AdminStafparam = new SqlParameter("@AdminStaff", DbType.Int32.ToString());
                AdminStafparam.Value = addstaf;

                // Current User
                SqlParameter paramCreeParUsername = new SqlParameter("@CreeParUsername", SqlDbType.VarChar);
                paramCreeParUsername.Value = BaseDeDonnees.GetWindowsUser();

                SqlParameter Sexeparam = new SqlParameter("@Sexe", DbType.String.ToString());
                Sexeparam.Value = DrpSexe.SelectedItem.Text;

                SqlParameter departementparam = new SqlParameter("@GroupeSanguin", DbType.String.ToString());
                departementparam.Value = DropDownDepartement.SelectedItem.Text;


                SqlParameter telephone2param = new SqlParameter("@Telephone2", DbType.String.ToString());
                telephone2param.Value = Txturgence.Text;

                sSql = "UPDATE Personnes SET Prenom = @Prenom, Nom = @Nom, Telephone1 = @Telephone1, DDN = @DDN, AdresseRue = @AdresseRue, AdresseExtra = @AdresseExtra, Ville = @Ville, NiveauEtude = @NiveauEtude,  Remarque = @Remarque, Etudiant = @Etudiant, Professeur = @Professeur,AdminStaff = @AdminStaff, CreeParUsername = @CreeParUsername, Email = @Email WHERE PersonneID = @PersonneID";
                if (donnees.IssueCommandWithParams(sSql, nomparam, prenomparam, ddnparam,
                                                   niveauetudeparam, telephoneparam, emailparam, numeromaisonparam, Villeparam, datecreparam, Adresserueparam, UserIdparam, etudiantparam, profparam, AdminStafparam, Remarqueparam, paramPersonneID))
                {
                    lblSucces.Text = string.Format("'{0} {1}' est mis à jour !", txtPrenom.Text, txtNom.Text);
                    Nettoyer();
                }
                else
                {
                    lblMessage.Text = "ERREUR: Dossier n'est pas mis à jour !";
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "ERROR: " + ex.Message + string.Format("--Specific Error: ('{0} {1}') Dossier Non Modifié!", txtPrenom.Text, txtNom.Text);;
            }
        }
        void methodesauvegarder()
        {
            if (txtNom.Text == "" || txtdate.Text == "" || txtetude.Text == "" || txtPrenom.Text == "" ||
                txtrue.Text == "" || txtville.Text == "")
            {
                lblerror.Text = "Remplissez tout les champs Svp !!!";


                //  ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert('Remplissez tout les champs Svp !!! ');", true);
            }
            else
            {
                lblerror.Text = "";
                int prof    = 1;
                int etu     = 0;
                int addstaf = 0;
                nettoyertextbox();
                //lowertoupper();


                try
                {
                    //    String insereEtudiant = "INSERT INTO Personnes (Prenom,Nom,Telephone1,DDN,AdresseRue,AdresseExtra,Ville,NiveauEtude,DateCreee,Remarque,Etudiant,Professeur,AdminStaff,CreeParUsername,Email" +
                    //                           "values(@Prenom,@Nom,@Telephone1,@DDN,@AdresseRue,@AdresseExtra,@Ville,@NiveauEtude,@DateCreee,@Remarque,@Etudiant,@Professeur,@AdminStaff,@CreeParUsername,@Email)";
                    String insereEtudiant = "INSERT INTO Personnes (Prenom, Nom, Telephone1, DDN, AdresseRue, AdresseExtra, Ville, NiveauEtude, Remarque, Etudiant, Professeur, AdminStaff, CreeParUsername,Email) VALUES (" +
                                            "@Prenom, @Nom, @Telephone1,@DDN, @AdresseRue, @AdresseExtra, @Ville, @NiveauEtude, @Remarque, @Etudiant, @Professeur, @AdminStaff, @CreeParUsername,@Email)";

                    string mydate;
                    mydate = DateTime.Now.ToString("MM.dd.yyyy");
                    string       nom      = formaterNom(txtNom.Text);
                    string       prenom   = formaterNom(txtPrenom.Text);
                    SqlParameter nomparam = new SqlParameter("@Nom", DbType.String.ToString());
                    nomparam.Value = nom;
                    SqlParameter prenomparam = new SqlParameter("@Prenom", DbType.String.ToString());
                    prenomparam.Value = prenom;
                    SqlParameter ddnparam = new SqlParameter("@DDN", DbType.String.ToString());
                    ddnparam.Value = txtdate.Text;
                    SqlParameter niveauetudeparam = new SqlParameter("@NiveauEtude", DbType.String.ToString());
                    niveauetudeparam.Value = txtetude.Text;
                    SqlParameter telephoneparam = new SqlParameter("@Telephone1", DbType.String.ToString());
                    telephoneparam.Value = txtTelephone.Text;
                    SqlParameter emailparam = new SqlParameter("@Email", DbType.String.ToString());
                    emailparam.Value = txtemail.Text;
                    SqlParameter numeromaisonparam = new SqlParameter("@AdresseExtra", DbType.String.ToString());
                    numeromaisonparam.Value = txtnumeromaison.Text;
                    SqlParameter Adresserueparam = new SqlParameter("@AdresseRue", DbType.String.ToString());
                    Adresserueparam.Value = txtrue.Text;
                    SqlParameter Villeparam = new SqlParameter("@Ville", DbType.String.ToString());
                    Villeparam.Value = txtville.Text;
                    SqlParameter Remarqueparam = new SqlParameter("@Remarque", DbType.String.ToString());
                    Remarqueparam.Value = txtRemarque.InnerText;
                    SqlParameter UserIdparam = new SqlParameter("@CreeParUsername", DbType.String.ToString());
                    UserIdparam.Value = BaseDeDonnees.GetWindowsUser();
                    SqlParameter datecreparam = new SqlParameter("@DateCreee", DbType.Date);
                    datecreparam.Value = mydate;
                    SqlParameter profparam = new SqlParameter("@Professeur", DbType.Int32.ToString());
                    profparam.Value = prof;
                    SqlParameter etudiantparam = new SqlParameter("@Etudiant", DbType.Int32.ToString());
                    etudiantparam.Value = etu;
                    SqlParameter AdminStafparam = new SqlParameter("@AdminStaff", DbType.Int32.ToString());
                    AdminStafparam.Value = addstaf;
                    // SqlParameter Nifparam = new SqlParameter("@Etudiant", DbType.Int32.ToString());
                    //  Nifparam.Value = TextnifOuCin.Text; ;


                    bool bResult = donnees.IssueCommandWithParams(insereEtudiant, nomparam, prenomparam, ddnparam,
                                                                  niveauetudeparam, telephoneparam, emailparam, numeromaisonparam, Villeparam, datecreparam, Adresserueparam, UserIdparam, etudiantparam, profparam, AdminStafparam, Remarqueparam);
                }
                catch (Exception e)
                {
                    Response.Write("Ërror..." + e);
                }

                lblerror.Text = "Professeur Enregistrer avec Succes  !!! ";

                //   ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert(' Professeur Enregistrer avec Succes  !!! ');", true);
                Nettoyer();
            }
        }
        /// <summary>
        /// Methode sauvegarder
        /// </summary>
        void methodesauvegarder()
        {
            string sSql       = "";
            string sStudentID = "";

            lblMessage.Text = string.Empty;

            sPersonneID = txtPersonneID.Text;
            try
            {
                ToutbagayOk();
                SqlParameter paramPersonneID = new SqlParameter("@PersonneID", SqlDbType.Int);
                if (Request["pid"] != null) // Existing student
                {
                    sStudentID            = Request["pid"].ToString();
                    paramPersonneID.Value = int.Parse(sStudentID);
                }
                else if (sPersonneID != String.Empty)
                {
                    sStudentID            = sPersonneID; // Was selected in list box of existing students/personnes
                    paramPersonneID.Value = int.Parse(sStudentID);
                }

                int    etu     = 1;
                int    prof    = 0;
                int    addstaf = 0;
                string mydate;
                mydate = DateTime.Now.ToString("MM.dd.yyyy");
                SqlParameter nomparam = new SqlParameter("@Nom", DbType.String.ToString());
                nomparam.Value = txtNom.Text;
                SqlParameter prenomparam = new SqlParameter("@Prenom", DbType.String.ToString());
                prenomparam.Value = txtPrenom.Text;
                SqlParameter ddnparam = new SqlParameter("@DDN", DbType.String.ToString());
                ddnparam.Value = txtdate.Text;
                SqlParameter niveauetudeparam = new SqlParameter("@NiveauEtude", DbType.String.ToString());
                niveauetudeparam.Value = txtetude.Text;
                SqlParameter telephoneparam = new SqlParameter("@Telephone1", DbType.String.ToString());
                telephoneparam.Value = txttelephone.Text;
                SqlParameter emailparam = new SqlParameter("@Email", DbType.String.ToString());
                emailparam.Value = txtemail.Text;
                SqlParameter numeromaisonparam = new SqlParameter("@AdresseExtra", DbType.String.ToString());
                numeromaisonparam.Value = txtnumeromaison.Text;
                SqlParameter Adresserueparam = new SqlParameter("@AdresseRue", DbType.String.ToString());
                Adresserueparam.Value = txtrue.Text;
                SqlParameter Villeparam = new SqlParameter("@Ville", DbType.String.ToString());
                Villeparam.Value = txtville.Text;
                SqlParameter Remarqueparam = new SqlParameter("@Remarque", DbType.String.ToString());
                Remarqueparam.Value = txtRemarque.InnerText;
                SqlParameter UserIdparam = new SqlParameter("@CreeParUsername", DbType.String.ToString());
                UserIdparam.Value = BaseDeDonnees.GetWindowsUser();
                SqlParameter datecreparam = new SqlParameter("@DateCreee", DbType.Date);
                datecreparam.Value = mydate;
                SqlParameter profparam = new SqlParameter("@Professeur", DbType.Int32.ToString());
                profparam.Value = prof;
                SqlParameter etudiantparam = new SqlParameter("@Etudiant", DbType.Int32.ToString());
                etudiantparam.Value = etu;
                SqlParameter AdminStafparam = new SqlParameter("@AdminStaff", DbType.Int32.ToString());
                AdminStafparam.Value = addstaf;

                // Current User
                SqlParameter paramCreeParUsername = new SqlParameter("@CreeParUsername", SqlDbType.VarChar);
                paramCreeParUsername.Value = BaseDeDonnees.GetWindowsUser();

                SqlParameter Sexeparam = new SqlParameter("@Sexe", DbType.String.ToString());
                Sexeparam.Value = DrpSexe.SelectedItem.Text;

                SqlParameter departementparam = new SqlParameter("@GroupeSanguin", DbType.String.ToString());
                departementparam.Value = DropDownDepartement.SelectedItem.Text;


                SqlParameter telephone2param = new SqlParameter("@Telephone2", DbType.String.ToString());
                telephone2param.Value = Txturgence.Text;



                if (sStudentID == String.Empty)
                {
                    // methodesauvegarder();
                    sSql = "INSERT INTO Personnes (Prenom, Nom, Telephone1,Telephone2, DDN, AdresseRue, AdresseExtra, Ville, NiveauEtude, Remarque, Etudiant, Professeur, AdminStaff, CreeParUsername,Email,Sexe,GroupeSanguin) VALUES (" +
                           "@Prenom, @Nom, @Telephone1, @Telephone2,@DDN, @AdresseRue, @AdresseExtra, @Ville, @NiveauEtude, @Remarque, @Etudiant, @Professeur, @AdminStaff, @CreeParUsername,@Email,@Sexe,@GroupeSanguin)";

                    bool bResult = donnees.IssueCommandWithParams(sSql, nomparam, prenomparam, ddnparam,
                                                                  niveauetudeparam, telephoneparam, telephone2param, emailparam, numeromaisonparam, Villeparam, datecreparam, Adresserueparam, UserIdparam, etudiantparam, profparam, AdminStafparam, departementparam
                                                                  , Remarqueparam, Sexeparam);

                    //int iIdentity = DB_Access.GetScalarWithParams(sSql, nomparam, prenomparam, ddnparam,
                    //niveauetudeparam, telephoneparam, emailparam, numeromaisonparam, Villeparam, datecreparam, Adresserueparam, UserIdparam, etudiantparam, profparam, AdminStafparam, Remarqueparam);
                    if (bResult == true)
                    {
                        sPersonneID    = bResult.ToString();
                        lblSucces.Text = string.Format("'{0} {1}' est ajouté dans le système !", txtPrenom.Text, txtNom.Text);
                        // ClearForm();
                        Nettoyer();
                        btnsauvegarder.Enabled = false;
                    }
                    else
                    {
                        lblMessage.Text = string.Format("ERROR Adding User '{0} {1}'!", txtPrenom.Text, txtNom.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "ERROR: " + ex.Message + string.Format("--Specific Error: ('{0} {1}') Dossier Non Modifié!", txtPrenom.Text, txtNom.Text);;
            }
        }