public static void BackupDatabase(Backups backup) { //Genero la bitacora UsuariosComponent usuarios = new UsuariosComponent(); EventoBitacora eventoBitacora = new EventoBitacora(); Usuarios unUsuario = new Usuarios(); unUsuario = usuarios.ReadBy(backup.usuarios.Id); eventoBitacora.Id = 9; BitacoraComponent bitacoraComponent = new BitacoraComponent(); Bitacora bitacora = new Bitacora(unUsuario, eventoBitacora); bitacora.fecha = DateTime.Now.ToString("dd-MM-yyyy"); bitacora.hora = DateTime.Now.ToString("hh mm ss"); bitacoraComponent.Create(bitacora); //Realizo el backup Backups backupRestore = new Backups(unUsuario); BackupDAC backupDAC = new BackupDAC(); backupRestore = backup; backupRestore.Path = "c:/Backup/" + @backup.Nombre + ".bak"; backupDAC.CreateBackup(backupRestore); bitacoraComponent.Create(bitacora); }
public static void BackupDatabase(Backups backup) { Entities.Backups backupRestore = new Entities.Backups(); BackupDAC backupDAC = new BackupDAC(); backupRestore = backup; backupRestore.Path = HostingEnvironment.MapPath("~/Backup/" + @backup.Nombre + ".bak"); BitacoraComponent bitacoraComponent = new BitacoraComponent(); Bitacora bitacora = new Bitacora(); bitacora.eventoBitacora.Id = 10; bitacora.fecha = DateTime.Now.ToString("dd-MM-yyyy"); bitacora.hora = DateTime.Now.ToString("hh mm ss"); UsuariosComponent usuarios = new UsuariosComponent(); bitacora.usuarios = usuarios.ReadBy(backup.usuarios.Id); backupDAC.CreateBackup(backupRestore); bitacoraComponent.Create(bitacora); }