public static bool HacerBackup(List <string> mensajesDeError)
        {
            // Primero debo chequear la integridad de la BD
            if (DigitoVerificador.VerificarIntegridad(mensajesDeError))
            {
                try
                {
                    string rutaBackup = ConfigurationManager.AppSettings.Get("ubicacionBackups");
                    Directory.CreateDirectory(rutaBackup); // Si la carpeta no existe, la crea

                    string nombreArchivo = DateTime.Now.ToString(DATE_FORMAT_FOR_FILE);
                    BackupMapper.HacerBackup(rutaBackup + nombreArchivo + ".bak");
                    return(true);
                }
                catch (Exception ex)
                {
                    Log.Log.Grabar(ex);
                }
            }

            mensajesDeError.Add("No se puede hacer un backup porque la base de datos no está íntegra.");
            return(false);
        }
Exemple #2
0
 public static bool Chequear(List <string> mensajesDeError)
 {
     return(DigitoVerificador.VerificarIntegridad(mensajesDeError));
 }