private void update(object id) { IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand(); dbCommand.CommandText = "UPDATE articulo SET nombre=@nombre, categoria=@categoria, precio=@precio WHERE id=" + id; string nombre = entryNombre.Text; object categoria = ComboBoxHelper.GetId(comboBoxCategoria); decimal precio = Convert.ToDecimal(spinButtonPrecio.Value); DbCommandHelper.AddParameter(dbCommand, "nombre", nombre); DbCommandHelper.AddParameter(dbCommand, "categoria", categoria); DbCommandHelper.AddParameter(dbCommand, "precio", precio); dbCommand.ExecuteNonQuery(); Destroy(); }
private void save() { IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand(); dbCommand.CommandText = "insert into articulo (nombre, categoria, precio) " + "values (@nombre, @categoria, @precio)"; string nombre = entryNombre.Text; object categoria = ComboBoxHelper.GetId(comboBoxCategoria); decimal precio = Convert.ToDecimal(spinButtonPrecio.Value); DbCommandHelper.AddParameter(dbCommand, "nombre", nombre); DbCommandHelper.AddParameter(dbCommand, "categoria", categoria); DbCommandHelper.AddParameter(dbCommand, "precio", precio); dbCommand.ExecuteNonQuery(); }
public void init() { this.Build(); articulo.Nombre = entry1.Text; QueryResult queryresult = PersisterHelper.Get("select * from categoria"); ComboBoxHelper.Fill(combobox1, queryresult, articulo.Categoria); spinbutton1.Value = Convert.ToDouble(articulo.Precio); //saveAction.Activated += delegate { save(articulo); }; saveAction.Activated += delegate { articulo.Nombre = entry1.Text; articulo.Categoria = ComboBoxHelper.GetId(combobox1); articulo.Precio = Convert.ToDecimal(spinbutton1.ValueAsInt); save(articulo); }; }
private void updateArt(object id) { Console.Write(this.id); Console.Write(id); IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand(); dbCommand.CommandText = "update articulo set nombre=@nombre, categoria=@categoria, precio=@precio" + " where id=@id"; string nombre = entryNombre.Text; object categoria = ComboBoxHelper.GetId(comboBoxCategoria); decimal precio = Convert.ToDecimal(spinButtonPrecio.Value); DbCommandHelper.AddParameter(dbCommand, "id", id); DbCommandHelper.AddParameter(dbCommand, "nombre", nombre); DbCommandHelper.AddParameter(dbCommand, "categoria", categoria); DbCommandHelper.AddParameter(dbCommand, "precio", precio); dbCommand.ExecuteNonQuery(); Destroy(); }
private void updateModel() { articulo.Nombre = entryNombre.Text; articulo.Categoria = ComboBoxHelper.GetId(comboBoxCategoria); articulo.Precio = Convert.ToDecimal(spinButtonPrecio.Value); }