X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/blobdiff_plain/8ca90a781ee38246d4215cfcdedf4a5c950686bc..7ebbd1a014777a5b246ca331472cac4efb362dae:/disenio_grafico/src/Main.cs diff --git a/disenio_grafico/src/Main.cs b/disenio_grafico/src/Main.cs index 4890fa8..bbe69a7 100644 --- a/disenio_grafico/src/Main.cs +++ b/disenio_grafico/src/Main.cs @@ -1,11 +1,16 @@ using System; +using System.Collections; using Gtk; using Glade; +using Dominio.Afiliados; +using Dominio.Planes; public class App { Dialog wConsultarAfiliado; + ArrayList lst; + Glade.XML xmla; static public void Main (string[] args) { @@ -22,9 +27,22 @@ public class App w.SetSizeRequest (450, 250); + InitDemo (); Application.Run(); } + private void InitDemo () + { + lst = new ArrayList (); + Plan p = new Plan (1); + p.Descripcion = "Hola"; + p.PermanenciaMinima = 2; + + Solicitante s = new Solicitante (ETipoDocumento.DNI, 27000193, "Gazer"); + Afiliado f = new Afiliado (s, p, new DateTime (2005, 7, 8)); + lst.Add (f); + } + public void OnSalirActivate (object o, EventArgs args) { Application.Quit (); @@ -32,11 +50,17 @@ public class App public void OnConsultarAfiliado (object o, EventArgs args) { - Glade.XML gxml = new Glade.XML (null, "consultar_afiliado.glade", "consultarAfiliado", null); - gxml.Autoconnect (this); - wConsultarAfiliado = (Dialog)gxml.GetWidget ("consultarAfiliado"); - + xmla = new Glade.XML (null, "consultar_afiliado.glade", "consultarAfiliado", null); + xmla.Autoconnect (this); + wConsultarAfiliado = (Dialog)xmla.GetWidget ("consultarAfiliado"); wConsultarAfiliado.SetSizeRequest (450, 250); + TreeView lista = (TreeView)xmla.GetWidget ("lista"); + + TreeStore store = new TreeStore (typeof (string), typeof (string)); + lista.Model = store; + + lista.AppendColumn ("Codigo", new CellRendererText (), "text", 0); + lista.AppendColumn ("Nombre", new CellRendererText (), "text", 1); wConsultarAfiliado.Run (); } @@ -52,6 +76,13 @@ public class App public void OnBuscarAfiliado (object o, EventArgs args) { + Entry codigo = (Entry)xmla.GetWidget ("s_codigo"); + TreeView lista = (TreeView)xmla.GetWidget ("lista"); + TreeStore store = (TreeStore)lista.Model; + foreach (Afiliado a in lst) { + if (a.Codigo == Int32.Parse (codigo.Text)) + store.AppendValues (String.Format("{0}", a.Codigo), a.Nombre); + } } }