Exemple #1
0
 private void Guardado_Click(object sender, EventArgs e)
 {
     if (EDITAR == false)
     {
         try
         {
             ObjetoCN.InsertarProd(texNombre.Text, textDescripcion.Text, textMarca.Text, textPrecio.Text, textStock.Text);
             MessageBox.Show("Se inserto correctamente");
             MostrarProductos();
         }
         catch (Exception ex)
         {
             MessageBox.Show("No se pudo insertar los datos por: " + ex);
         }
     }
     if (EDITAR == true)
     {
         try
         {
             ObjetoCN.EditProd(idProducto, texNombre.Text, textDescripcion.Text, textMarca.Text, textPrecio.Text, textStock.Text);
             MessageBox.Show("Se edito correctamente");
             MostrarProductos();
             LimpiarForm();
             EDITAR = false;
         }
         catch (Exception m)
         {
             MessageBox.Show("No se ha podido insertar los datos: " + m);
         }
     }
 }