Ejemplo n.º 1
0
        private void metroLink2_Click(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();
            SqlConnection connection = new SqlConnection(connectionString);

            try
            {
                connection.Open();
                SqlCommand    command = new SqlCommand("SELECT * FROM Video WHERE Video_zhanr = 'Фильм'", connection);
                SqlDataReader reader;
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    string   image_path   = Application.StartupPath + reader["Video_Image"].ToString();
                    string   video_tryler = Application.StartupPath + reader["Video_treyler"].ToString();
                    FilmCard cart         = new FilmCard(reader["Video_name"].ToString(), reader["Video_zhanr"].ToString(), reader["Video_Descryption"].ToString(), reader["Video_Year"].ToString(), video_tryler, image_path, this);

                    cart.metroTile1.Click += new System.EventHandler(cart_Click);

                    flowLayoutPanel1.Controls.Add(cart);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                connection.Close();
            }
        }
Ejemplo n.º 2
0
        public void getFilms()
        {
            SqlConnection connection = new SqlConnection(connectionString);

            try
            {
                connection.Open();
                SqlCommand    command = new SqlCommand("SELECT * FROM Video", connection);
                SqlDataReader reader;
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    string   image_path   = Application.StartupPath + reader["Video_Image"].ToString();
                    string   video_tryler = Application.StartupPath + reader["Video_treyler"].ToString();
                    FilmCard cart         = new FilmCard(reader["Video_name"].ToString(), reader["Video_zhanr"].ToString(), reader["Video_Descryption"].ToString(), reader["Video_Year"].ToString(), video_tryler, image_path, this);

                    flowLayoutPanel1.Controls.Add(cart);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                connection.Close();
            }
        }