From: Ricardo Markiewicz Date: Thu, 16 Jun 2005 02:51:27 +0000 (+0000) Subject: * RegistrarVisitas (vista y controler a medias) X-Git-Tag: svn_import~316 X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/commitdiff_plain/01ba80dab5bcd0b57e7ba017186532d4219468c3 * RegistrarVisitas (vista y controler a medias) * Hasta ahora el circuito se cierra - Se carga el solicitante - Se arma la hoja de ruta a 1 promotor (harcodeado) - El promotor (supoer-hardoded) entra y puede marcar como no visitado alguno de los items --- diff --git a/demo/glade/main.glade b/demo/glade/main.glade index cb5c3d8..14aa4b3 100644 --- a/demo/glade/main.glade +++ b/demo/glade/main.glade @@ -117,6 +117,24 @@ Solicitud + + + True + Registrar + Visitas + True + gtk-open + True + True + False + + + + False + True + + + True diff --git a/demo/glade/registrar_visitas.glade b/demo/glade/registrar_visitas.glade index ae21641..4def345 100644 --- a/demo/glade/registrar_visitas.glade +++ b/demo/glade/registrar_visitas.glade @@ -4,6 +4,8 @@ + 420 + 500 True Registrar Visitas GTK_WINDOW_TOPLEVEL @@ -52,7 +54,7 @@ - 8 + 12 True False 0 @@ -67,7 +69,7 @@ GTK_CORNER_TOP_LEFT - + True True True @@ -100,6 +102,7 @@ True GTK_RELIEF_NORMAL True + diff --git a/demo/src/Controlador/RegistrarVisitasController.cs b/demo/src/Controlador/RegistrarVisitasController.cs new file mode 100644 index 0000000..2e087df --- /dev/null +++ b/demo/src/Controlador/RegistrarVisitasController.cs @@ -0,0 +1,47 @@ + +namespace Controlador { +namespace Afiliacion { + +using Dominio.Afiliados; +using Dominio.Planes; +using Dominio; +using com.db4o; + +using System; +using System.Collections; + +public class RegistrarVisitasController : Controller +{ + private Promotor _promotor; + + public RegistrarVisitasController (Promotor p):base () + { + //_promotor = p; + Promotor a = new Promotor (ETipoDocumento.DNI, 12345678, null, null); + ObjectSet result = Db.get (a); + _promotor = (Promotor)result.next (); + } + + public ArrayList ObtenerSolicitantesAsignados () + { + Solicitante s = new Solicitante (0, 0, null, null); + s.Promotor = _promotor; + + ObjectSet result = Db.get (s); + return ObjectSetToArrayList (result); + } + + public void EstablecerPendiente (ETipoDocumento tipoDoc, int nroDoc) + { + /* Obtengo el solicitante */ + Solicitante s = new Solicitante (tipoDoc, nroDoc, null, null); + ObjectSet result = Db.get (s); + s = (Solicitante)result.next (); + s.Promotor = null; + Db.set (s); + } +} + +} +} + diff --git a/demo/src/Main.cs b/demo/src/Main.cs index 56637c5..af31ee8 100644 --- a/demo/src/Main.cs +++ b/demo/src/Main.cs @@ -50,6 +50,12 @@ public class App v.Run (); } + public void OnRegistrarVisitas (object o, EventArgs args) + { + VRegistrarVisitas v = new VRegistrarVisitas (); + v.Run (); + } + public void OnConsultarAfiliadoClose (object o, EventArgs args) { wConsultarAfiliado.Destroy (); diff --git a/demo/src/Vistas/VRegistrarVisitas.cs b/demo/src/Vistas/VRegistrarVisitas.cs new file mode 100644 index 0000000..ab0088b --- /dev/null +++ b/demo/src/Vistas/VRegistrarVisitas.cs @@ -0,0 +1,72 @@ + + +using System; +using System.Collections; +using Gtk; +using Glade; + +using Controlador; +using Controlador.Afiliacion; +using Dominio.Afiliados; +using Dominio; + +public class VRegistrarVisitas +{ + Glade.XML xml; + + [Widget] TreeView visitas; + + public VRegistrarVisitas () + { + xml = new Glade.XML (null, "registrar_visitas.glade", "registrar_visitas", null); + xml.Autoconnect (this); + + RegistrarVisitasController c = new RegistrarVisitasController (null); + + ArrayList l = c.ObtenerSolicitantesAsignados (); + + visitas.Model = new ListStore (typeof(string), typeof(int), typeof (string), typeof (string)); + + visitas.HeadersVisible = true; + visitas.AppendColumn ("Tipo Doc.", new CellRendererText (), "text", 0); + visitas.AppendColumn ("Nro Doc.", new CellRendererText (), "text", 1); + visitas.AppendColumn ("Apellido", new CellRendererText (), "text", 2); + visitas.AppendColumn ("Nombre", new CellRendererText (), "text", 3); + + ListStore store = (ListStore)visitas.Model; + foreach (Solicitante s in l) { + TreeIter iter = store.AppendValues (s.TipoDocumento.ToString (), s.NroDocumento, s.Nombre, s.Apellido); + Console.WriteLine ("Agregando {0}", s.Nombre); + } + c.Dispose (); + } + + public void OnEstablecerPendiente (object o, EventArgs args) + { + TreeSelection fromSel = visitas.Selection; + TreeIter iter; + TreeModel model; + ListStore store = (ListStore)visitas.Model; + + if (fromSel.GetSelected (out model, out iter) == false) { + /* Nada seleccionado */ + return; + } + ETipoDocumento tipoDoc; + int nroDoc; + tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)store.GetValue (iter, 0), true); + nroDoc = (int)store.GetValue (iter, 1); + + RegistrarVisitasController c = new RegistrarVisitasController (null); + c.EstablecerPendiente (tipoDoc, nroDoc); + c.Dispose (); + } + + public void Run () + { + Dialog w = (Dialog)xml.GetWidget ("registrar_visitas"); + w.Run (); + w.Destroy (); + } +} +