Пример #1
0
        private void Free_seats_Button_Click(object sender, RoutedEventArgs e)
        {
            int movie_id = 0;

            if (string.IsNullOrEmpty(auditorium.Text))
            {
                MessageBox.Show("Izaberite prvo salu.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            connection.Open();

            string       query  = "select id from movie where title = '" + movie.SelectedItem.ToString() + "'";
            MySqlCommand cmd    = new MySqlCommand(query, connection);
            var          reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                movie_id = reader.GetInt32("id");
            }
            connection.Close();


            Free_seats free_Seats = new Free_seats(connection, rooms, movie_id, Convert.ToDateTime(screening.SelectedItem.ToString()).ToString("yyyy-MM-dd HH:mm"));

            free_Seats.Show();
        }
Пример #2
0
        private void Seats_Button_Click(object sender, RoutedEventArgs e)
        {
            if (!(auditorium.SelectedIndex == -1))
            {
                List <string> rooms            = new List <string>();
                string        query_auditorium = "select distinct a.name from movie m INNER JOIN screening scr on m.id = scr.movie_id INNER JOIN auditorium a on a.id = scr.auditorium_id where title='" + reservation_movie.SelectedItem.ToString() + "' and scr.screening_time='" + Convert.ToDateTime(reservation_screening.SelectedItem.ToString()).ToString("yyyy-MM-dd HH:mm") + "' ORDER BY screening_time ASC";
                connection.Open();
                MySqlCommand cmd    = new MySqlCommand(query_auditorium, connection);
                var          reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    auditorium.Items.Add(reader.GetString("name"));
                    rooms.Add(reader.GetString("name"));
                }
                connection.Close();

                int movie_id = 0;
                if (string.IsNullOrEmpty(auditorium.Text))
                {
                    MessageBox.Show("Izaberite prvo salu.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                connection.Open();
                string query = "select id from movie where title = '" + reservation_movie.SelectedItem.ToString() + "'";
                cmd    = new MySqlCommand(query, connection);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    movie_id = reader.GetInt32("id");
                }
                connection.Close();


                Free_seats free_Seats = new Free_seats(connection, rooms, movie_id, Convert.ToDateTime(reservation_screening.SelectedItem.ToString()).ToString("yyyy-MM-dd HH:mm"));
                free_Seats.Show();
            }
            else
            {
                MessageBox.Show("Niste izabrali salu.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
        }