public VenderProductosDialog(string usuario) { this.usuarioLogin = usuario; this.ventamodel = new Gtk.ListStore (typeof(int), typeof(string), typeof(string)); this.Build (); this.db = new ControladorBaseDatos (); bool correcta = false; nivelUsuario = db.ObtenerNivelUsuarioBd(usuarioLogin); if(nivelUsuario.Equals("Cajero")) { ProductosAction.Visible = false; UsuarioAction.Visible = false; } labelNombreCajero.Text = usuarioLogin.ToString(); labelFecha.ModifyFont (Pango.FontDescription.FromString ("Arial 15")); labelFecha.Text = "Fecha: "+DateTime.Now.ToShortDateString(); labelCajero.ModifyFont (Pango.FontDescription.FromString ("Arial 14")); labelNombreCajero.ModifyFont (Pango.FontDescription.FromString ("Arial 14")); labelTotal1.ModifyFont (Pango.FontDescription.FromString ("Arial 15")); labelTotalVenta.ModifyFont (Pango.FontDescription.FromString ("Arial 32")); try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos (); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } } Gtk.TreeViewColumn cantidad_column = new Gtk.TreeViewColumn (); cantidad_column.Title = " Cantidad"; Gtk.CellRendererText cantidad_cell = new Gtk.CellRendererText (); cantidad_column.PackStart (cantidad_cell, true); // cantidad_column.Width{}; Gtk.TreeViewColumn precio_column = new Gtk.TreeViewColumn (); precio_column.Title = "Precio"; Gtk.CellRendererText precio_cell = new Gtk.CellRendererText (); precio_column.PackStart (precio_cell, true); Gtk.TreeViewColumn descArticulo_column = new Gtk.TreeViewColumn (); descArticulo_column.Title = " Descripcion Articulo"; Gtk.CellRendererText descArticulo_cell = new Gtk.CellRendererText (); descArticulo_column.PackStart (descArticulo_cell, true); this.treeviewListaProductos.AppendColumn (cantidad_column); cantidad_column.Title = "Cantidad"; cantidad_column.AddAttribute (cantidad_cell, "text", 0); this.treeviewListaProductos.AppendColumn (descArticulo_column); descArticulo_column.AddAttribute (descArticulo_cell, "text", 1); precio_column.Title = "Precio"; this.treeviewListaProductos.AppendColumn (precio_column); precio_column.AddAttribute (precio_cell, "text", 2); descArticulo_column.Title = "Descripcion Articulo"; #if DEBUG Console.WriteLine(this.db.ObtenerBoleta()); #endif double temp = Convert.ToDouble (this.db.ObtenerBoleta ()); temp = temp + 1; Console.WriteLine ("temp"); Console.WriteLine (temp); boleta = temp.ToString (); Console.WriteLine (boleta); // this.treeviewListaProductos.Selection.Changed += TreeView2SelectionChanged; GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; }
public PrincipalWindow(string usuario) : base(Gtk.WindowType.Toplevel) { this.usuario_ = usuario; #if DEBUG Console.WriteLine ("En debug"); #endif this.Build (); this.db = new ControladorBaseDatos (); nivelUsuario = db.ObtenerNivelUsuarioBd(usuario_); if(nivelUsuario.Equals("Cajero")) { ProductosAction.Visible = false; UsuariosAction.Visible = false; } bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } Gtk.TreeViewColumn cantidad_column = new Gtk.TreeViewColumn(); cantidad_column.Title = "Cantidad"; Gtk.CellRendererText cantidad_cell = new Gtk.CellRendererText(); cantidad_column.PackStart(cantidad_cell, true); Gtk.TreeViewColumn precio_column = new Gtk.TreeViewColumn(); precio_column.Title = "Precio"; Gtk.CellRendererText precio_cell = new Gtk.CellRendererText(); precio_column.PackStart(precio_cell, true); Gtk.TreeViewColumn nombre_column = new Gtk.TreeViewColumn(); nombre_column.Title = "Nombre"; Gtk.CellRendererText nombre_cell = new Gtk.CellRendererText(); nombre_column.PackStart(nombre_cell, true); this.treeviewListaProductos.AppendColumn(cantidad_column); cantidad_column.AddAttribute(cantidad_cell, "text", 0); this.treeviewListaProductos.AppendColumn(nombre_column); nombre_column.AddAttribute(nombre_cell, "text", 1); this.treeviewListaProductos.AppendColumn(precio_column); precio_column.AddAttribute(precio_cell, "text", 2); #if DEBUG Console.WriteLine(this.db.ObtenerBoleta()); #endif double temp=Convert.ToDouble( this.db.ObtenerBoleta()); temp=temp+1; Console.WriteLine("temp"); Console.WriteLine(temp); boleta=temp.ToString(); Console.WriteLine(boleta); entryNumBoleta.Text=boleta; Console.WriteLine(entryNumBoleta.Text); this.treeviewListaProductos.Selection.Changed += TreeView2SelectionChanged; GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; labelTotalVenta.ModifyFont(Pango.FontDescription.FromString("Courier bold 32")); }