X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/blobdiff_plain/655bbc1c5b72f9c52fa42302de6cfcfd9fd0a80e..b51bf640c558c27dc28581ffe7a4b47345485b40:/demo/src/Vistas/RegistrarVisitas.cs?ds=sidebyside diff --git a/demo/src/Vistas/RegistrarVisitas.cs b/demo/src/Vistas/RegistrarVisitas.cs index 7df614f..a2b5eca 100644 --- a/demo/src/Vistas/RegistrarVisitas.cs +++ b/demo/src/Vistas/RegistrarVisitas.cs @@ -15,6 +15,7 @@ public class VRegistrarVisitas Glade.XML xml; [Widget] TreeView visitas; + [Widget] Entry fechaNac; public VRegistrarVisitas () { @@ -60,6 +61,7 @@ public class VRegistrarVisitas RegistrarVisitasController c = new RegistrarVisitasController (null); c.EstablecerPendiente (tipoDoc, nroDoc); c.Dispose (); + store.Remove (ref iter); } public void OnEliminarSolicitante (object o, EventArgs args) @@ -73,6 +75,23 @@ public class VRegistrarVisitas /* Nada seleccionado */ return; } + + /* Confirmo la operacion */ + MessageDialog md = new MessageDialog ( + null, + DialogFlags.DestroyWithParent, + MessageType.Question, + ButtonsType.YesNo, "Esta seguro de quere eliminar el solicitante?" + ); + + ResponseType result = (ResponseType)md.Run (); + + if (result == ResponseType.No) { + md.Destroy (); + return; + } + md.Destroy (); + ETipoDocumento tipoDoc; int nroDoc; tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)store.GetValue (iter, 0), true); @@ -81,6 +100,75 @@ public class VRegistrarVisitas RegistrarVisitasController c = new RegistrarVisitasController (null); c.EliminarSolicitante (tipoDoc, nroDoc); c.Dispose (); + + store.Remove (ref iter); + } + + public void OnAfiliar (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); + /* Obtengo la cantidad de familiares */ + int familiares = c.ObtenerCantidadFamiliares (tipoDoc, nroDoc); + + bool error = false; + if (familiares > 0) { + for (int i=0; i