Glade.XML xml;
[Widget] TreeView visitas;
+ [Widget] Entry fechaNac;
public VRegistrarVisitas ()
{
RegistrarVisitasController c = new RegistrarVisitasController (null);
c.EstablecerPendiente (tipoDoc, nroDoc);
c.Dispose ();
+ store.Remove (ref iter);
}
public void OnEliminarSolicitante (object o, EventArgs args)
/* 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);
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<familiares; i++) {
+ error = AgregarFamiliar (i+1, familiares, tipoDoc, nroDoc, c);
+ }
+ }
+
+ if (!error) {
+ c.Visitado (tipoDoc, nroDoc);
+ store.Remove (ref iter);
+ }
+
+ c.Dispose ();
+ }
+
+ private bool AgregarFamiliar (int n, int total, ETipoDocumento tipo, int nro, RegistrarVisitasController c)
+ {
+ VAgregarFamiliar w = new VAgregarFamiliar (n, total, tipo, nro, c);
+ if (w.Run () == true) {
+ MessageDialog md = new MessageDialog (null,
+ DialogFlags.DestroyWithParent,
+ MessageType.Error,
+ ButtonsType.Close, "No se pudo agregar el familiar!.");
+
+ md.Run ();
+ md.Destroy();
+ return true;
+ }
+ return false;
+ }
+
+ public void OnSeleccionarFechaClicked (object o, EventArgs args)
+ {
+ CalendarDialog d;
+ if (fechaNac.Text.Equals (""))
+ d = new CalendarDialog ();
+ else
+ d = new CalendarDialog (fechaNac.Text);
+
+ int response;
+
+ response = d.Run();
+ if (response == -3)
+ fechaNac.Text = d.Date.ToLongDateString ();
+ d.Destroy ();
}
public void Run ()