Esempio n. 1
0
        protected void SaveArticulo(object sender, EventArgs e)
        {
            String   nombreArticulo    = entryNombre.Text;
            int      indiceCatArticulo = comboBoxCategoria.Active;
            TreeIter treeIter          = new TreeIter();


            comboBoxCategoria.Model.GetIterFirst(out treeIter);

            for (int j = 0; j < indiceCatArticulo; j++)
            {
                comboBoxCategoria.Model.IterNext(ref treeIter);
            }
            IList categoriaModel = (IList)comboBoxCategoria.Model.GetValue(treeIter, 0);

            int     categoriaId = int.Parse(categoriaModel [0].ToString());
            decimal precio      = Convert.ToDecimal(spinButtonPrecio.Value);
            IList   nuevaRow    = new List <object>();

            nuevaRow.Add(nombreArticulo);
            nuevaRow.Add(categoriaId);
            nuevaRow.Add(precio);
            PersisterHelper.Save("Articulo", nuevaRow);

            this.Destroy();
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public ArticuloView() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            QueryResult queryResult = PersisterHelper.Get("select * from categoria");

            ComboBoxHelper.fill(comboBoxCategoria, queryResult);
            comboBoxCategoria.Active = 0;
        }
Esempio n. 4
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();	};
        }
Esempio n. 5
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();
            };
        }
Esempio n. 6
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(); };
        }
Esempio n. 7
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);
            };
        }
Esempio n. 8
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);
            };
        }
Esempio n. 9
0
		public ArticuloView () : 
				base(Gtk.WindowType.Toplevel)
		{
			this.Build ();
			//entryNombre.Text = "nuevo";
			QueryResult queryResult = PersisterHelper.Get ("select * from categoria");


			CellRendererText cellRendererText = new CellRendererText ();
			comboBoxCategoria.PackStart (cellRendererText, false);
			comboBoxCategoria.SetCellDataFunc (cellRendererText, 
				delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
					IList row = (IList)tree_model.GetValue(iter, 0);
					cellRendererText.Text = row[1].ToString();
				});
			ListStore listStore = new ListStore (typeof(IList));
			foreach (IList row in queryResult.Rows)
				listStore.AppendValues (row);
			comboBoxCategoria.Model = listStore;		//comboBoxCategoria.
			//spinButtonPrecio.Value = 1.5;	}
	}