Esempio n. 1
0
        public static SQLLiaison GetSQLLiaisonBySQLReservation(MySqlConnection mySqlConnection, SQLReservation sqlReservation)
        {
            SQLLiaison sqlLiaison = null;

            try
            {
                mySqlConnection.Open();
                MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM `liaison` WHERE " +
                                                             "`noliaison` in (SELECT traversee.noliaison from traversee where traversee.notraversee = @noTraversee)", mySqlConnection);
                mySqlCommand.Parameters.AddWithValue("@noTraversee", sqlReservation.GetNotraversee());
                using (MySqlDataReader reader = mySqlCommand.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            sqlLiaison = new SQLLiaison(reader.GetInt16(0), reader.GetInt16(1), reader.GetInt16(2), reader.GetDouble(3));
                        }
                    }
                }
                mySqlConnection.Close();
            }
            finally
            {
                if (mySqlConnection.State.Equals(ConnectionState.Open))
                {
                    mySqlConnection.Close();
                }
            }

            return(sqlLiaison);
        }
 private void ListBoxSecteur_SelectedIndexChanged(object sender, EventArgs e)
 {
     SQLLiaison.InitializeComboBoxAllSQLLiaisonBySQLPort(comboBoxLiaison, mySqlConnection, (SQLSecteur)((ListBox)sender).SelectedItem);
     if (comboBoxLiaison.Items.Count > 0)
     {
         comboBoxLiaison.SelectedIndex = 0;
     }
     else
     {
         comboBoxLiaison.Text = "";
     }
 }
Esempio n. 3
0
        private void ComboBoxClient_SelectedIndexChanged(object sender, EventArgs e)
        {
            listViewReservation.Items.Clear();
            foreach (SQLReservation sqlReservation in SQLReservation.GetAllSQLReservationByNoclient(mySqlConnection, ((SQLClient)((ComboBox)sender).SelectedItem).GetNoclient()))
            {
                ListViewItem listViewItem = new ListViewItem(new string[] { sqlReservation.GetNoreservation().ToString(),
                                                                            SQLLiaison.GetSQLLiaisonBySQLReservation(mySqlConnection, sqlReservation).ToString(),
                                                                            sqlReservation.GetNotraversee().ToString(), sqlReservation.GetDateTimeWithSpecificFormat() });


                listViewReservation.Items.Add(listViewItem);
            }
        }