<glade-interface>
<widget class="GtkDialog" id="buscar_afiliado">
+ <property name="width_request">400</property>
+ <property name="height_request">500</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Buscar Afiliado</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="has_separator">True</property>
+ <signal name="response" handler="OnDialogResponse" last_modification_time="Wed, 06 Jul 2005 22:46:48 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
- <signal name="clicked" handler="OnConsultarAfiliadoClose" last_modification_time="Thu, 09 Jun 2005 04:57:08 GMT"/>
</widget>
</child>
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Select</property>
+ <property name="label" translatable="yes">Seleccionar</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
- <signal name="row_activated" handler="OnVerAfiliado" last_modification_time="Thu, 09 Jun 2005 05:01:49 GMT"/>
</widget>
</child>
</widget>
--- /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 VBuscarAfiliado
+{
+ Glade.XML xml;
+ string retorno = null;
+
+
+ [Widget] TreeView lista;
+
+ /* Busqueda */
+ [Widget] ComboBox s_tipoDocumento;
+ [Widget] Entry s_nroDocument;
+ [Widget] Entry s_apellido;
+ [Widget] Entry s_codigo;
+
+ public VBuscarAfiliado ()
+ {
+ xml = new Glade.XML (null, "buscar_afiliado.glade", "buscar_afiliado", null);
+ xml.Autoconnect (this);
+
+ lista.Model = new ListStore (typeof(int), typeof(string), typeof(int), typeof (string), typeof(string));
+
+ /* Columnas */
+ lista.HeadersVisible = true;
+ lista.AppendColumn ("Codigo", new CellRendererText (), "text", 0);
+ lista.AppendColumn ("Tipo Doc.", new CellRendererText (), "text", 1);
+ lista.AppendColumn ("Número Doc.", new CellRendererText (), "text", 2);
+ lista.AppendColumn ("Nombre", new CellRendererText (), "text", 3);
+ lista.AppendColumn ("Apellido", new CellRendererText (), "text", 4);
+ }
+
+ 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;
+ }
+ int cod;
+ try {
+ cod = Int32.Parse (s_codigo.Text);
+ } catch (Exception e) {
+ cod = 0;
+ }
+
+ AfiliadoSolicitanteController c = new AfiliadoSolicitanteController ();
+ ListStore store = (ListStore)lista.Model;
+ store.Clear ();
+ ArrayList lst = c.BuscarAfiliados (tipoDoc, nroDoc, cod, null);
+ foreach (Afiliado p in lst) {
+ TreeIter i = store.Append ();
+ store.SetValue (i, 0, p.Codigo);
+ store.SetValue (i, 1, p.TipoDocumento.ToString ());
+ store.SetValue (i, 2, p.NroDocumento);
+ store.SetValue (i, 3, p.Nombre);
+ store.SetValue (i, 4, p.Apellido);
+ }
+
+ c.Dispose ();
+ }
+
+ public void OnDialogResponse (object o, ResponseArgs args)
+ {
+ if (args.ResponseId == ResponseType.Cancel)
+ return;
+
+ /* Todo el seleccionado. TODO : abortar si no hay nada seleccionado! :) */
+
+ TreeSelection fromSel = lista.Selection;
+ TreeIter iter;
+ TreeModel model;
+
+ if (fromSel.GetSelected (out model, out iter)) {
+ retorno = String.Format ("{0}", (int)model.GetValue (iter, 0));
+ }
+ }
+
+ public string Run ()
+ {
+ Dialog w = (Dialog)xml.GetWidget ("buscar_afiliado");
+ w.Run ();
+ w.Destroy ();
+
+ return retorno;
+ }
+}
+