private void buttonSupprimer_Click(object sender, EventArgs e)
        {
            if (IdxLigneActuelle != -1)
            {
                DialogResult reponse = MessageBox.Show("Voulez vous vraiment supprimer le Coureur " + textBoxDossard.Text + " ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (reponse == DialogResult.Yes)
                {
                    // récup index

                    Int32 idxCourse = 0, idxCoureur = 0, idxTransp = 0;

                    // recup index club et catégorie

                    idxCourse  = Convert.ToInt32(listeDesIdxCoureurs[Convert.ToInt32(comboBoxCoureur.SelectedIndex)]);
                    idxCoureur = Convert.ToInt32(listeDesIdxCourses[Convert.ToInt32(comboBoxCourse.SelectedIndex)]);
                    idxTransp  = Convert.ToInt32(listeDesIdxTranspondeurs[Convert.ToInt32(comboBoxTranspondeur.SelectedIndex)]);


                    Inscriptions   creeInscriptions = new Inscriptions(Convert.ToInt32(textBoxDossard.Text), idxCourse, idxCoureur, idxTransp);
                    DbInscriptions SupInscriptions = new DbInscriptions();
                    (bool result, string MessErreur) = SupInscriptions.SupprimerInscription(creeInscriptions, Convert.ToInt32(textBoxID.Text));
                    if (result == false)
                    {
                        MessageBox.Show("La suppression à échouée, veuillez vérifier l'état de votre base de Données, avec le message : " + MessErreur);
                    }
                    else
                    {
                        MessageBox.Show("La suppression du dossard " + ligneSelect.Cells[1].Value.ToString() + " effectuée !");
                        MajGrid();
                    }
                }
            }
        }
Esempio n. 2
0
        public bool AjouterInscription(Inscriptions UnInscription)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "INSERT INTO `Inscription` (`NumDossard`, `coureur_IdCoureur`, `transpondeur_IdTranspondeur`, `course_IdCourse`) " +
                                     "VALUES ('" + UnInscription.NumDossard + "', '" + UnInscription.IdCoureur + "', '" + UnInscription.IdTranspondeur + "', '" + UnInscription.IdCourse + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Esempio n. 3
0
        private void buttonAjouter_Click(object sender, EventArgs e)
        {
            // récup booléen sexe et index club et categorie

            int idxCoureur = 0, idxTranspondeur = 0, idxcourse = 0;

            // recup index club et catégorie

            idxCoureur      = Convert.ToInt32(listeDesIdxCoureurs[Convert.ToInt32(comboBoxCoureur.SelectedIndex)]);
            idxTranspondeur = Convert.ToInt32(listeDesIdxTranspondeurs[Convert.ToInt32(comboBoxTranspondeur.SelectedIndex)]);
            idxcourse       = Convert.ToInt32(listeDesIdxCourses[Convert.ToInt32(comboBoxCourse.SelectedIndex)]);



            Inscriptions   creeInscription  = new Inscriptions(Convert.ToInt32(comboBoxDossard.Text), idxCoureur, idxTranspondeur, idxcourse);
            DbInscriptions AjoutInscription = new DbInscriptions();
            bool           result           = AjoutInscription.AjouterInscription(creeInscription);

            if (result == false)
            {
                MessageBox.Show("La création à échouée, veuillez vérifier l'état de votre base de Données");
            }
            else
            {
                MessageBox.Show("Création inscription Dossard numéro " + comboBoxDossard.Text + " effectuée !");
                LectureDernierDossard();
                comboBoxDossard.SelectedIndex      = 0;
                comboBoxCourse.SelectedIndex       = 0;
                comboBoxCoureur.SelectedIndex      = 0;
                comboBoxTranspondeur.SelectedIndex = 0;
            }
        }
Esempio n. 4
0
        public (bool, string) SupprimerInscription(Inscriptions UnInscription, int IdInscription)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "DELETE FROM inscription WHERE IdInscription = " + IdInscription;
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Esempio n. 5
0
        public (bool, string) ModifierInscription(Inscriptions UnInscription, int IdInscription)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "UPDATE inscription SET `NumDossard`= '" + UnInscription.NumDossard + "', `coureur_IdCoureur`= '" + UnInscription.IdCoureur + "', `transpondeur_IdTranspondeur`= '" + UnInscription.IdTranspondeur + "', `course_IdCourse`= '" + UnInscription.IdCourse + "' WHERE IdInscription = " + IdInscription + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }