From b09a1b5d2559dd4da2f8460ddd4fe459fedba79e Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Mon, 4 Jul 2005 03:08:00 +0000 Subject: [PATCH] * 10 minutos mas y tenemos nuestro primer afiliado :) --- demo/glade/agregar_afiliado.glade | 15 +++++- demo/glade/main.glade | 15 ++++++ .../AfiliadoSolicitanteController.cs | 14 ++++- .../Controlador/RegistrarVisitasController.cs | 13 ++++- demo/src/Main.cs | 14 +++-- demo/src/Vistas/AgregarAfiliado.cs | 54 +++++++++++++++++++ demo/src/Vistas/RegistrarVisitas.cs | 2 + 7 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 demo/src/Vistas/AgregarAfiliado.cs diff --git a/demo/glade/agregar_afiliado.glade b/demo/glade/agregar_afiliado.glade index 98b7a76..148ad50 100644 --- a/demo/glade/agregar_afiliado.glade +++ b/demo/glade/agregar_afiliado.glade @@ -16,6 +16,7 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST + True True @@ -85,13 +86,16 @@ GTK_CORNER_TOP_LEFT - + True True True False False True + False + False + False @@ -112,6 +116,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 label_item @@ -139,6 +147,7 @@ True GTK_RELIEF_NORMAL True + @@ -188,6 +197,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/demo/glade/main.glade b/demo/glade/main.glade index 7555ae5..f058d10 100644 --- a/demo/glade/main.glade +++ b/demo/glade/main.glade @@ -88,6 +88,21 @@ + + + + True + + + + + + True + Agregar Afiliados + True + + + diff --git a/demo/src/Controlador/AfiliadoSolicitanteController.cs b/demo/src/Controlador/AfiliadoSolicitanteController.cs index dfa2552..59c7750 100644 --- a/demo/src/Controlador/AfiliadoSolicitanteController.cs +++ b/demo/src/Controlador/AfiliadoSolicitanteController.cs @@ -5,6 +5,7 @@ using Dominio.Afiliados; using Dominio.Planes; using Dominio; using com.db4o; +using com.db4o.query; using System; using System.Collections; @@ -19,9 +20,18 @@ public class AfiliadoSolicitanteController : Controller } - public ArrayList obtenerSolicitantesAfiliar () + public ArrayList ObtenerSolicitantesAfiliar () { - return _solicitantes; + Query query = Db.query(); + query.constrain(typeof(Solicitante)); + query.descend("_promotor").constrain(null); + query.descend("_pendiente").constrain(false); + query.descend("_titular").constrain(null); + + ObjectSet result = query.execute(); + ArrayList lst = ObjectSetToArrayList (result); + + return lst; } public bool ExisteAfiliado (ETipoDocumento tipoDoc, int nroDoc) diff --git a/demo/src/Controlador/RegistrarVisitasController.cs b/demo/src/Controlador/RegistrarVisitasController.cs index d1966fb..5949704 100644 --- a/demo/src/Controlador/RegistrarVisitasController.cs +++ b/demo/src/Controlador/RegistrarVisitasController.cs @@ -55,10 +55,19 @@ public class RegistrarVisitasController : Controller { /* Obtengo el solicitante */ Solicitante s = new Solicitante (tipoDoc, nroDoc, null, null); + s.Pendiente = false; + s.Promotor = _promotor; + ObjectSet result = Db.get (s); s = (Solicitante)result.next (); - s.Promotor = null; - Db.set (s); + + if (s == null) { + Console.WriteLine ("Error, No se encontre Solicitante {0} {1}", tipoDoc, nroDoc); + } else { + s.Promotor = null; + s.Pendiente = false; + Db.set (s); + } } public int ObtenerCantidadFamiliares (ETipoDocumento tipoDoc, int nroDoc) diff --git a/demo/src/Main.cs b/demo/src/Main.cs index aa083cc..3f1e69d 100644 --- a/demo/src/Main.cs +++ b/demo/src/Main.cs @@ -80,6 +80,13 @@ public class App v.Run (); } + public void OnAgregarAfiliado (object o, EventArgs args) + { + VAgregarAfiliado v = new VAgregarAfiliado (); + v.Run (); + } + + public void OnMantenerPlanes (object o, EventArgs args) { VMantenerPlanes v = new VMantenerPlanes (); @@ -88,11 +95,8 @@ public class App public void OnRegistrarVisitas (object o, EventArgs args) { - ABMGenerico g = new ABMGenerico (typeof(Plan)); - g.Run (); - return; - /*VRegistrarVisitas v = new VRegistrarVisitas (); - v.Run ();*/ + VRegistrarVisitas v = new VRegistrarVisitas (); + v.Run (); } } diff --git a/demo/src/Vistas/AgregarAfiliado.cs b/demo/src/Vistas/AgregarAfiliado.cs new file mode 100644 index 0000000..b607752 --- /dev/null +++ b/demo/src/Vistas/AgregarAfiliado.cs @@ -0,0 +1,54 @@ + +using System; +using System.Collections; +using Gtk; +using Glade; + +using Controlador.Afiliacion; +using Dominio.Afiliados; +using Dominio; + +public class VAgregarAfiliado +{ + Glade.XML xml; + [Widget] TreeView lista; + + public VAgregarAfiliado () + { + xml = new Glade.XML (null, "agregar_afiliado.glade", "agregar_afiliado", null); + xml.Autoconnect (this); + + ListStore store = new ListStore (typeof(string), typeof(int), typeof (string), typeof (string)); + lista.Model = store; + + /* Columnas */ + lista.HeadersVisible = true; + lista.AppendColumn ("Tipo Doc.", new CellRendererText (), "text", 0); + lista.AppendColumn ("Nro Doc.", new CellRendererText (), "text", 1); + lista.AppendColumn ("Apellido", new CellRendererText (), "text", 2); + lista.AppendColumn ("Nombre", new CellRendererText (), "text", 3); + + ArrayList afiliados; + AfiliadoSolicitanteController c = new AfiliadoSolicitanteController (); + afiliados = c.ObtenerSolicitantesAfiliar (); + + foreach (Solicitante s in afiliados) { + TreeIter iter = store.AppendValues (s.TipoDocumento.ToString (), s.NroDocumento, s.Nombre, s.Apellido); + } + + c.Dispose (); + } + + public void OnAfiliar (object o, EventArgs args) + { + + } + + public void Run () + { + Dialog w = (Dialog)xml.GetWidget ("agregar_afiliado"); + w.Run (); + w.Destroy (); + } +} + diff --git a/demo/src/Vistas/RegistrarVisitas.cs b/demo/src/Vistas/RegistrarVisitas.cs index e4d05e1..9390248 100644 --- a/demo/src/Vistas/RegistrarVisitas.cs +++ b/demo/src/Vistas/RegistrarVisitas.cs @@ -130,6 +130,8 @@ public class VRegistrarVisitas } } + c.Visitado (tipoDoc, nroDoc); + c.Dispose (); store.Remove (ref iter); } -- 2.43.0