Esempio n. 1
0
        private void label2_Click(object sender, EventArgs e) // retour
        {
            Formations afficher = new Formations();

            afficher.Show();
            this.Hide();
        }
Esempio n. 2
0
        /// <summary>
        /// Supprime une formation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            this.Open();

            string idSup = listView1.SelectedItems[0].Text;

            try
            {
                this.connection.Open();
                MySqlCommand cmd = this.connection.CreateCommand();

                cmd.CommandText = "delete FROM formation WHERE id_formation = \"" + idSup + "\"";
                cmd.ExecuteNonQuery();

                this.connection.Close();
            }
            catch
            {
                MessageBox.Show("Erreur de connexion à la base de donnée");
            }


            Formations afficher = new Formations();

            afficher.Show();
            this.Hide();
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            Formations afficher = new Formations();

            afficher.Show();
            this.Hide();
        }
Esempio n. 4
0
        private void button2_Click(object sender, EventArgs e) // valider
        {
            string libelle = textBox1_libelle.Text;
            string code    = textBox1_code.Text;

            string comboBox1 = comboBox1_personnel.SelectedItem.ToString();

            this.Open();

            try
            {
                this.connection.Open();

                MySqlCommand cmd = this.connection.CreateCommand();

                MessageBox.Show(cmd.ToString());

                cmd.CommandText = "INSERT INTO formation ( libelle_formation, code_formation, id_personnel_formation) VALUES ( \""
                                  + libelle + "\", \"" + code + "\", \"" + comboBox1 + "\")";

                cmd.ExecuteNonQuery();
                this.connection.Close();
            }
            catch
            {
                MessageBox.Show("Erreur de connexion à la base de donnée");
            }

            this.Hide();
            Formations afficher = new Formations();

            afficher.Show();
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e) // valider
        {
            string id2       = textBox1_id.Text;
            string nom2      = textBox1_libelle.Text;
            string code      = textBox2_code.Text;
            string comboBox2 = comboBox1_personnel.SelectedItem.ToString(); // personnel

            string dateRecup  = dateTimePicker1.Text;                       // date debut
            string dateRecup2 = dateTimePicker2.Text;                       // date fin

            this.Open();

            this.connection.Open();

            MySqlCommand cmdPers = this.connection.CreateCommand();

            cmdPers.CommandText = "select id_personnel from personnel where nom_personnel=\"" + comboBox2 + "\";";
            MySqlDataReader readPers = cmdPers.ExecuteReader();

            readPers.Read();
            int stringPers = readPers.GetInt32(0);

            this.connection.Close();

            try
            {
                this.connection.Open();

                MySqlCommand cmd3 = this.connection.CreateCommand();
                cmd3.CommandText = "UPDATE formation SET libelle_formation=\"" + nom2 + "\",code_formation=\"" + code + "\",id_personnel_formation=\"" + stringPers + "\",date_debut_formation=\"" + dateRecup + "\",date_fin_formation=\"" + dateRecup2 + "\" WHERE id_formation=\"" + id2 + "\";";
                cmd3.ExecuteNonQuery();
                this.connection.Close();
            }
            catch
            {
                MessageBox.Show("Erreur de connexion à la base de donnée2");
            }


            Formations afficher = new Formations();

            afficher.Show();
            this.Hide();
        }
Esempio n. 6
0
        private void button2_Click(object sender, EventArgs e) // valider
        {
            string libelle = textBox1_libelle.Text;
            string code    = textBox1_code.Text;

            string dateRecup  = dateTimePicker1.Text;
            string dateRecup2 = dateTimePicker2.Text;

            string comboBox1      = comboBox1_personnel.SelectedItem.ToString();
            string comboBoxClient = comboBox1_client.SelectedItem.ToString();

            this.Open();

            this.connection.Open();

            // recuperer l'id avec le nom
            MySqlCommand cmdPers = this.connection.CreateCommand();

            cmdPers.CommandText = "select id_personnel from personnel where nom_personnel=\"" + comboBox1 + "\";";
            MySqlDataReader readPers = cmdPers.ExecuteReader();

            readPers.Read();
            int stringPers = readPers.GetInt32(0);

            this.connection.Close();

            this.connection.Open();

            // recuperer l'id avec le nom
            MySqlCommand cmdCli = this.connection.CreateCommand();

            cmdCli.CommandText = "select id_client from client where nom_client=\"" + comboBoxClient + "\";";
            MySqlDataReader readCli = cmdCli.ExecuteReader();

            readCli.Read();
            int stringCli = readCli.GetInt32(0);

            this.connection.Close();

            try
            {
                this.connection.Open();

                MySqlCommand cmd = this.connection.CreateCommand();

                cmd.CommandText = "INSERT INTO formation ( libelle_formation, code_formation, id_client_formation, id_personnel_formation, date_debut_formation, date_fin_formation) VALUES ( \""
                                  + libelle + "\", \"" + code + "\", \"" + stringCli + "\", \"" + stringPers + "\", \"" + dateRecup + "\", \"" + dateRecup2 + "\")";

                cmd.ExecuteNonQuery();
                this.connection.Close();
            }
            catch
            {
                MessageBox.Show("Erreur de connexion à la base de donnée");
            }


            Formations afficher = new Formations();

            afficher.Show();
            this.Hide();
        }