예제 #1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            if (textBoxCantidad.Text != "" && textBoxPrecioVenta.Text != "" && textBoxPrecioBase.Text != "")
            {
                Inventario v = Inventario.Search(Convert.ToInt32(textBoxID.Text));

                v.IdProducto   = Convert.ToInt32(textBoxIDProducto.Text);
                v.Cantidad     = Convert.ToInt32(textBoxCantidad.Text);
                v.PrecioBase   = Convert.ToInt64(textBoxPrecioBase.Text);
                v.PrecioVenta  = Convert.ToInt64(textBoxPrecioVenta.Text);
                v.FechaIngreso = Convert.ToDateTime(dateTimePickerFechaIngreso.Value.ToShortDateString());
                v.FechaSalida  = Convert.ToDateTime(dateTimePickerFechaSalida.Value.ToShortDateString());

                if (Inventario.Find(v.IdInventario))
                {
                    Inventario.Update(v);

                    splitContainer1.Panel2.Controls.Clear();
                    ImprimirData(splitContainer1.Panel2).Show();
                    MessageBox.Show("Operación éxitosa");
                    LoadShowInventory(v);
                    ShowPositionID(v);
                }
                else
                {
                    MessageBox.Show("Operación fallida");
                }
            }
            else
            {
                MessageBox.Show("Campo vacio.\n¡Complete el campo!");
            }
        }