protected void AddJour_Click(object sender, EventArgs e)
        {
            String       sql   = "Insert into JoursDeClasses(JourDescription) values(@JourDescription)";
            SqlParameter jDesc = new SqlParameter("@JourDescription", DbType.String.ToString());

            jDesc.Value = txtJour.Text;
            bool bRes = donnees.IssueCommandWithParams(sql, jDesc);
        }
Beispiel #2
0
        protected void AddHeure_Click(object sender, EventArgs e)
        {
            String       sql   = "Insert into HeuresDeClasses(HeureDescription,Categorie) values(@HeureDescription,@Categorie)";
            SqlParameter HDesc = new SqlParameter("@HeureDescription", DbType.String.ToString());

            HDesc.Value = txtHeure.Text;
            SqlParameter HCategorie = new SqlParameter("@Categorie", DbType.String.ToString());

            HCategorie.Value = DroClasseCat.SelectedItem.Text;
            bool bRes = donnees.IssueCommandWithParams(sql, HDesc, HCategorie);
        }
 public void RemplirDropDownClasse()
 {
     lblError.InnerText = string.Empty;
     try
     {
         if (txtNomClasse.Text == string.Empty)
         {
             lblError.InnerText = ("Le Nom de la classe est obligatoire");
         }
         else if (txtDescClasse.Text == string.Empty)
         {
             lblError.InnerText = ("La description est obligatoire");
         }
         else if (txtNiveau.Text == string.Empty)
         {
             lblError.InnerText = ("Le Niveau est obligatoire");
         }
         else if (txtCategorie.Text == string.Empty)
         {
             lblError.InnerText = ("Le champ du gategorie est obligatoire");
         }
         else
         {
             String       sql     = "Insert into Classes(NomClasse,Description,NiveauClasse,Categorie) values(@NomClasse,@Description,@Niveau,@Categorie)";
             SqlParameter nClasse = new SqlParameter("@NomClasse", DbType.String.ToString());
             nClasse.Value = txtNomClasse.Text;
             SqlParameter Descrip = new SqlParameter("@Description", DbType.String.ToString());
             Descrip.Value = txtDescClasse.Text;
             SqlParameter niveau = new SqlParameter("@Niveau", DbType.String.ToString());
             niveau.Value = txtNiveau.Text;
             SqlParameter categorie = new SqlParameter("@Categorie", DbType.String.ToString());
             categorie.Value = txtCategorie.Text;
             bool bRes = donnees.IssueCommandWithParams(sql, nClasse, Descrip, niveau, categorie);
             if (bRes == true)
             {
                 txtNomClasse.Text  = string.Empty;
                 txtDescClasse.Text = string.Empty;
                 txtNiveau.Text     = string.Empty;
                 txtCategorie.Text  = string.Empty;
                 lblError.InnerText = string.Empty;
                 lblError.InnerText = "Sauvegarder Avec Succes...!!!";
             }
             else
             {
                 lblError.InnerText = ("Error...!!");
             }
         }
     }
     catch (Exception e)
     {
         lblError.InnerText = ("Error...!!" + e);
     }
 }
Beispiel #4
0
        protected void btnSalleName_Click(object sender, EventArgs e)
        {
            String       sqlAnn = "Insert into SalleDeClasses(NomSalle,SalleDescription) values(@NomSalle,@SalleDescription)";
            SqlParameter nParam = new SqlParameter("@NomSalle", DbType.String.ToString());

            nParam.Value = txtSallDeClasse.Text.Trim();
            SqlParameter dParam = new SqlParameter("@SalleDescription", DbType.String.ToString());

            dParam.Value = txtDescriptionSalle.Text.Trim();
            bool bRes;

            if (bRes = donnees.IssueCommandWithParams(sqlAnn, nParam, dParam))
            {
                txtSallDeClasse.Text     = "";
                txtDescriptionSalle.Text = "";
            }
        }
        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);
                }
            }
        }
        /// <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);;
            }
        }
        protected void btnAddSession_Click(object sender, EventArgs e)
        {
            String sSql = String.Empty;
            String sID  = String.Empty;

            if (CheckBox1.Checked == false)
            {
                String sqlup = "Update DatesSessionCourante set Actif =0 WHERE Actif = 1";
                donnees.IssueCommand(sqlup);
                String       sql       = "Insert into DatesSessionCourante (SessionDateDebut,SessionDateFin,Remarque) values(@DateDebut,@DateFin,@Remarque)";
                SqlParameter dateDebut = new SqlParameter("@DateDebut", DbType.String.ToString());
                dateDebut.Value = DateDebut.Text;
                SqlParameter dateFin = new SqlParameter("@DateFin", DbType.String.ToString());
                dateFin.Value = DateFin.Text;
                SqlParameter remarque = new SqlParameter("@Remarque", DbType.String.ToString());
                remarque.Value = SessionRemarque.Text;
                bool bResult;//= donnees.IssueCommandWithParams(sql, dateDebut, dateFin, remarque);
                if (bResult = donnees.IssueCommandWithParams(sql, dateDebut, dateFin, remarque))
                {
                    // //sID = "lblSessionDateID";
                    //// sSql = "UPDATE DatesSessionCourante SET Actif = 0 WHERE SessionDateID = @SessionDateID";
                    // SqlParameter ParamSessionDateID = new SqlParameter("@SessionDateID", SqlDbType.Int);
                    // ParamSessionDateID.Value = Int32.Parse(sID);
                    // if (!DB_Access.IssueCommandWithParams(sSql, ParamSessionDateID))
                    // {
                    //     lblError.InnerText = "ERREUR Technique !!!!";
                    // }

                    // Update Table Sessions pour réfléter le changement
                    //sSql = "UPDATE Sessions SET Actif = 0 WHERE DateCommence IN (SELECT SessionDateDebut FROM DatesSessionCourante WHERE SessionDateID = @SessionDateID) AND DateFin IN (SELECT SessionDateFin FROM DatesSessionCourante WHERE SessionDateID = @SessionDateID)";
                    sSql = "UPDATE Sessions SET Actif = 0 WHERE Actif =1";
                    if (!donnees.IssueCommand(sSql))
                    {
                        lblError.InnerText = "ERREUR Les Classes sont toujours actives !!";
                    }


                    CheckBox1.Checked    = false;
                    DateDebut.Text       = ("");
                    DateFin.Text         = ("");
                    SessionRemarque.Text = ("");
                }
            }
            else if (CheckBox1.Checked == true)
            {
                String       sql       = "Update AddSession set DateDebut =@DateDebut,DateFin=@DateFin,Remarque=@Remarque WHERE Actif = 1";
                SqlParameter dateDebut = new SqlParameter("@DateDebut", DbType.String.ToString());
                dateDebut.Value = DateDebut.Text;
                SqlParameter dateFin = new SqlParameter("@DateFin", DbType.String.ToString());
                dateFin.Value = DateFin.Text;
                SqlParameter remarque = new SqlParameter("@Remarque", DbType.String.ToString());
                remarque.Value = SessionRemarque.Text;
                bool bResult;//= donnees.IssueCommandWithParams(sql, dateDebut, dateFin, remarque);
                if (bResult = donnees.IssueCommandWithParams(sql, dateDebut, dateFin, remarque))
                {
                    CheckBox1.Checked             = false;
                    DateDebut.Text                = ("");
                    DateFin.Text                  = ("");
                    SessionRemarque.Text          = ("");
                    debuSessionCourante.InnerText = "";
                    FinSessionCourante.InnerText  = "";
                }
            }
            else
            {
                Response.Write("Les dates sont obligatoires");
            }
        }
        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();
            }
        }