public int Codigo {
get { return _codigo; }
+ set { _codigo = value; }
}
public float Categoria {
get { return _categoria; }
+ set { _categoria = value; }
}
public string Descripcion {
get { return _descripcion; }
get { return _fechaBaja; }
}
+ public Plan ()
+ {
+ _categoria = 0;
+ }
+
public Plan (float categoria)
{
/* TODO */
{
return _coberturas;
}
+
+ public override string ToString ()
+ {
+ return String.Format ("Plan : {0} {1} {2}", _codigo, _categoria, _descripcion);
+ }
}
}
using Gtk;
using Glade;
+using Controlador;
+
public class ABMGenerico
{
Glade.XML xml;
[Widget] Table tabla;
Type current;
+ Hashtable widgets;
public ABMGenerico (Type objectType)
{
+ widgets = new Hashtable ();
+
PropertyInfo[] properties = objectType.GetProperties ();
current = objectType;
tabla.Attach (e, 1, 2, i, i+1);
l.Show ();
e.Show ();
+ widgets[mf.Name] = e;
}
i++;
}
{
if (args.ResponseId == ResponseType.Cancel)
return;
- }
+
+ PropertyInfo[] properties = current.GetProperties ();
+
+ System.Object output = Activator.CreateInstance (current);
+
+ foreach (string key in widgets.Keys) {
+ PropertyInfo p = current.GetProperty (key);
+ Entry e = (Entry)widgets[key];
+ Console.WriteLine ("{0} = {1}", key, e.Text);
+ if (p.PropertyType.Equals (typeof(string)))
+ p.SetValue (output, e.Text, null);
+ if (p.PropertyType.Equals (typeof(int)))
+ p.SetValue (output, Int32.Parse (e.Text), null);
+ if (p.PropertyType.Equals (typeof(float))) {
+ p.SetValue (output, (float)Double.Parse (e.Text), null);
+ }
+ }
+ Controller c = new Controller ();
+
+ c.GenericSave (output);
+
+ c.Dispose ();
+ }
+
public void Run ()
{
Dialog w = (Dialog)xml.GetWidget ("abm_one");