Ejemplo n.º 1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            frmSeleccionarMenu frmSeleccionMenu = new frmSeleccionarMenu();

            if (frmSeleccionMenu.ShowDialog() == DialogResult.OK)
            {
                entradaSeleccionada    = frmSeleccionMenu.EntradaSeleccionada;
                platoFondoSeleccionado = frmSeleccionMenu.PlatoFondoSeleccionado;
                MessageBox.Show(platoFondoSeleccionado.Nombre, "Mensaje de aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Orden_Menu_Detalle detalle = new Orden_Menu_Detalle();
                detalle.PlatoFondo = new Controlador.DetalleOrdenWS.PlatoFondo();
                detalle.Entrada    = new Controlador.DetalleOrdenWS.Entrada();
                if (detalle == null)
                {
                    MessageBox.Show("Error!!", "Mensaje de aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (platoFondoSeleccionado == null)
                {
                    MessageBox.Show("Plato nulo!", "Mensaje de aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                detalle.PlatoFondo.Id     = platoFondoSeleccionado.Id;
                detalle.PlatoFondo.Nombre = platoFondoSeleccionado.Nombre;
                detalle.PlatoFondo.Precio = platoFondoSeleccionado.Precio;
                detalle.Entrada.Id        = entradaSeleccionada.Id;
                detalle.Entrada.Nombre    = entradaSeleccionada.Nombre;
                detalle.Texto             = "Entrada: " + detalle.Entrada.Nombre + "\nPlato Fondo: " + detalle.PlatoFondo.Nombre + "\nPrecio: " + detalle.PlatoFondo.Precio;
                lstDetalleOrden.Add(detalle);
                //dgvOrdenesMenu.DataSource = lstDetalleOrden;

                //dgvOrdenesMenu.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "Texto", HeaderText = "Custom ToString value" });
            }
        }
Ejemplo n.º 2
0
        public bool registrarDetallePedido(Orden_Menu_Detalle detalle)
        {
            String          cadena = "server=50.62.209.188;" + "user=fpaz; password=123456; database=LP2;" + "port=3306";
            MySqlConnection conn   = new MySqlConnection(cadena);

            conn.Open();
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "INSERT INTO ORDEN_MENU_DETALLE(ID_ORDEN_MENU_DETALLE,FID_ORDEN,FID_ENTRADA,FID_PLATO_FONDO) VALUES ('NULL','" + detalle.IdOrden + "','" + detalle.Entrada.Id + "','" + detalle.PlatoFondo.Id + "')";
            comando.Connection  = conn;
            comando.ExecuteNonQuery();
            return(true);
        }
Ejemplo n.º 3
0
        public BindingList <Orden_Menu_Detalle> listarDetalleDeOrden()
        {
            BindingList <Orden_Menu_Detalle> lista = new BindingList <Orden_Menu_Detalle>();
            String          cadena = "server=50.62.209.188;" + "user=fpaz; password=123456; database=LP2;" + "port=3306";
            MySqlConnection conn   = new MySqlConnection(cadena);

            conn.Open();
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "SELECT * FROM ORDEN_MENU_DETALLE";
            comando.Connection  = conn;

            MySqlDataReader reader = comando.ExecuteReader();

            EntradaDA             entradaDA   = new EntradaDA();
            BindingList <Entrada> lstEntradas = new BindingList <Entrada>();

            lstEntradas = entradaDA.listarEntradas();

            PlatoFondoDA             platoFondoDA   = new PlatoFondoDA();
            BindingList <PlatoFondo> lstPlatosFondo = new BindingList <PlatoFondo>();

            lstPlatosFondo = platoFondoDA.listarPlatoFondo();

            while (reader.Read())
            {
                Orden_Menu_Detalle detalle = new Orden_Menu_Detalle();
                detalle.Id      = reader.GetInt32(0);
                detalle.IdOrden = reader.GetInt32(1);
                for (int i = 0; i < lstEntradas.Count(); i++)
                {
                    if (lstEntradas.ElementAt(i).Id == reader.GetInt32(2))
                    {
                        detalle.Entrada = lstEntradas.ElementAt(i);
                        break;
                    }
                }
                for (int i = 0; i < lstPlatosFondo.Count(); i++)
                {
                    if (lstPlatosFondo.ElementAt(i).Id == reader.GetInt32(3))
                    {
                        detalle.PlatoFondo = lstPlatosFondo.ElementAt(i);
                        break;
                    }
                }
                lista.Add(detalle);
            }
            conn.Close();
            return(lista);
        }
Ejemplo n.º 4
0
 public bool registrarDetalleDeOrden(Orden_Menu_Detalle o)
 {
     return(detalleDA.registrarDetallePedido(o));
 }