Beispiel #1
0
        public void init()
        {
            this.Build();
            entry1.Text = nombre;
            QueryResult query = PersisterHelper.Get("Select * from categoria");

            ComboBoxHelper.Fill(combobox1, query, categoria);
            spinbutton1.Value     = Convert.ToDouble(precio);
            saveAction.Activated += delegate { save(); };
        }
Beispiel #2
0
        private void update()
        {
            IDbCommand dbcommand = APP.Instance.Dbconection.CreateCommand();

            dbcommand.CommandText = "update articulo set nombre=@nombre, categoria=@categoria, precio=@precio where id=@id";
            nombre    = entry1.Text;
            categoria = ComboBoxHelper.GetId(combobox1);
            precio    = Convert.ToDecimal(spinbutton1.Value);

            DbCommandHelper.AddParameter(dbcommand, "nombre", nombre);
            DbCommandHelper.AddParameter(dbcommand, "categoria", categoria);
            DbCommandHelper.AddParameter(dbcommand, "precio", precio);
            DbCommandHelper.AddParameter(dbcommand, "id", id);
            dbcommand.ExecuteNonQuery();
            Destroy();
        }
Beispiel #3
0
        //boton guardar
        //		private void save(){
        //			if (id == null)
        //				insert ();
        //			else
        //				update();
        //		}

        private void insert()
        {
            IDbCommand dbcommand = APP.Instance.Dbconection.CreateCommand();

            dbcommand.CommandText = "insert into articulo (nombre, categoria, precio)" +
                                    "values (@nombre, @categoria, @precio)";

            nombre    = entry1.Text;
            categoria = ComboBoxHelper.GetId(combobox1);
            precio    = Convert.ToDecimal(spinbutton1.Value);

            DbCommandHelper.AddParameter(dbcommand, "nombre", nombre);
            DbCommandHelper.AddParameter(dbcommand, "categoria", categoria);
            DbCommandHelper.AddParameter(dbcommand, "precio", precio);
            dbcommand.ExecuteNonQuery();
            Destroy();
        }