public Adatlap GetAdatlapById(Tetel tetel) { Adatlap adatlap = null; using (OracleConnection conn = new OracleConnection(db_connection)) using (OracleCommand cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = "SELECT * FROM adatlap WHERE ad_id = :ad_id"; cmd.Parameters.Add("ad_id", tetel.ad_id); OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Adatlap temp = new Adatlap { ad_id = reader.GetInt32(reader.GetOrdinal("ad_id")), komment = reader.GetString(reader.GetOrdinal("komment")), ertekels = reader.GetInt32(reader.GetOrdinal("ertekeles")), leiras = reader.GetString(reader.GetOrdinal("leiras")) }; adatlap = temp; } } return(adatlap); }
public bool NewZene(Tetel tetel, int hossz) { bool rvS = false; using (OracleConnection conn = new OracleConnection(db_connection)) using (OracleCommand cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = "INSERT INTO tetel (ar, cim, mufaj, eladott_db, szerzo, ad_id, ki_id, kiadasi_datum, kat_id) " + "VALUES(:ar, :cim, :mufaj, :eladott_db, :szerzo, :ad_id, :ki_id, :kiadasi_datum, :kat_id)"; cmd.Parameters.Add("ar", tetel.ar); cmd.Parameters.Add("cim", tetel.cim); cmd.Parameters.Add("mufaj", tetel.mufaj); cmd.Parameters.Add("eladott_db", tetel.eladott_db); cmd.Parameters.Add("szerzo", tetel.szerzo); cmd.Parameters.Add("ad_id", AddNewAdatlap()); cmd.Parameters.Add("ki_id", 4); cmd.Parameters.Add("kiadasi_datum", tetel.kiadasi_datum); cmd.Parameters.Add("kat_id", tetel.kat_id); rvS = cmd.ExecuteNonQuery() == 1 ? true : false; if (rvS) { if (!InsertZeneHossz(hossz)) { rvS = false; } } } return(rvS); }
public Tetel SelectTetelFromTid(int t_id) { Tetel tetel = null; using (OracleConnection conn = new OracleConnection(db_connection)) using (OracleCommand cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = "SELECT * FROM tetel WHERE t_id = :t_id"; cmd.Parameters.Add("t_id", t_id); OracleDataReader reader = cmd.ExecuteReader(); reader.Read(); tetel = new Tetel { t_id = reader.GetInt32(reader.GetOrdinal("t_id")), ar = reader.GetInt32(reader.GetOrdinal("ar")), cim = reader.GetString(reader.GetOrdinal("cim")), mufaj = reader.GetString(reader.GetOrdinal("mufaj")), eladott_db = reader.GetInt32(reader.GetOrdinal("eladott_db")), szerzo = reader.GetString(reader.GetOrdinal("szerzo")), ad_id = reader.GetInt32(reader.GetOrdinal("ad_id")), ki_id = reader.GetInt32(reader.GetOrdinal("ki_id")), kat_id = reader.GetInt32(reader.GetOrdinal("kat_id")), kiadasi_datum = DateTime.ParseExact(reader.GetDateTime(reader.GetOrdinal("kiadasi_datum")).ToString("yyyy-MM-dd"), "yyyy-MM-dd", CultureInfo.InvariantCulture) }; } return(tetel); }
private void Btn_ok_Click(object sender, RoutedEventArgs e) { Tetel tetel = new Tetel(); List <Tetel> tetelLista = new List <Tetel>(); tetel.Tetel_Neve = txb_termeknev.Text; tetel.Menyiseg = int.Parse(txb_db.Text); tetel.Vasarlas_Ideje = datum; tetel.Erteke = int.Parse(txb_ara.Text); if (txb_vasHelye.Text.Length == 0) { tetel.Vasarlas_Helye = "Ismeretlen"; } else { tetel.Vasarlas_Helye = txb_vasHelye.Text; } tetel.Kategoria_ID = (Kategoria)Cbox.SelectedItem; tetelContext.Tetelek.Add(tetel); tetelContext.SaveChanges(); Close(); }
public BuyTetel(BookShopApp bookShopApp, Tetel tetel) { InitializeComponent(); this.bookShopApp = bookShopApp; this.tetel = tetel; //MessageBox.Show("EZ AZ ID: " + konyv.t_id.ToString()); label1.Text = "Cím:"; label2.Text = "Szerző:"; label3.Text = "Ár:"; label4.Text = "Értékelés:"; label5.Text = "Leírás"; label6.Text = "Komment:"; label7.Text = tetel.cim; label8.Text = tetel.szerzo; label9.Text = tetel.ar.ToString(); label10.Text = bookShopApp.db_cont.GetAdatlapById(tetel).ertekels.ToString(); label11.Text = bookShopApp.db_cont.GetAdatlapById(tetel).leiras; label12.Text = bookShopApp.db_cont.GetAdatlapById(tetel).komment; this.Visible = true; }
private void addBookButton_Click(object sender, System.EventArgs e) { Tetel temp = new Tetel { cim = titleBookTextBox.Text, szerzo = authorBookTextBox.Text, mufaj = (string)mufajcomboBox1.SelectedItem, kiadasi_datum = releaseBookDateTimePicker.Value, kat_id = bookShopApp.db_cont.GetCategoriaIdByName((string)categoriacomboBox1.SelectedItem), ar = Convert.ToInt32(priceBookTextBox.Text), eladott_db = 0, }; if (bookShopApp.db_cont.NewBook(temp, Convert.ToInt32(pageNumbernumericUpDown1.Value))) { MessageBox.Show("Sikerült a könyv hozzáadása"); } else { MessageBox.Show("Nem sikerült a könyv hozzáadása"); } }
private void addMusicButton_Click(object sender, EventArgs e) { Tetel temp = new Tetel { cim = titleMusicTextBox.Text, szerzo = authorMusicTextBox.Text, mufaj = (string)mufajcomboBox1.SelectedItem, kiadasi_datum = releaseMusicDateTimePicker.Value, kat_id = bookShopApp.db_cont.GetCategoriaIdByName((string)categoriacomboBox1.SelectedItem), ar = Convert.ToInt32(priceMusicTextBox.Text), eladott_db = 0, }; if (bookShopApp.db_cont.NewZene(temp, Convert.ToInt32(lengthnumericUpDown1.Value))) { MessageBox.Show("Sikerült a zeneszám hozzáadása"); } else { MessageBox.Show("Nem sikerült a zeneszám hozzáadása"); } }
public Adatlap GetAdatlapById(Tetel tetel) { return(db_dao.GetAdatlapById(tetel)); }
public bool NewZene(Tetel tetel, int hossz) { return(db_dao.NewZene(tetel, hossz)); }
public bool NewFilm(Tetel tetel, int hossz) { return(db_dao.NewFilm(tetel, hossz)); }
public bool NewBook(Tetel tetel, int oldalszam) { return(db_dao.NewBook(tetel, oldalszam)); }