public CategoriaView(object id)
     : base(Gtk.WindowType.Toplevel)
 {
     categoria = CategoriaPersister.Load(id);
     init ();
     btGuardar.Activated += delegate {
         update();
     };
 }
 public CategoriaView()
     : base(Gtk.WindowType.Toplevel)
 {
     categoria = new Categoria();
     categoria.Nombre="";
     init ();
     btGuardar.Activated += delegate {
         insert();
     };
 }
Beispiel #3
0
        public static Categoria Load(string id)
        {
            IDbCommand selectDbCommand = App.Instance.DbConnection.CreateCommand ();
            selectDbCommand.CommandText = "select nombre from categoria where id=" + id;
            IDataReader dataReader = selectDbCommand.ExecuteReader();
            dataReader.Read();

            Categoria categoria = new Categoria();
            categoria.Id = int.Parse (id);
            categoria.Nombre = dataReader["nombre"].ToString();

            dataReader.Close ();
            return categoria;
        }