]> git.llucax.com Git - z.facultad/75.10/miklolife.git/commitdiff
* Alta de planes listo. Ya se pueden agregar planes y las coberturas de las prestaci...
authorRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 6 Jul 2005 06:09:12 +0000 (06:09 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 6 Jul 2005 06:09:12 +0000 (06:09 +0000)
demo/glade/consultar_afiliado.glade
demo/glade/mantener_planes.glade
demo/src/Controlador/PlanesController.cs [new file with mode: 0644]
demo/src/Dominio/Cobertura.cs
demo/src/Dominio/Plan.cs
demo/src/Main.cs
demo/src/Vistas/MantenerPlanes.cs

index 9f63a02f78c9fb29bfb3828546620517af069193..c5c644f4fa7d6a56d643ac54db1ecdde7678948a 100644 (file)
@@ -384,7 +384,7 @@ LC</property>
                            <widget class="GtkHButtonBox" id="hbuttonbox1">
                              <property name="border_width">12</property>
                              <property name="visible">True</property>
-                             <property name="layout_style">GTK_BUTTONBOX_START</property>
+                             <property name="layout_style">GTK_BUTTONBOX_END</property>
                              <property name="spacing">0</property>
 
                              <child>
@@ -414,23 +414,6 @@ LC</property>
                                          <property name="homogeneous">False</property>
                                          <property name="spacing">2</property>
 
-                                         <child>
-                                           <widget class="GtkImage" id="image1">
-                                             <property name="visible">True</property>
-                                             <property name="stock">gtk-media-previous</property>
-                                             <property name="icon_size">4</property>
-                                             <property name="xalign">0.5</property>
-                                             <property name="yalign">0.5</property>
-                                             <property name="xpad">0</property>
-                                             <property name="ypad">0</property>
-                                           </widget>
-                                           <packing>
-                                             <property name="padding">0</property>
-                                             <property name="expand">False</property>
-                                             <property name="fill">False</property>
-                                           </packing>
-                                         </child>
-
                                          <child>
                                            <widget class="GtkLabel" id="label7">
                                              <property name="visible">True</property>
@@ -844,23 +827,6 @@ CI</property>
                                  <property name="fill">True</property>
                                </packing>
                              </child>
-
-                             <child>
-                               <widget class="GtkButton" id="seleccionarFecha">
-                                 <property name="visible">True</property>
-                                 <property name="can_focus">True</property>
-                                 <property name="label" translatable="yes">_Seleccionar Fecha</property>
-                                 <property name="use_underline">True</property>
-                                 <property name="relief">GTK_RELIEF_NORMAL</property>
-                                 <property name="focus_on_click">True</property>
-                                 <signal name="clicked" handler="OnSeleccionarFechaClicked" last_modification_time="Wed, 15 Jun 2005 23:29:45 GMT"/>
-                               </widget>
-                               <packing>
-                                 <property name="padding">0</property>
-                                 <property name="expand">False</property>
-                                 <property name="fill">False</property>
-                               </packing>
-                             </child>
                            </widget>
                            <packing>
                              <property name="left_attach">1</property>
@@ -1380,230 +1346,7 @@ Neuquen</property>
              </child>
 
              <child>
-               <widget class="GtkFrame" id="frame6">
-                 <property name="visible">True</property>
-                 <property name="label_xalign">0</property>
-                 <property name="label_yalign">0.5</property>
-                 <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-                 <child>
-                   <widget class="GtkAlignment" id="alignment6">
-                     <property name="visible">True</property>
-                     <property name="xalign">0.5</property>
-                     <property name="yalign">0.5</property>
-                     <property name="xscale">1</property>
-                     <property name="yscale">1</property>
-                     <property name="top_padding">0</property>
-                     <property name="bottom_padding">0</property>
-                     <property name="left_padding">12</property>
-                     <property name="right_padding">0</property>
-
-                     <child>
-                       <widget class="GtkTable" id="table4">
-                         <property name="visible">True</property>
-                         <property name="n_rows">6</property>
-                         <property name="n_columns">2</property>
-                         <property name="homogeneous">False</property>
-                         <property name="row_spacing">8</property>
-                         <property name="column_spacing">8</property>
-
-                         <child>
-                           <widget class="GtkLabel" id="label24">
-                             <property name="visible">True</property>
-                             <property name="label" translatable="yes">Cantidad de Familiares : </property>
-                             <property name="use_underline">False</property>
-                             <property name="use_markup">False</property>
-                             <property name="justify">GTK_JUSTIFY_LEFT</property>
-                             <property name="wrap">False</property>
-                             <property name="selectable">False</property>
-                             <property name="xalign">0</property>
-                             <property name="yalign">0.5</property>
-                             <property name="xpad">0</property>
-                             <property name="ypad">0</property>
-                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                             <property name="width_chars">-1</property>
-                             <property name="single_line_mode">False</property>
-                             <property name="angle">0</property>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">0</property>
-                             <property name="right_attach">1</property>
-                             <property name="top_attach">0</property>
-                             <property name="bottom_attach">1</property>
-                             <property name="x_options">fill</property>
-                             <property name="y_options"></property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkLabel" id="label25">
-                             <property name="visible">True</property>
-                             <property name="label" translatable="yes">Observaciones : </property>
-                             <property name="use_underline">False</property>
-                             <property name="use_markup">False</property>
-                             <property name="justify">GTK_JUSTIFY_LEFT</property>
-                             <property name="wrap">False</property>
-                             <property name="selectable">False</property>
-                             <property name="xalign">0</property>
-                             <property name="yalign">0.5</property>
-                             <property name="xpad">0</property>
-                             <property name="ypad">0</property>
-                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                             <property name="width_chars">-1</property>
-                             <property name="single_line_mode">False</property>
-                             <property name="angle">0</property>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">0</property>
-                             <property name="right_attach">1</property>
-                             <property name="top_attach">2</property>
-                             <property name="bottom_attach">3</property>
-                             <property name="x_options">fill</property>
-                             <property name="y_options"></property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkScrolledWindow" id="scrolledwindow1">
-                             <property name="visible">True</property>
-                             <property name="can_focus">True</property>
-                             <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
-                             <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
-                             <property name="shadow_type">GTK_SHADOW_IN</property>
-                             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-                             <child>
-                               <widget class="GtkTextView" id="observaciones">
-                                 <property name="visible">True</property>
-                                 <property name="can_focus">True</property>
-                                 <property name="editable">True</property>
-                                 <property name="overwrite">False</property>
-                                 <property name="accepts_tab">True</property>
-                                 <property name="justification">GTK_JUSTIFY_LEFT</property>
-                                 <property name="wrap_mode">GTK_WRAP_NONE</property>
-                                 <property name="cursor_visible">True</property>
-                                 <property name="pixels_above_lines">0</property>
-                                 <property name="pixels_below_lines">0</property>
-                                 <property name="pixels_inside_wrap">0</property>
-                                 <property name="left_margin">0</property>
-                                 <property name="right_margin">0</property>
-                                 <property name="indent">0</property>
-                                 <property name="text" translatable="yes"></property>
-                               </widget>
-                             </child>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">1</property>
-                             <property name="right_attach">2</property>
-                             <property name="top_attach">2</property>
-                             <property name="bottom_attach">6</property>
-                             <property name="x_options">fill</property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkLabel" id="label26">
-                             <property name="visible">True</property>
-                             <property name="label" translatable="yes">Disponibilidad : </property>
-                             <property name="use_underline">False</property>
-                             <property name="use_markup">False</property>
-                             <property name="justify">GTK_JUSTIFY_LEFT</property>
-                             <property name="wrap">False</property>
-                             <property name="selectable">False</property>
-                             <property name="xalign">0</property>
-                             <property name="yalign">0.5</property>
-                             <property name="xpad">0</property>
-                             <property name="ypad">0</property>
-                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                             <property name="width_chars">-1</property>
-                             <property name="single_line_mode">False</property>
-                             <property name="angle">0</property>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">0</property>
-                             <property name="right_attach">1</property>
-                             <property name="top_attach">1</property>
-                             <property name="bottom_attach">2</property>
-                             <property name="x_options">fill</property>
-                             <property name="y_options"></property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkEntry" id="disponibilidad">
-                             <property name="visible">True</property>
-                             <property name="can_focus">True</property>
-                             <property name="editable">True</property>
-                             <property name="visibility">True</property>
-                             <property name="max_length">0</property>
-                             <property name="text" translatable="yes"></property>
-                             <property name="has_frame">True</property>
-                             <property name="invisible_char">*</property>
-                             <property name="activates_default">False</property>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">1</property>
-                             <property name="right_attach">2</property>
-                             <property name="top_attach">1</property>
-                             <property name="bottom_attach">2</property>
-                             <property name="y_options"></property>
-                           </packing>
-                         </child>
-
-                         <child>
-                           <widget class="GtkSpinButton" id="familiares">
-                             <property name="visible">True</property>
-                             <property name="can_focus">True</property>
-                             <property name="climb_rate">1</property>
-                             <property name="digits">0</property>
-                             <property name="numeric">False</property>
-                             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-                             <property name="snap_to_ticks">False</property>
-                             <property name="wrap">False</property>
-                             <property name="adjustment">0 0 100 1 10 10</property>
-                           </widget>
-                           <packing>
-                             <property name="left_attach">1</property>
-                             <property name="right_attach">2</property>
-                             <property name="top_attach">0</property>
-                             <property name="bottom_attach">1</property>
-                             <property name="x_options">fill</property>
-                             <property name="y_options"></property>
-                           </packing>
-                         </child>
-                       </widget>
-                     </child>
-                   </widget>
-                 </child>
-
-                 <child>
-                   <widget class="GtkLabel" id="label23">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">&lt;b&gt;Solicitud&lt;/b&gt;</property>
-                     <property name="use_underline">False</property>
-                     <property name="use_markup">True</property>
-                     <property name="justify">GTK_JUSTIFY_LEFT</property>
-                     <property name="wrap">False</property>
-                     <property name="selectable">False</property>
-                     <property name="xalign">0.5</property>
-                     <property name="yalign">0.5</property>
-                     <property name="xpad">0</property>
-                     <property name="ypad">0</property>
-                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                     <property name="width_chars">-1</property>
-                     <property name="single_line_mode">False</property>
-                     <property name="angle">0</property>
-                   </widget>
-                   <packing>
-                     <property name="type">label_item</property>
-                   </packing>
-                 </child>
-               </widget>
-               <packing>
-                 <property name="padding">0</property>
-                 <property name="expand">True</property>
-                 <property name="fill">True</property>
-               </packing>
+               <placeholder/>
              </child>
            </widget>
            <packing>
index 205830f36fdca2e6309a33908affb955e4979124..bd849cec63cc46157f22839c6dfec3a0f60d448d 100644 (file)
@@ -4,6 +4,8 @@
 <glade-interface>
 
 <widget class="GtkDialog" id="mantener_planes">
+  <property name="width_request">450</property>
+  <property name="height_request">500</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">Mantener Planes</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
              <property name="use_stock">True</property>
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
-             <property name="response_id">0</property>
+             <property name="response_id">-6</property>
            </widget>
          </child>
 
              <property name="use_stock">True</property>
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
-             <property name="response_id">1</property>
+             <property name="response_id">-5</property>
            </widget>
          </child>
        </widget>
diff --git a/demo/src/Controlador/PlanesController.cs b/demo/src/Controlador/PlanesController.cs
new file mode 100644 (file)
index 0000000..a449372
--- /dev/null
@@ -0,0 +1,67 @@
+
+namespace Controlador {
+namespace Afiliacion {
+
+using Dominio.Planes;
+using Dominio.Autorizaciones;
+using Dominio;
+using com.db4o;
+using com.db4o.query;
+
+using System;
+using System.Collections;
+
+public class PlanesController : Controller 
+{
+       Plan actual = null;
+
+       public bool CrearPlan (string desc, float cat, int permanencia)
+       {
+               if (actual != null) {
+                       Console.WriteLine ("Ya hay un plan activo!");
+                       return false;
+               }
+
+               Plan p = new Plan (cat);
+               p.Descripcion = desc;
+               p.PermanenciaMinima = permanencia;
+
+               actual = p;
+               return true;
+       }
+
+       public bool AgregarCobertura (int codprestacion, float carencia, float percent, int limite, ETipoAutorizacion tipo)
+       {
+               if (actual == null) {
+                       Console.WriteLine ("NO HAY PLAN ACTIVO!");
+                       return false;
+               }
+
+               Prestacion prestacion = new Prestacion (); 
+               Cobertura c = new Cobertura (prestacion, carencia, percent);
+               c.LimiteAnual = limite;
+               c.TipoAutorizacion = tipo;
+
+               actual.AgregarCobertura (c);
+               return true;
+       }
+
+       public void CommitPlan ()
+       {
+               /* salvo actual! */
+               Db.set (actual);
+               actual = null;
+       }
+
+       public ArrayList ObtenerPlanesVigentes ()
+       {
+               Plan c = new Plan ();
+               ObjectSet result = Db.get (c);
+
+               return ObjectSetToArrayList (result);
+       }       
+}
+
+}
+}
+
index 794e6b95666d6f454503ba47e33cc20cce58313f..672e97dff875c0e9dd21bcd8803c4664625f8527 100644 (file)
@@ -12,7 +12,7 @@ public class Cobertura
 {
        private float _carencia;
        private float _porcentaje;
-       private int _limiteActual;
+       private int _limiteAnual;
        private ETipoAutorizacion _tipoAutorizacion;
        private Prestacion _prestacion;
 
@@ -23,8 +23,19 @@ public class Cobertura
                get { return _prestacion; }
        }
 
-       public Cobertura (float carencia, float porcentaje)
+       public ETipoAutorizacion TipoAutorizacion {
+               get { return _tipoAutorizacion; }
+               set { _tipoAutorizacion = value; }
+       }
+
+       public int LimiteAnual {
+               get { return _limiteAnual; }
+               set { _limiteAnual = value; }
+       }
+
+       public Cobertura (Prestacion p, float carencia, float porcentaje)
        {
+               _prestacion = p;
                _porcentaje = porcentaje;
                _carencia = carencia;
        }
index 659a2e3b8a7ac9dce2fee24476940be91760d6c1..f39c8eb46ad7d2faf948458001d1df000949db25 100644 (file)
@@ -10,7 +10,7 @@ public class Plan
        private float _categoria;
        private string _descripcion;
        private float _permanenciaMinima;
-       private DateTime _fechaBaja;
+       private DateTime _fechaBaja = DateTime.MinValue;
        private ArrayList _coberturas;
 
        public int Codigo {
@@ -35,7 +35,6 @@ public class Plan
 
        public Plan ()
        {
-               _categoria = 0;
        }
        
        public Plan (float categoria)
@@ -58,6 +57,7 @@ public class Plan
 
        public bool AgregarCobertura (Cobertura cobertura)
        {
+               _coberturas.Add (cobertura);
                return false;
        }
        
index 0a7bce07f7ae8adb6a8cb3fde74363ee8c51a9a8..6374454076347310d48287f85686c5948547318c 100644 (file)
@@ -52,16 +52,13 @@ public class App
                Glade.XML gxml = new Glade.XML (null, "main.glade", "main", null);
                gxml.Autoconnect (this);
 
-               InitDemo ();
+               #warning Descomentar para inicializar la base de datos con algunos valores de prueba !
+               /* InitDemo (); */
                Application.Run();
        }
        
        private void InitDemo ()
        {
-               
-               #warning Descomentar para inicializar la base de datos con algunos valores de prueba !
-               return;
-
                /* Algunas categorias */
                Categoria c1 = new Categoria ();
                c1.Codigo = 1;
index e7c139c4a6354460622ab25274cf43775a94c110..1183a40c7d5202f8d1724230a18d453e381a9d9d 100644 (file)
@@ -6,6 +6,8 @@ using Glade;
 
 using Controlador.Afiliacion;
 using Dominio.Afiliados;
+using Dominio.Autorizaciones;
+using Dominio.Planes;
 using Dominio;
 
 public class VMantenerPlanes
@@ -29,38 +31,38 @@ public class VMantenerPlanes
        [Widget] SpinButton limite_anual;
        [Widget] RadioButton tipo_auth;
 
+       PlanesController planc;
+
        public VMantenerPlanes ()
        {
                xml = new Glade.XML (null, "mantener_planes.glade", "mantener_planes", null);
                xml.Autoconnect (this);
 
-               ListStore m = new ListStore (typeof(string), typeof(float), typeof(int));
+               ListStore m = new ListStore (typeof(string), typeof(float), typeof(float));
                lista.Model = m;
                lista.HeadersVisible = true;
                lista.AppendColumn ("Descripción", new CellRendererText (), "text", 0);
                lista.AppendColumn ("Categoría", new CellRendererText (), "text", 1);
                lista.AppendColumn ("Permanencia Mínima", new CellRendererText (), "text", 2);
-       
-               TreeIter nuevo = m.Append ();
-       
-               m.SetValue (nuevo, 0, "Neo 210");
-               m.SetValue (nuevo, 1, 1.0f);
-               m.SetValue (nuevo, 2, 1);
-       
-               nuevo = m.Append ();
-               m.SetValue (nuevo, 0, "Neo 310");
-               m.SetValue (nuevo, 1, 2.0f);
-               m.SetValue (nuevo, 2, 2);
-
-               nuevo = m.Append ();
-               m.SetValue (nuevo, 0, "Neo 410");
-               m.SetValue (nuevo, 1, 3.0f);
-               m.SetValue (nuevo, 2, 4);
-       
-               nuevo = m.Append ();
-               m.SetValue (nuevo, 0, "Ejecutive 510");
-               m.SetValue (nuevo, 1, 4.0f);
-               m.SetValue (nuevo, 2, 3);
+
+               CargarPlanes ();
+       }
+
+       private void CargarPlanes ()
+       {
+               ListStore store = (ListStore)lista.Model;
+               store.Clear ();
+
+               planc = new PlanesController ();
+               ArrayList lst = planc.ObtenerPlanesVigentes ();
+               foreach (Plan p in lst) {
+                       TreeIter iter = store.Append ();
+                       store.SetValue (iter, 0, p.Descripcion);
+                       store.SetValue (iter, 1, p.Categoria);
+                       store.SetValue (iter, 2, p.PermanenciaMinima);
+               }
+
+               planc.Dispose ();
        }
 
        public void OnDialogResponse (object o, ResponseArgs args)
@@ -83,6 +85,8 @@ public class VMantenerPlanes
                Dialog w = (Dialog)alta_plan_xml.GetWidget ("alta_plan");
                w.Run ();
                w.Destroy ();
+
+               CargarPlanes ();
        }
 
        public void OnAltaPlan (object o, ResponseArgs args)
@@ -90,7 +94,36 @@ public class VMantenerPlanes
                if (args.ResponseId == ResponseType.Cancel)
                        return; 
        
+               
+               string desc = descripcion.Text;
+               float cat = (float)categoria.Value;
+               int perma = permanencia_minima.ValueAsInt;
+
+               planc = new PlanesController ();
+               planc.CrearPlan (desc, cat, perma);
+               TreeModel model = coberturas.Model;
+
+               model.Foreach (AgregarCoberturaAlPlan);
+
+               planc.CommitPlan ();
+               planc.Dispose ();
+       }
        
+       bool AgregarCoberturaAlPlan (TreeModel model, TreePath path, TreeIter iter)
+       {
+               int codprestador = (int)model.GetValue (iter, 0);
+               float carencia = (float)model.GetValue (iter, 1);
+               float percent = (float)model.GetValue (iter, 2);
+               int limite = (int)model.GetValue (iter, 3);
+               string t = (string)model.GetValue (iter, 4);
+               ETipoAutorizacion tipo;
+               if (t.Equals ("Manual"))
+                       tipo = ETipoAutorizacion.MANUAL;
+               else
+                       tipo = ETipoAutorizacion.AUTOMATICA;
+
+               planc.AgregarCobertura (codprestador, carencia, percent, limite, tipo);
+               return true;
        }
 
        public void OnProperties (object o, EventArgs args)