Beispiel #1
0
        public ArticuloView() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.fill(comboBoxCategoria, queryResult);
            comboBoxCategoria.Active = 0;
        }
Beispiel #2
0
        private void init()
        {
            this.Build();
            entryNombre.Text = articulo.Nombre;
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.Fill(comboBoxCategoria, queryResult, articulo.Categoria);
            spinButtonPrecio.Value = Convert.ToDouble(articulo.Precio);
        }
Beispiel #3
0
        private void init()
        {
            this.Build();
            entryNombre.Text = nombre;
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.Fill(comboBoxCategoria, queryResult, categoria);
            spinButtonPrecio.Value = Convert.ToDouble(precio);
            //saveAction.Activated += delegate {	save();	};
        }
Beispiel #4
0
        //Si es un articulo nuevo
        public ArticuloView() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.Fill(comboBoxCategoria, queryResult);
            saveAction.Activated += delegate {
                save();
            };
        }
Beispiel #5
0
        public ArticuloView() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            //entryNombre.Text = "nuevo";
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.Fill(comboBoxCategoria, queryResult, categoria);
            //spinButtonPrecio.Value = 1.5;

            saveAction.Activated += delegate { save(); };
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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);
            };
        }
Beispiel #9
0
        public ArticuloView(object id) :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();

            QueryResult queryResult = PersisterHelper.Get("SELECT * FROM `articulo` WHERE id = " + id);

            foreach (var row in queryResult.Rows)
            {
                entryNombre.Text = row [1].ToString();
                QueryResult queryResultCategoria = PersisterHelper.Get("SELECT * FROM categoria");
                ComboBoxHelper.Fill(comboBoxCategoria, queryResultCategoria);
                comboBoxCategoria.Active = Int32.Parse(row [2].ToString());
                spinButtonPrecio.Value   = Convert.ToDouble(row [3]);
            }
            saveAction.Activated += delegate {
                entryNombre.GrabFocus();
                update(id);
            };
        }
Beispiel #10
0
        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();
        }
Beispiel #11
0
 private void updateModel()
 {
     articulo.Nombre    = entryNombre.Text;
     articulo.Categoria = ComboBoxHelper.GetId(comboBoxCategoria);
     articulo.Precio    = Convert.ToDecimal(spinButtonPrecio.Value);
 }