Beispiel #1
0
        /// <summary>
        /// Creates a cinema based on the arguments. It checks if the name already exists.
        /// </summary>
        public static void createCinema(string county, string city, string street, string cinemaName, string maintainerName, string houseNumber, DateTime creationTime)
        {
            //mozit menti el, ha nem létezik még
            int count = 0;

            using (SQLiteCommand command = connection.CreateCommand()) {
                command.CommandText = "SELECT NEV FROM 'Mozi' WHERE 'Mozi'.'Nev'='" + cinemaName + "'";
                command.CommandType = CommandType.Text;
                SQLiteDataReader r = command.ExecuteReader();
                while (r.Read())
                {
                    count++;
                }
            }

            LocationsHandler locH = new LocationsHandler();

            if (count == 0)
            {
                string        command = "insert into 'Mozi' ('Megye', 'IrszVarKer', 'Utca', 'H_szam', 'Nev', 'Tulaj_Nev', 'Letrehozasi_het') values ('" + county + "', '" + city + "','" + street + "', '" + houseNumber + "', '" + cinemaName + "', '" + maintainerName + "', '" + locH.weekOfTheYear(creationTime) + "')";
                SQLiteCommand insert  = new SQLiteCommand(command, connection);
                insert.ExecuteNonQuery();
            }
            else
            {
                MessageBox.Show("Már létezik " + cinemaName + " nevű mozi az adatbázisban!");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sends a movie struct into the database.
        /// </summary>
        public static void pushToDb(movie mt)
        {
            LocationsHandler loc = new LocationsHandler();

            int currWeek = loc.weekOfTheYear(),
                cinemaId = 0;

            bool isRightWeek = false;


            using (SQLiteCommand command = connection.CreateCommand()) {
                command.CommandText = "SELECT 'Mozi'.'Letrehozasi_het' FROM 'Mozi' WHERE 'Mozi'.'Nev'='" + mt.selectedCinemaName + "'";
                command.CommandType = CommandType.Text;
                SQLiteDataReader r = command.ExecuteReader();
                if (r.Read())
                {
                    if (currWeek >= int.Parse(r.GetValue(0).ToString()))
                    {
                        isRightWeek = true;
                    }
                }
                else
                {
                    MessageBox.Show("Anyukad");
                }
            }
            using (SQLiteCommand command = connection.CreateCommand()) {
                command.CommandText = "SELECT 'Mozi'.'ID' FROM 'Mozi' WHERE 'Mozi'.'Nev'='" + mt.selectedCinemaName + "'";
                command.CommandType = CommandType.Text;
                SQLiteDataReader r = command.ExecuteReader();
                if (r.Read())
                {
                    cinemaId = int.Parse(r.GetValue(0).ToString());
                }
                else
                {
                    MessageBox.Show("anyukad2");
                }
            }


            //ha a megfelelő hétbe jönnek az adatok, akkor mentsük el az adatbázisba az adatokat
            if (isRightWeek)
            {
                string        commandString = "insert into 'Filmek' ('F_Cim', 'Mufaj', 'Hossz', 'Korhatar', 'Vetitesi_het', 'Mozi_ID', 'Vetitesi_Nap', 'Vetitesi_Ido', 'Rendezo', 'Foszereplo') values ('" + mt.title + "', '" + mt.genres + "', '" + mt.playtime + "', '" + mt.ageRestriction + "', '" + currWeek + "', '" + cinemaId + "', '" + mt.ScreeningDate + "', '" + mt.ScreeningTime + "', '" + mt.producer + "', '" + mt.starring + "')";
                SQLiteCommand command       = new SQLiteCommand(commandString, connection);
                command.ExecuteNonQuery();


                MessageBox.Show("Sikeres feltöltés!");
            }
            else
            {
                MessageBox.Show("Nem a megfelelő hétre töltötte fel az adatokat.");
            }
        }
Beispiel #3
0
        public Startup()
        {
            InitializeComponent();

            LocationsHandler locations = new LocationsHandler();
            MovieHandler     movie     = new MovieHandler();

            CityDropDown.DataSource  = locations.cities;
            GenreDropDown.DataSource = movie.movieTypes;
        }
Beispiel #4
0
        public CreateCinema()
        {
            InitializeComponent();

            LocationsHandler locations = new LocationsHandler();

            CountyDropDown.DataSource = locations.counties;
            CityDropDown.DataSource   = locations.cities;

            CreateCinemaButton.Enabled  = false;
            CountyDropDown.Enabled      = false;
            CityDropDown.Enabled        = false;
            CinemaDropDown.Enabled      = false;
            StreetDropDown.Enabled      = false;
            HouseNumberDropDown.Enabled = false;
            CinemaNameTextBox.Enabled   = false;

            FormClosing += OnClose;
        }