]> git.llucax.com Git - z.facultad/75.10/miklolife.git/commitdiff
* Pedido de autorizacion manual completo con todos sus cuadros de busqueda.
authorRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 6 Jul 2005 23:56:37 +0000 (23:56 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Wed, 6 Jul 2005 23:56:37 +0000 (23:56 +0000)
 Tambien llama a controller, solo falta confirmar que este ultimo anda y listo
 ya tenemos autorizaciones cargadas

demo/glade/buscar_prestador.glade [new file with mode: 0644]
demo/glade/pedido_autorizacion_manual.glade
demo/src/Controlador/PrestadoresController.cs
demo/src/Vistas/BuscarPrestador.cs [new file with mode: 0644]
demo/src/Vistas/PedidoAutorizacionManual.cs

diff --git a/demo/glade/buscar_prestador.glade b/demo/glade/buscar_prestador.glade
new file mode 100644 (file)
index 0000000..66ed9ad
--- /dev/null
@@ -0,0 +1,303 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="buscar_prestador">
+  <property name="width_request">400</property>
+  <property name="height_request">500</property>
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Buscar Prestador</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</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="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialog-action_area1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="cerrar">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-close</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">-7</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="button1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</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="response_id">0</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkVBox" id="vbox2">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkFrame" id="frame1">
+             <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="alignment1">
+                 <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="table1">
+                     <property name="border_width">8</property>
+                     <property name="visible">True</property>
+                     <property name="n_rows">2</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="label9">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Nombre : </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="GtkEntry" id="nombre">
+                         <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">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHButtonBox" id="hbuttonbox2">
+                         <property name="visible">True</property>
+                         <property name="layout_style">GTK_BUTTONBOX_END</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <widget class="GtkButton" id="button2">
+                             <property name="visible">True</property>
+                             <property name="can_default">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label">gtk-find</property>
+                             <property name="use_stock">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <signal name="clicked" handler="OnBuscarPrestador" last_modification_time="Wed, 06 Jul 2005 23:39:43 GMT"/>
+                           </widget>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                       </packing>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label1">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">&lt;b&gt;Criterios de Búsqueda&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">False</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkFrame" id="frame4">
+             <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="alignment5">
+                 <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="GtkScrolledWindow" id="scrolledwindow1">
+                     <property name="border_width">12</property>
+                     <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="GtkTreeView" id="lista">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="headers_visible">True</property>
+                         <property name="rules_hint">False</property>
+                         <property name="reorderable">False</property>
+                         <property name="enable_search">True</property>
+                         <property name="fixed_height_mode">False</property>
+                         <property name="hover_selection">False</property>
+                         <property name="hover_expand">False</property>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label8">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">&lt;b&gt;Coincidencias&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>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
index 53569b4f332dce599e58f1b7f6a25a2804d29ad7..fea44da8742d1f005e9dda1718fac0edae18dbb7 100644 (file)
                          <property name="use_underline">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                          <property name="focus_on_click">True</property>
+                         <signal name="clicked" handler="OnBuscarPrestador" last_modification_time="Wed, 06 Jul 2005 23:45:16 GMT"/>
                        </widget>
                        <packing>
                          <property name="left_attach">2</property>
index 4cba074bfb5dac568a78ab600e0a8b02eaffe491..8be00da9bd5834b38dcd039c5886c6d8f1e0ca12 100644 (file)
@@ -21,6 +21,15 @@ public class PrestadoresController : Controller
                return ObjectSetToArrayList (result);
        }       
 
+       public ArrayList Buscar (string nombre)
+       {
+               Prestador c = new Prestador ();
+               c.Nombre = nombre;
+               ObjectSet result = Db.get (c);
+
+               return ObjectSetToArrayList (result);
+       }       
+
        /* TODO : Dejo los campos importantes, no tiene sentido poner los datos extra para la demo */
        public void AgregarPrestador (string cuit, string nombre, string email)
        {
diff --git a/demo/src/Vistas/BuscarPrestador.cs b/demo/src/Vistas/BuscarPrestador.cs
new file mode 100644 (file)
index 0000000..64de0dc
--- /dev/null
@@ -0,0 +1,84 @@
+
+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 VBuscarPrestador
+{
+       Glade.XML xml;
+       string retorno = null;
+
+
+       [Widget] TreeView lista;
+
+       /* Busqueda */
+       [Widget] Entry nombre;
+
+       public VBuscarPrestador ()
+       {
+               xml = new Glade.XML (null, "buscar_prestador.glade", "buscar_prestador", null);
+               xml.Autoconnect (this);
+
+               lista.Model = new ListStore (typeof(string), typeof(string), typeof (string));
+
+               /* Columnas */
+               lista.HeadersVisible = true;
+               lista.AppendColumn ("CUIT", new CellRendererText (), "text", 0);
+               lista.AppendColumn ("Nombre", new CellRendererText (), "text", 1);
+               lista.AppendColumn ("eMail", new CellRendererText (), "text", 2);
+       }
+
+       public void OnBuscarPrestador (object o, EventArgs args)
+       {
+               
+               PrestadoresController c = new PrestadoresController (); 
+               ListStore store = (ListStore)lista.Model;
+               store.Clear ();
+               string s=null;
+               if (nombre.Text.Equals("") == false)
+                       s = nombre.Text;
+
+               ArrayList lst = c.Buscar (s);
+               foreach (Prestador p in lst) {
+                       TreeIter i = store.Append ();
+                       store.SetValue (i, 0, p.Cuit);
+                       store.SetValue (i, 1, p.Nombre);
+                       store.SetValue (i, 2, p.Email);
+               }
+       
+               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)model.GetValue (iter, 0);
+               }
+       }
+
+       public string Run ()
+       {
+               Dialog w = (Dialog)xml.GetWidget ("buscar_prestador");
+               w.Run ();
+               w.Destroy ();
+
+               return retorno;
+       }
+}
+
index 2eacfc520b584bbc6a7fe6322bb98e9f2564aef7..4d453ab9a3dfc7358f36cec03c65f9c0940a5878 100644 (file)
@@ -5,6 +5,7 @@ using Gtk;
 using Glade;
 
 using Controlador.Afiliacion;
+using Controlador;
 using Dominio.Afiliados;
 using Dominio.Autorizaciones;
 using Dominio.Planes;
@@ -32,14 +33,16 @@ public class VPedidoAutorizacionManual
 
        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";
+                               if (a.Moroso == 0)
+                                       lbl_deuda.Markup = "El Afiliado está al día con la cuota";
+                               else
+                                       lbl_deuda.Markup = String.Format ("<b>El Afiliado adeuda {0} meses", a.Moroso);
                        } else
-                               lbl_deuda.Text = "No existe afiliado";
+                               lbl_deuda.Markup = "<b>El código de afiliado es inválido</b>";
                } catch (Exception e) {
                }
                finally {
@@ -63,10 +66,25 @@ public class VPedidoAutorizacionManual
                        prestacion.Text = r;
        }
 
+       public void OnBuscarPrestador (object o, EventArgs args)
+       {
+               VBuscarPrestador v = new VBuscarPrestador ();
+               string r = v.Run ();
+               if (r != null)
+                       cuit.Text = r;
+       }
+
        public void OnResponse (object o, ResponseArgs args)
        {
                if (args.ResponseId == ResponseType.Cancel)
                        return; 
+
+               AutorizacionController c = new AutorizacionController (DateTime.Now);
+               if (c.guardarAutorizacionManual (prestacion.Text, cuit.Text, Int32.Parse (afiliado.Text), observaciones.Buffer.Text) == false)
+                       Console.WriteLine ("ERROR AL CARGAR EL PEDIDO");
+               else
+                       Console.WriteLine ("PEDIDO CARGADO");
+               c.Dispose ();
        }
 
        public void Run ()