Ejemplo n.º 1
0
        private void btn_Modificar_Click(object sender, EventArgs e)
        {
            if (txt_Nombre.Text == "" && txt_PreCompra.Text == "" && txt_PreVenta.Text == "" && txt_Stock.Text == "" && txt_Ubicacion.Text == "")
            {
                MessageBox.Show("Llene todos los campos");
            }
            else
            {
                DatosProducto.IdProducto     = int.Parse(txt_Id.Text);
                DatosProducto.NombreProducto = txt_Nombre.Text;
                DatosProducto.PrecioCompra   = double.Parse(txt_PreCompra.Text);
                DatosProducto.PrecioVenta    = double.Parse(txt_PreVenta.Text);
                DatosProducto.StockProducto  = double.Parse(txt_Stock.Text);
                DatosProducto.Ubicacion      = txt_Ubicacion.Text;

                if (BD.ActualizarDatos(DatosProducto) == 1)
                {
                    MessageBox.Show("Datos actualizados");
                    RefrescarVista();
                    txt_Nombre.Clear();
                    txt_Id.Clear();
                    txt_PreCompra.Clear();
                    txt_PreVenta.Clear();
                    txt_Stock.Clear();
                    txt_Ubicacion.Clear();
                }
                else
                {
                    MessageBox.Show("Error al actulizar");
                }
            }
        }