예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ((comboBoxItem.Text != "") && (mesaTextCantidad.Text != ""))
            {
                //Lógica de inserción
                Mesa       mesita     = new Mesa();
                int        numPedido  = mesita.MesaVerPedido(int.Parse(p.Tag.ToString()));
                PedidoItem pi         = new PedidoItem();
                Item       ite        = new Item();
                int        codigoItem = ite.DevolverID(comboBoxItem.Text);
                pi.PedidoItemCrear(codigoItem, int.Parse(mesaTextCantidad.Text), int.Parse(mesaTextoPrecio.Text), numPedido);

                //Vacío los campos
                comboBoxItem.SelectedIndex = -1;
                mesaTextCantidad.Text      = "";
                mesaTextoPrecio.Text       = "";
                MessageBox.Show("Producto agregado al pedido");

                //Relleno el dataGrid
                int     mesaNumero = Int32.Parse(p.Tag.ToString());
                Mesa    m          = new Mesa();
                DataSet DDSS       = new DataSet();
                DDSS = m.PedidoVer(mesaNumero);
                dataGridView2.DataSource = DDSS.Tables[0];
            }
        }
예제 #2
0
        private void botonCerrarMesa_Click(object sender, EventArgs e)
        {
            //Recorro el DataGridView y cuento el total
            int cont  = dataGridView2.Rows.Count;
            int total = 0;

            for (int contador = 0; contador < cont; contador++)
            {
                total = total + int.Parse(dataGridView2.Rows[contador].Cells["precio"].Value.ToString());
            }

            //Muestro el panel con el resultado final
            panelMesaCerrada.Visible = true;
            panelMesaCerrada.BringToFront();
            labelMesaTotal.Text   = total.ToString();
            labelMesaCerrada.Text = "Mesa " + p.Tag.ToString();
            DataSet DDSS       = new DataSet();
            int     mesaNumero = Int32.Parse(p.Tag.ToString());
            Mesa    m          = new Mesa();

            DDSS = m.PedidoVer(mesaNumero);
            dataGridView3.DataSource = DDSS.Tables[0];

            //Vacío la mesa

            m.MesaVaciar(int.Parse(p.Tag.ToString()));
            botonMesaAgregar.Enabled = false;
            botonCerrarMesa.Enabled  = false;
            botonAbrirMesa.Enabled   = true;
            dataGridView2.DataSource = null;
        }
예제 #3
0
        //Hago cosas de interfaz cuando la mesa está llena
        public void MesaLlena()
        {
            botonAbrirMesa.Enabled  = false;
            botonCerrarMesa.Enabled = true;
            DataSet DDSS = new DataSet();

            labelMesaVacia.Visible = false;

            int  mesaNumero = Int32.Parse(p.Tag.ToString());
            Mesa m          = new Mesa();

            DDSS = m.PedidoVer(mesaNumero);
            dataGridView2.DataSource = DDSS.Tables[0];


            comboBoxItem.Visible     = true;
            mesaTextoPrecio.Visible  = true;
            mesaTextCantidad.Visible = true;
            botonMesaAgregar.Enabled = true;
        }