public void Insert(BiroticaDetails details) { MySQL.ExecuteQuery(string.Format("insert into produs(Descriere, Pret, Cantitate) " + "values('{0}', '{1}', '{2}')", details.Descriere, details.Pret, details.Cantitate)); MySQL.ExecuteQuery(string.Format("insert into birotica(IdBirotica, Denumire) " + "values('{0}', '{1}')", details.Id, details.Denumire)); this.details = details; }
public void Update() { rows = MySQL.GetQuery(string.Format("select b.IdBirotica, b.Denumire, p.Descriere, " + "p.Pret, p.Cantitate from birotica b inner join produs p on b.IdBirotica=p.IdProdus")); if (rows.Length >= currentIndex) { details = new BiroticaDetails(); details.Id = int.Parse(rows[currentIndex][0].ToString()); details.Denumire = rows[currentIndex][1].ToString(); details.Descriere = rows[currentIndex][2].ToString(); details.Pret = rows[currentIndex][3].ToString(); details.Cantitate = rows[currentIndex][4].ToString(); } else { MessageBox.Show("Birotica - Acest rand nu exista"); } }