Beispiel #1
0
        public static SQLReservation GetSQLReservationByNoreservation(MySqlConnection mySqlConnection, int noreservation)
        {
            SQLReservation sqlReservation = null;

            try
            {
                mySqlConnection.Open();
                MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM `reservation` WHERE reservation.noreservation = @noReservation", mySqlConnection);
                mySqlCommand.Parameters.AddWithValue("@noReservation", noreservation);
                using (MySqlDataReader reader = mySqlCommand.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            sqlReservation = new SQLReservation(reader.GetInt16(0), reader.GetInt16(1), reader.GetInt16(2), reader.GetDateTime(3), reader.GetDouble(4), reader.GetBoolean(5), reader.GetString(6));
                        }
                    }
                }
                mySqlConnection.Close();
            }
            finally
            {
                if (mySqlConnection.State.Equals(ConnectionState.Open))
                {
                    mySqlConnection.Close();
                }
            }

            return(sqlReservation);
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        private void ListViewReservation_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (Label label1 in labelList)
            {
                groupBoxReservation.Controls.Remove(label1);
            }
            labelList.Clear();

            int i             = 0;
            int noreservation = int.Parse(listViewReservation.SelectedItems[0].SubItems[0].Text);

            foreach (SQLEnregistrer sqlEnregistrer in SQLEnregistrer.GetAllSQLEnregistrerByNoreservation(mySqlConnection, noreservation))
            {
                Label label1 = new Label();
                label1.AutoSize = true;
                label1.Location = new System.Drawing.Point(5, 20 + 25 * i);
                label1.Name     = "label" + sqlEnregistrer.GetLibelleType();
                label1.Size     = new System.Drawing.Size(100, 15);
                label1.TabIndex = 0;
                label1.Text     = sqlEnregistrer.GetLibelleType() + " : " + sqlEnregistrer.GetQuantite().ToString();
                groupBoxReservation.Controls.Add(label1);
                labelList.Add(label1);
                i++;
            }

            SQLReservation sqlReservation = SQLReservation.GetSQLReservationByNoreservation(mySqlConnection, noreservation);
            Label          label          = new Label();

            label.AutoSize = true;
            label.Location = new System.Drawing.Point(5, 20 + 25 * i);
            label.Name     = "labelMontant";
            label.Size     = new System.Drawing.Size(100, 15);
            label.TabIndex = 0;
            label.Text     = "Montant total : " + sqlReservation.GetMontanttotal().ToString();
            groupBoxReservation.Controls.Add(label);
            labelList.Add(label);
            i++;

            label          = new Label();
            label.AutoSize = true;
            label.Location = new System.Drawing.Point(5, 20 + 25 * i);
            label.Name     = "labelTypeReglement";
            label.Size     = new System.Drawing.Size(100, 15);
            label.TabIndex = 0;
            label.Text     = "Type de règlement : " + sqlReservation.GetModedereglement();
            groupBoxReservation.Controls.Add(label);
            labelList.Add(label);
        }
Beispiel #4
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);
        }