public void Load(System.IO.FileStream file) { cod = Util.LoadInt(file); x = Util.LoadInt(file); y = Util.LoadInt(file); tipoMesa = Util.LoadBool(file); estado = Util.LoadInt(file); juntadaCon = Util.LoadInt(file); int numLineas = Util.LoadInt(file); lineas.Clear(); for ( int i = 0 ; i < numLineas ; i++ ) { Linea l = new Linea(); l.Load(file); lineas.Add(l); System.Data.DataRow miDataRow = dataLineas.NewRow(); Articulo a = GestorArticulos.getArticulo(l.CodArticulo); miDataRow["Nombre"] = a.Desc ; miDataRow["Precio"] = a.PvpConIva ; miDataRow["Estado"] = l.getEstadoString(); dataLineas.Rows.Add(miDataRow); } }
private void botonesMesa_Click(object sender, System.EventArgs e) { if (modoDeOperacion == ModoNormal) { Plaza p = GestorPlazas.getPlaza((System.Windows.Forms.Button)sender); if (!p.isJuntada) { for (int i = 0; i < GestorPlazas.NewCod - 1; i++) { GestorPlazas.getBotonTPV(i).Text = ""; } ((Button)sender).Text = "X"; GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).ResetSeleccion(); SeleccionarMesa(p.Cod); } } else if (modoDeOperacion == ModoSacarMesa) { Plaza p = GestorPlazas.getPlaza((System.Windows.Forms.Button)sender); GestorPlazas.ActivarPlaza(p.Cod); GestorPlazas.Save(); } else if (modoDeOperacion == ModoTraspasar) { // Vamos a traspasar cosas int cuenta = 0; bool traspasadoTodo = false; for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++) { Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]); if (l.Seleccionado) { cuenta++; GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l); GestorPlazas.getPlaza(mesaSeleccionada).EliminarLinea(i); i--; } } if (cuenta == 0) { // Traspasamos todo traspasadoTodo = true; for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++) { Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]); GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l); GestorPlazas.getPlaza(mesaSeleccionada).EliminarLinea(i); i--; } } GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Activar(); GestorPlazas.ActualizarBotones(); GestorPlazas.Save(); // Reponemos el modo de operacion modoDeOperacion = ModoNormal; panelFamilias.Enabled = true; panelArticulos.Enabled = true; panelLineas.Enabled = true; panelGeneral.Visible = true; panelOpsConMesa.Visible = true; panelTraspasar.Visible = false; if (traspasadoTodo) { // Elegimos la nueva mesa SeleccionarMesa(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod); } ActualizarPanelConMesa(); } else if (modoDeOperacion == ModoJuntar) { // Traspasamos todo for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++) { Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]); GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l); } GestorPlazas.getPlaza(mesaSeleccionada).Clear(); GestorPlazas.getPlaza(mesaSeleccionada).Juntar(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod); GestorPlazas.ActualizarBotones(); GestorPlazas.Save(); // Reponemos el modo de operacion modoDeOperacion = ModoNormal; panelFamilias.Enabled = true; panelArticulos.Enabled = true; panelLineas.Enabled = true; panelGeneral.Visible = true; panelOpsSinMesa.Visible = true; panelJuntar.Visible = false; // Elegimos la nueva mesa SeleccionarMesa(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod); ActualizarPanelConMesa(); } else if (modoDeOperacion == ModoSeparar) { GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Activar(); GestorPlazas.ActualizarBotones(); GestorPlazas.Save(); modoDeOperacion = ModoNormal; panelFamilias.Enabled = true; panelArticulos.Enabled = true; panelLineas.Enabled = true; panelGeneral.Visible = true; panelOpsSinMesa.Visible = true; panelSeparar.Visible = false; ActualizarPanelConMesa(); } }
public void AddLinea(Linea l) { lineas.Add(l); // Generamos la row System.Data.DataRow miDataRow = dataLineas.NewRow() ; Articulo a = GestorArticulos.getArticulo(l.CodArticulo); miDataRow["Nombre"] = a.Desc ; miDataRow["Precio"] = a.PvpConIva ; miDataRow["Estado"] = l.getEstadoString(); dataLineas.Rows.Add(miDataRow); }