Exemplo n.º 1
0
        private void cefreListaz(int f)
        {
            listCefre.Items.Clear();
            var cmd = conn.CreateCommand();

            cmd.CommandText = @"SELECT id,gyumolcs,alkohol,egysegar,fozde_id FROM cefre WHERE fozde_id = @fozde_id ORDER BY id";
            var fozde = (Fozde)listFozde.SelectedItem;

            cmd.Parameters.AddWithValue("@fozde_id", fozde.Id);
            cmd.ExecuteNonQuery();
            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    var id       = reader.GetInt32("id");
                    var gyumolcs = reader.GetString("gyumolcs");
                    var alkohol  = reader.GetInt32("alkohol");
                    var egysegar = reader.GetInt32("egysegar");
                    var fozde_id = reader.GetInt32("fozde_id");

                    var cefre = new Cefre(id, gyumolcs, alkohol, egysegar, fozde_id);
                    listCefre.Items.Add(cefre);
                }
            }
        }
Exemplo n.º 2
0
        private void listCefre_SelectedIndexChanged(object sender, EventArgs e)
        {
            var cmd = conn.CreateCommand();

            cmd.CommandText = @"SELECT id,gyumolcs,alkohol,egysegar, fozde_id FROM cefre WHERE fozde_id = @fozde_id ORDER BY id";
            var fozde = (Fozde)listFozde.SelectedItem;

            cmd.Parameters.AddWithValue("@fozde_id", fozde.Id);
            cmd.ExecuteNonQuery();
            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    var id       = reader.GetInt32("id");
                    var gyumolcs = reader.GetString("gyumolcs");
                    var alkohol  = reader.GetInt32("alkohol");
                    var egysegar = reader.GetInt32("egysegar");
                    var fozde_id = reader.GetInt32("fozde_id");

                    var cefre = new Cefre(id, gyumolcs, alkohol, egysegar, fozde_id);

                    gyumolcstext.Text = gyumolcs;
                    alkoholtext.Text  = alkohol.ToString();
                    egysegartext.Text = egysegar.ToString();
                    fozde_idtext.Text = fozde_id.ToString();
                }
            }
            idszam.Text = listCefre.SelectedIndex.ToString();
        }