Example #1
0
        public Boolean ActualizarPruebaAplicadaConImagen(Decimal REGISTRO,
            Decimal ID_PRUEBA,
            Decimal ID_CATEGORIA,
            DateTime FECHA_R,
            String OBS_PRUEBA,
            String RESULTADOS,
            byte[] ARCHIVO_PRUEBA,
            String ARCHIVO_EXTENSION,
            Decimal ARCHIVO_TAMANO,
            String ARCHIVO_TYPE,
            Conexion conexion)
        {
            String informacion = null;
            Boolean ejecutar = true;
            Int32 registro = 0;

            tools _tools = new tools();
            #region validaciones

            if (REGISTRO != 0)
            {
                informacion += "REGISTRO = '" + REGISTRO + "', ";
            }
            else
            {
                MensajeError += "El campo REGISTRO no puede ser 0\n";
                ejecutar = false;
            }
            if (ID_PRUEBA != 0)
            {
                informacion += "ID_PRUEBA = '" + ID_PRUEBA + "', ";
            }
            else
            {
                MensajeError += "El campo ID_PRUEBA no puede ser 0\n";
                ejecutar = false;
            }
            if (ID_CATEGORIA != 0)
            {
                informacion += "ID_CATEGORIA = '" + ID_CATEGORIA + "', ";
            }
            else
            {
                MensajeError += "El campo ID_CATEGORIA no puede ser 0\n";
                ejecutar = false;
            }

            informacion += "FECHA_R = '" + _tools.obtenerStringConFormatoFechaSQLServer(FECHA_R) + "', ";

            if (!(String.IsNullOrEmpty(OBS_PRUEBA)))
            {
                informacion += "OBS_PRUEBA = '" + OBS_PRUEBA + "', ";
            }
            else
            {
                MensajeError += "El campo OBS_PRUEBA no puede ser nulo. \n";
                ejecutar = false;
            }

            if (!(String.IsNullOrEmpty(RESULTADOS)))
            {
                informacion += "RESULTADOS = '" + RESULTADOS + "', ";
            }
            else
            {
                MensajeError += "El campo RESULTADOS no puede ser nulo. \n";
                ejecutar = false;
            }
            #endregion validaciones

            if (ejecutar)
            {
                try
                {
                    registro = conexion.ExecuteNonQueryParaActualizarPruebaConImagen(REGISTRO, ID_PRUEBA, ID_CATEGORIA, FECHA_R, OBS_PRUEBA, RESULTADOS, Usuario, ARCHIVO_PRUEBA, ARCHIVO_EXTENSION, ARCHIVO_TAMANO, ARCHIVO_TYPE);

                    if (registro == 0)
                    {
                        return false;
                    }
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    return false;
                }
            }

            if (registro == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }