using System; using System.Collections; using Gtk; using Glade; using Controlador.Afiliacion; using Dominio.Afiliados; using Dominio; public class VMantenerPlanes { Dialog wIngresarSolicitud; Glade.XML xml; Glade.XML alta_plan_xml; [Widget] TreeView lista; /* Alta Plan Window */ [Widget] Entry descripcion; [Widget] SpinButton categoria; [Widget] SpinButton permanencia_minima; [Widget] TreeView coberturas; /* Alta Cobertura */ [Widget] Entry codigo_prestacion; [Widget] Entry carencia; [Widget] SpinButton cobertura; [Widget] SpinButton limite_anual; [Widget] RadioButton tipo_auth; public VMantenerPlanes () { xml = new Glade.XML (null, "mantener_planes.glade", "mantener_planes", null); xml.Autoconnect (this); } public void OnDialogResponse (object o, ResponseArgs args) { } public void OnAdd (object o, EventArgs args) { alta_plan_xml = new Glade.XML (null, "mantener_planes.glade", "alta_plan", null); alta_plan_xml.Autoconnect (this); coberturas.Model = new ListStore (typeof(int), typeof(float), typeof (float), typeof (int), typeof(string)); coberturas.HeadersVisible = true; coberturas.AppendColumn ("Prestacion", new CellRendererText (), "text", 0); coberturas.AppendColumn ("Carencia", new CellRendererText (), "text", 1); coberturas.AppendColumn ("Cobertura", new CellRendererText (), "text", 2); coberturas.AppendColumn ("Limite Anual", new CellRendererText (), "text", 3); coberturas.AppendColumn ("Tipo", new CellRendererText (), "text", 4); Dialog w = (Dialog)alta_plan_xml.GetWidget ("alta_plan"); w.Run (); w.Destroy (); } public void OnAltaPlan (object o, ResponseArgs args) { if (args.ResponseId == ResponseType.Cancel) return; } public void OnProperties (object o, EventArgs args) { } public void OnDelete (object o, EventArgs args) { } public void OnAddCobertura (object o, EventArgs args) { alta_plan_xml = new Glade.XML (null, "mantener_planes.glade", "alta_cobertura", null); alta_plan_xml.Autoconnect (this); Dialog w = (Dialog)alta_plan_xml.GetWidget ("alta_cobertura"); if (w.Run () != -6) { ListStore store = (ListStore)coberturas.Model; TreeIter nuevo = store.Append (); store.SetValue (nuevo, 0, Int32.Parse (codigo_prestacion.Text)); store.SetValue (nuevo, 1, (float)Double.Parse (carencia.Text)); store.SetValue (nuevo, 2, (float)cobertura.Value); store.SetValue (nuevo, 3, limite_anual.ValueAsInt); if (tipo_auth.Active == true) store.SetValue (nuevo, 4, "Manual"); else store.SetValue (nuevo, 4, "Automatica"); } w.Destroy (); } public void Run () { Dialog w = (Dialog)xml.GetWidget ("mantener_planes"); w.Run (); w.Destroy (); } }