Esempio n. 1
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (!ValidarCampos)
     {
         Interface = new InterfaceUsuario(this);
         RegistroProducto Modificar = ObtenerRegistro;
         Modificar.Clave = Convert.ToInt32(tbClave.Text);
         if (Interface.ActualizarProducto(Modificar))
         {
             if (Interface.ObtenerUnProducto(Modificar.Nombre).Clave == Modificar.Clave)
             {
                 string msg = "";
                 if (!ActualizarProMat(out msg))
                 {
                     MessageBox.Show("Producto actualizado con éxito", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     Validar.MensajeErrorBaseDeDatos();
                 }
                 LlamarEventoCerrar();
                 Close();
             }
             else
             {
                 Validar.MensajeErrorOK("El nombre " + Modificar.Nombre + " ya ha sido usado y no puede repetirse");
             }
         }
         else
         {
             Validar.MensajeErrorBaseDeDatos();
         }
     }
 }