纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3 KiB

1 year ago
  1. using NFine.Code;
  2. using NFine.Data;
  3. using NFine.Data.Extensions;
  4. using NFine.Domain.Entity.SystemSecurity;
  5. using NFine.Domain.IRepository.SystemSecurity;
  6. using NFine.Repository.SystemSecurity;
  7. namespace NFine.Repository.SystemSecurity
  8. {
  9. public class DbBackupRepository : RepositoryBase<DbBackupEntity>, IDbBackupRepository
  10. {
  11. public void DeleteForm(string keyValue)
  12. {
  13. using (var db = new RepositoryBase().BeginTrans())
  14. {
  15. var dbBackupEntity = db.FindEntity<DbBackupEntity>(keyValue);
  16. if (dbBackupEntity != null)
  17. {
  18. FileHelper.DeleteFile(dbBackupEntity.F_FilePath);
  19. }
  20. db.Delete<DbBackupEntity>(dbBackupEntity);
  21. db.Commit();
  22. }
  23. }
  24. public void ExecuteDbBackup(DbBackupEntity dbBackupEntity)
  25. {
  26. //DbHelper.ExecuteSqlCommand(string.Format("backup database {0} to disk ='{1}'", dbBackupEntity.F_DbName, dbBackupEntity.F_FilePath));
  27. dbBackupEntity.F_FileSize = FileHelper.ToFileSize(FileHelper.GetFileSize(dbBackupEntity.F_FilePath));
  28. dbBackupEntity.F_FilePath = "/Resource/DbBackup/" + dbBackupEntity.F_FileName;
  29. this.Insert(dbBackupEntity);
  30. }
  31. }
  32. }