]> git.llucax.com Git - z.facultad/75.10/miklolife.git/commitdiff
From Gazer :
authorNicolás Dimov <ndimov@gmail.com>
Sun, 19 Jun 2005 02:05:51 +0000 (02:05 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Sun, 19 Jun 2005 02:05:51 +0000 (02:05 +0000)
   * Inicio un ABM Generico usando Reflection para ahorrar el tiempo de hacer 1
     ABM por cada clase simple. Esto serviria para :
  - Planes
  - Promotores
  - Zonas
  - Caps

   * Algunos fixes menores en otros lados.

demo/glade/abm_generico.glade [new file with mode: 0644]
demo/src/Main.cs
demo/src/Vistas/ABMGenerico.cs [new file with mode: 0644]
demo/src/Vistas/RegistrarVisitas.cs

diff --git a/demo/glade/abm_generico.glade b/demo/glade/abm_generico.glade
new file mode 100644 (file)
index 0000000..83d3b7a
--- /dev/null
@@ -0,0 +1,229 @@
+<?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="abm_one">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Dirección</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="has_separator">True</property>
+
+  <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="cancelbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</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">-6</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="okbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</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">-5</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="GtkTable" id="tabla">
+         <property name="border_width">12</property>
+         <property name="visible">True</property>
+         <property name="n_rows">7</property>
+         <property name="n_columns">2</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">8</property>
+         <property name="column_spacing">8</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkDialog" id="abm_lista">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Planes</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="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox3">
+      <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_area3">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="closebutton1">
+             <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>
+       </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="vbox1">
+         <property name="border_width">12</property>
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow2">
+             <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>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHButtonBox" id="hbuttonbox1">
+             <property name="visible">True</property>
+             <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+             <property name="spacing">0</property>
+
+             <child>
+               <widget class="GtkButton" id="button5">
+                 <property name="visible">True</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label">gtk-delete</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="OnBorrar" last_modification_time="Sun, 19 Jun 2005 01:12:19 GMT"/>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="button6">
+                 <property name="visible">True</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label">gtk-edit</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="OnEditar" last_modification_time="Sun, 19 Jun 2005 01:12:07 GMT"/>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="button7">
+                 <property name="visible">True</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label">gtk-add</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="OnAgregar" last_modification_time="Sun, 19 Jun 2005 01:11:58 GMT"/>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</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 af31ee871fbfd440a6c14ba2e08b3b490f906c4a..806420e8d1e7da664aeb2ae9187271a53ca60ed3 100644 (file)
@@ -52,6 +52,10 @@ public class App
 
        public void OnRegistrarVisitas (object o, EventArgs args)
        {
 
        public void OnRegistrarVisitas (object o, EventArgs args)
        {
+               /*Plan p = new Plan (1);
+               ABMGenerico g = new ABMGenerico (p.GetType());
+               g.Run ();
+               return;*/
                VRegistrarVisitas v = new VRegistrarVisitas ();
                v.Run ();
        }
                VRegistrarVisitas v = new VRegistrarVisitas ();
                v.Run ();
        }
diff --git a/demo/src/Vistas/ABMGenerico.cs b/demo/src/Vistas/ABMGenerico.cs
new file mode 100644 (file)
index 0000000..3471b20
--- /dev/null
@@ -0,0 +1,39 @@
+
+using System;
+using System.Reflection;
+using System.Collections;
+using Gtk;
+using Glade;
+
+public class ABMGenerico
+{
+       Glade.XML xml;
+       [Widget] Table tabla;
+
+       public ABMGenerico (Type objectType)
+       {
+               PropertyInfo[] properties = objectType.GetProperties ();
+               
+               xml = new Glade.XML (null, "abm_generico.glade", "abm_one", null);
+               xml.Autoconnect (this);
+
+               uint i=0;
+               foreach( PropertyInfo mf in properties ) {
+                       Label l = new Label (mf.Name + " : ");
+                       Entry e = new Entry ();
+                       tabla.Attach (l, 0, 1, i, i+1);
+                       tabla.Attach (e, 1, 2, i, i+1);
+                       l.Show ();
+                       e.Show ();
+                       i++;
+               }
+       }
+
+       public void Run ()
+       {
+               Dialog w = (Dialog)xml.GetWidget ("abm_one");
+               w.Run ();
+               w.Destroy ();
+       }
+}
+
index 83d4e7b0720b621d8f9ee0f51c76b239db7012cc..079aeae143c0b98c3d797d57f0d99f07ef780b11 100644 (file)
@@ -75,6 +75,23 @@ public class VRegistrarVisitas
                        /* Nada seleccionado */
                        return;
                }
                        /* Nada seleccionado */
                        return;
                }
+
+               /* Confirmo la operacion */
+               MessageDialog md = new MessageDialog (
+                       null, 
+                       DialogFlags.DestroyWithParent,
+                       MessageType.Question, 
+                       ButtonsType.YesNo, "Esta seguro de quere eliminar el solicitante?"
+               );
+                    
+               ResponseType result = (ResponseType)md.Run ();
+
+               if (result == ResponseType.No) {
+                       md.Destroy ();
+                       return;
+               }
+               md.Destroy ();
+
                ETipoDocumento tipoDoc;
                int nroDoc;
                tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)store.GetValue (iter, 0), true);
                ETipoDocumento tipoDoc;
                int nroDoc;
                tipoDoc = (ETipoDocumento)Enum.Parse (typeof (ETipoDocumento), (string)store.GetValue (iter, 0), true);