--- /dev/null
+
+namespace Dominio {
+
+using Controlador;
+using com.db4o;
+using com.db4o.query;
+using System;
+using System.Collections;
+
+public class Autoincrement {
+ public int codigo_afiliado = int.MinValue;
+ public int codigo_autorizacion = int.MinValue;
+ public int codigo_plan = int.MinValue;
+}
+
+public class AutoIncrementable : Controller {
+ Autoincrement ids;
+
+ private void Get ()
+ {
+ Query query = Db.query();
+ query.constrain(typeof(Autoincrement));
+ ObjectSet result = query.execute ();
+ Autoincrement i = (Autoincrement)result.next ();
+ if (i == null) {
+ Console.WriteLine ("Inicio Autoincrement");
+ ids = new Autoincrement ();
+ ids.codigo_afiliado = 0;
+ ids.codigo_autorizacion = 0;
+ ids.codigo_plan = 0;
+ } else {
+ ids = i;
+ }
+ }
+
+ private void Set ()
+ {
+ Db.set (ids);
+ Db.commit ();
+ }
+
+ public int NextAfiliado ()
+ {
+ Get ();
+ ids.codigo_afiliado += 1;
+ Set ();
+ return ids.codigo_afiliado;
+ }
+
+ public int NextAutorizacion ()
+ {
+ Get ();
+ ids.codigo_autorizacion += 1;
+ Set ();
+ return ids.codigo_autorizacion;
+ }
+
+ public int NextPlan ()
+ {
+ Get ();
+ ids.codigo_plan += 1;
+ Set ();
+ return ids.codigo_plan;
+ }
+}
+
+}
--- /dev/null
+
+using System;
+using System.Collections;
+using Gtk;
+using Glade;
+
+using Controlador.Afiliacion;
+using Dominio.Autorizaciones;
+using Dominio.Planes;
+using Dominio.Afiliados;
+using Dominio;
+
+public class VConsultarAfiliado
+{
+ Glade.XML xml;
+
+ [Widget] TreeView lista;
+
+ /* Busqueda */
+ [Widget] Entry codigo;
+ [Widget] ComboBox s_tipoDocumento;
+ [Widget] Entry s_nroDocument;
+ [Widget] Entry s_apellido;
+
+ public VConsultarAfiliado ()
+ {
+ xml = new Glade.XML (null, "consultar_afiliado.glade", "consultar_afiliado", null);
+ xml.Autoconnect (this);
+
+ lista.Model = new ListStore (typeof(int), typeof(string), typeof(string), typeof (string), typeof(string));
+
+ /* Columnas */
+ lista.HeadersVisible = true;
+ lista.AppendColumn ("Codigo", new CellRendererText (), "text", 0);
+ lista.AppendColumn ("Nombre", new CellRendererText (), "text", 1);
+ lista.AppendColumn ("Apellido", new CellRendererText (), "text", 2);
+ lista.AppendColumn ("Tipo Doc.", new CellRendererText (), "text", 3);
+ lista.AppendColumn ("Número Doc.", new CellRendererText (), "text", 4);
+ }
+
+ public void OnVerAfiliado (object o, EventArgs args)
+ {
+ }
+
+ public void OnBuscarAfiliado (object o, EventArgs args)
+ {
+ ETipoDocumento tipoDoc;
+ try {
+ TreeIter iter;
+ s_tipoDocumento.GetActiveIter (out iter);
+ tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)s_tipoDocumento.Model.GetValue (iter, 0), true);
+ } catch (Exception e) {
+ tipoDoc = ETipoDocumento.NONE;
+ }
+ int nroDoc;
+ try {
+ nroDoc = Int32.Parse (s_nroDocument.Text);
+ } catch (Exception e) {
+ nroDoc = 0;
+ }
+
+ AfiliadoSolicitanteController c = new AfiliadoSolicitanteController ();
+ ListStore store = (ListStore)lista.Model;
+ store.Clear ();
+ ArrayList lst = new ArrayList ();
+ foreach (Prestacion p in lst) {
+ TreeIter i = store.Append ();
+ store.SetValue (i, 0, p.Codigo);
+ store.SetValue (i, 1, p.Nombre);
+ }
+
+ c.Dispose ();
+ }
+
+ public void Run ()
+ {
+ Dialog w = (Dialog)xml.GetWidget ("consultar_afiliado");
+ w.Run ();
+ w.Destroy ();
+ }
+}
+
--- /dev/null
+
+using System;
+using System.Collections;
+using Gtk;
+using Glade;
+
+using Controlador.Afiliacion;
+using Dominio.Afiliados;
+using Dominio.Autorizaciones;
+using Dominio.Planes;
+using Dominio;
+
+public class VPedidoAutorizacionManual
+{
+ Glade.XML xml;
+
+ [Widget] TextView observaciones;
+ [Widget] Entry afiliado;
+ [Widget] Entry prestacion;
+ [Widget] Entry cuit;
+ [Widget] Label lbl_deuda;
+ [Widget] Label lbl_limite;
+
+ public VPedidoAutorizacionManual ()
+ {
+ xml = new Glade.XML (null, "pedido_autorizacion_manual.glade", "pedido_autorizacion_manual", null);
+ xml.Autoconnect (this);
+
+ lbl_deuda.Text = "No hay ninguna alerta.";
+ lbl_limite.Text = "";
+ }
+
+ public void OnAfiliadoChanged (object o, EventArgs args)
+ {
+ Console.WriteLine (afiliado.Text);
+ AfiliadoSolicitanteController c = new AfiliadoSolicitanteController ();
+ try {
+ Afiliado a = c.ExisteAfiliado (Int32.Parse (afiliado.Text));
+ if (a != null) {
+ lbl_deuda.Text = "Existe afiliado";
+ } else
+ lbl_deuda.Text = "No existe afiliado";
+ } catch (Exception e) {
+ }
+ finally {
+ c.Dispose ();
+ }
+ }
+
+ public void OnResponse (object o, ResponseArgs args)
+ {
+ if (args.ResponseId == ResponseType.Cancel)
+ return;
+ }
+
+ public void Run ()
+ {
+ Dialog w = (Dialog)xml.GetWidget ("pedido_autorizacion_manual");
+ w.Run ();
+ w.Destroy ();
+ }
+}
+