예제 #1
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            int    codigo   = Convert.ToInt16(txtCodigo.Text);
            string nombre   = txtNombre.Text;
            double costo    = Convert.ToDouble(txtCosto.Text);
            int    cantidad = Convert.ToInt16(txtCant.Text);
            int    posicion = Convert.ToInt16(txtPosicion.Text);

            if (txtCodigo.Text == "" || txtCosto.Text == "" || txtNombre.Text == "" || txtCant.Text == "" || txtPosicion.Text == "")
            {
                MessageBox.Show("Ingrese el nuevo producto y posición");
                txtPosicion.Clear();
            }

            else if (posicion > inv.vec.Length || posicion <= 0)
            {
                MessageBox.Show("No se encuentra esta posición");
                txtPosicion.Clear();
            }

            else
            if (inv.posicionActual < inv.vec.Length)
            {
                inv.Insertar(new Producto(nombre, codigo, cantidad, costo), Convert.ToInt16(txtPosicion.Text));
                txtProducto.Text = inv.Mostrar();
            }

            txtCant.Clear();
            txtCodigo.Clear();
            txtNombre.Clear();
            txtCosto.Clear();
            txtPosicion.Clear();
        }
예제 #2
0
        private void bt_Insertar_Click(object sender, EventArgs e)
        {
            EntradaInv ent = new EntradaInv()
            {
                Articulo = new Artículo()
                {
                    ID     = Convert.ToInt32(tb_ID.Text),
                    Nombre = tb_Nombre.Text,
                    Precio = Convert.ToDouble(tb_Precio.Text)
                },
                Cantidad = Convert.ToInt32(tb_Cantidad.Text)
            };

            if (inv.Insertar(ent, Convert.ToInt32(tb_Pos.Text)))
            {
                MessageBox.Show("Artículo Insertado con éxito");
                tb_ID.Text       = "";
                tb_Nombre.Text   = "";
                tb_Precio.Text   = "";
                tb_Cantidad.Text = "";
                tb_Pos.Text      = "";
            }
            else
            {
                MessageBox.Show("La posición donde se desea insertae el artículo ya está ocupada");
            }
        }
 private void btnInsertar_Click(object sender, EventArgs e)
 {
     Inven.Insertar(Produc = new Producto(Convert.ToInt32(txtCodigoAg.Text), txtNombreAg.Text,
                                          Convert.ToInt32(txtCantidadAg.Text), Convert.ToInt32(txtPrecioAg.Text)),
                    Convert.ToInt32(txtInsertar.Text));
 }