X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/blobdiff_plain/21ddf785e4f47b905ff536229fcf5bec366293a8..c27e0207e5f08b9bbe8d15ed4eb655fe2ac6239a:/carpeta/disenio_grafico/src/Controlador/AfiliadoSolicitanteController.cs diff --git a/carpeta/disenio_grafico/src/Controlador/AfiliadoSolicitanteController.cs b/carpeta/disenio_grafico/src/Controlador/AfiliadoSolicitanteController.cs index c940f89..8cf6b97 100644 --- a/carpeta/disenio_grafico/src/Controlador/AfiliadoSolicitanteController.cs +++ b/carpeta/disenio_grafico/src/Controlador/AfiliadoSolicitanteController.cs @@ -37,7 +37,7 @@ public class AfiliadoSolicitanteController return false; } - public ArrayList obtenerFamiliares (ETipoDocumento tipoDoc, int nroDoc) + public ArrayList ObtenerFamiliares (ETipoDocumento tipoDoc, int nroDoc) { ArrayList salida = new ArrayList (); /* Afiliado a = GETAFILIADO(tipoDoc, nroDoc @@ -73,7 +73,23 @@ public class AfiliadoSolicitanteController public bool ExisteSolicitante (ETipoDocumento tipoDoc, int nroDoc) { - return false; + Solicitante c = new Solicitante (tipoDoc, nroDoc, null, null); + + ObjectContainer db=Db4o.openFile("os.yap"); + bool existe = false; + try { + //do something with db4o + ObjectSet result = db.get(c); + if (result.next() != null) + existe = true; + } + catch (Exception e) { + Console.WriteLine (e); + } + finally { + db.close(); + } + return existe; } public void AgregarSolicitante ( @@ -121,8 +137,6 @@ public class AfiliadoSolicitanteController try { //do something with db4o db.set (s); - ObjectSet result = db.get(s); - Console.WriteLine (result.next()); } catch (Exception e) { Console.WriteLine (e); @@ -133,12 +147,70 @@ public class AfiliadoSolicitanteController return true; } - private Afiliado Restore (int codigo) + private Solicitante GetSolicitante (ETipoDocumento tipoDoc, int nroDoc) { - /* restora de la db */ - return null; + Solicitante s = new Solicitante (tipoDoc, nroDoc, null, null); + + ArrayList lst = GetSolicitantes (s); + + if (lst.Count == 0) + return null; + + return (Solicitante)lst[0]; } + + private ArrayList GetSolicitantes (Solicitante s) + { + ObjectContainer db=Db4o.openFile("os.yap"); + ArrayList lst = new ArrayList (); + try { + ObjectSet result = db.get(s); + if (result == null) + return lst; + while ((s = (Solicitante)result.next ()) != null) { + lst.Add (s); + } + } + catch (Exception e) { + Console.WriteLine ("----- GetSolicitantes ------"); + Console.WriteLine (e); + Console.WriteLine ("----------------------------"); + } + finally { + db.close(); + } + return lst; + } + + public ArrayList ObtenerSolicitantesPendientes () + { + Solicitante s = new Solicitante (0, 0, null, null); + Promotor p = null; // new Promotor (0, 0, null, null); + s.Promotor = p; + return GetSolicitantes (s); + } + + public void AsociarPromotor (ETipoDocumento tipoDoc, int nroDoc, int promotor) + { + ObjectContainer db=Db4o.openFile("os.yap"); + try { + Solicitante s = new Solicitante (tipoDoc, nroDoc, null, null); + ObjectSet result = db.get(s); + + s = (Solicitante)result.next (); + Promotor p = new Promotor (ETipoDocumento.DNI, 12345678, "123", "123"); + s.Promotor = p; + db.set(s); + } + catch (Exception e) { + Console.WriteLine (e); + } + finally { + db.close(); + } + } + } }