Пример #1
0
        private void BTN_EnregisterProg_Click(object sender, EventArgs e)
        {
            int      idClasse   = int.Parse(CBX_Classe.SelectedValue.ToString());
            DateTime date_debut = DTP_DateDebutProg.Value;

            //DateTime date_Fin = DTP_DateFinProg.Value;

            try
            {
                using (MySqlConnection mySqlCon = new MySqlConnection(connectionString))
                {
                    String query = $"select * from programmes where classe_idClasse = {idClasse} " +
                                   $" and date between '{date_debut.ToString("yyyy-MM-dd")}' and " +
                                   $"DATE_ADD('{date_debut.ToString("yyyy-MM-dd")}',INTERVAL 7 DAY)  and visible = true;";
                    Console.WriteLine(query);
                    MySqlCommand mySqlCommand = new MySqlCommand(query, mySqlCon);
                    mySqlCon.Open();
                    mySqlCommand.CommandType = CommandType.Text;
                    MySqlDataReader reader1 = mySqlCommand.ExecuteReader();


                    while (reader1.Read())
                    {
                        using (MySqlConnection mySqlCon2 = new MySqlConnection(connectionString))
                        {
                            Console.WriteLine("skjdkj");
                            int classeID  = int.Parse(reader1.GetString("CLASSE_idCLASSE"));
                            int adminID   = int.Parse(reader1.GetString("idADMINISTRATEUR"));
                            int profMAtID = int.Parse(reader1.GetString("idPROFESSEUR_MATIERE"));

                            DateTime date = DateTime.Parse(reader1.GetString("Date"));

                            String query2 = "INSERT INTO Programmes(Date,Heure_Debut,Heure_Fin,CLASSE_idCLASSE,idADMINISTRATEUR,idPROFESSEUR_MATIERE,visible)" +
                                            $" VALUES (DATE_ADD('{date.ToString("yyyy-MM-dd")}',INTERVAL 7 DAY), '{reader1.GetString("Heure_Debut")}', '{reader1.GetString("Heure_Fin")}'," +
                                            $" {classeID}, {adminID}, {profMAtID}, true); ";
                            Console.WriteLine(query2);
                            MySqlCommand mySqlCommand2 = new MySqlCommand(query2, mySqlCon2);
                            mySqlCon2.Open();
                            mySqlCommand2.CommandType = CommandType.Text;
                            mySqlCommand2.ExecuteReader();
                        }
                    }
                }

                Admistrateur.GridFill("ProgrammeViewFrorein", DGV_programmeGH);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error Message ");
            }
        }
Пример #2
0
        private void BTN_Login_Click(object sender, EventArgs e)
        {
            //this.Close();
            try
            {
                using (MySqlConnection mySqlCon = new MySqlConnection(connectionString))
                {
                    string login    = TXT_Utilisateur.Text.Trim();
                    string password = TXT_MotDePasse.Text.Trim();
                    if (login != "" && password != null)
                    {
                        String query = $"select * from administrateur where login = \"{login}\" and password = \"{password}\" and visible = true";

                        MySqlCommand mySqlCommand = new MySqlCommand(query, mySqlCon);
                        mySqlCon.Open();
                        mySqlCommand.CommandType = CommandType.Text;
                        MySqlDataReader reader2 = mySqlCommand.ExecuteReader();
                        if (reader2.Read())
                        {
                            if (reader2.GetString("type_utilisateur") == "Administrateur")
                            {
                                //this.Close();
                                Admistrateur oAdmistrateur = new Admistrateur();
                                oAdmistrateur.Show();
                                //this.Hide();
                            }
                            else
                            {
                                //this.Close();
                                GestionHoraire oGestionHoraire = new GestionHoraire();
                                oGestionHoraire.Show();
                                //this.Hide();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Login ou mot de passe incorrect");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Veillez entrer un nom d'utilisater et mot de passe!!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error Message ");
            }
        }
Пример #3
0
 private void GestionHoraire_Load(object sender, EventArgs e)
 {
     Admistrateur.ComboFill("ProgrammeClasseComboViewAll", ref CBX_Classe, "nom", "idClasse");
     Admistrateur.GridFill("ProgrammeViewFrorein", DGV_programmeGH);
 }