private void Registrar() { try { if (!ValidarCampos()) { return; } clsProducto objProd = new clsProducto(strNombreApp); objProd.IdProducto = this.txtCodigoProducto.Text; objProd.NombreProducto = this.txtNombre.Text; objProd.Precio = this.txtPrecio.Text; if (!objProd.CrearProducto()) { this.lblMensaje.Text = objProd.Error; this.pnlAlerta.Visible = true; objProd = null; return; } if (objProd.Respuesta == 0) { this.lblMensaje.Text = "Este producto ya se encuentra registrado"; this.pnlAlerta.Visible = true; objProd = null; return; } else { this.lblMensaje.Text = "Nuevo Producto registrado con exito"; this.pnlAlerta.Visible = true; objProd = null; return; } } catch (Exception ex) { this.lblMensaje.Text = ex.Message; this.pnlAlerta.Visible = true; return; } }