纽威
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

using NFine.Code;
using NFine.Data;
using NFine.Data.Extensions;
using NFine.Domain.Entity.SystemSecurity;
using NFine.Domain.IRepository.SystemSecurity;
using NFine.Repository.SystemSecurity;
namespace NFine.Repository.SystemSecurity
{
public class DbBackupRepository : RepositoryBase<DbBackupEntity>, IDbBackupRepository
{
public void DeleteForm(string keyValue)
{
using (var db = new RepositoryBase().BeginTrans())
{
var dbBackupEntity = db.FindEntity<DbBackupEntity>(keyValue);
if (dbBackupEntity != null)
{
FileHelper.DeleteFile(dbBackupEntity.F_FilePath);
}
db.Delete<DbBackupEntity>(dbBackupEntity);
db.Commit();
}
}
public void ExecuteDbBackup(DbBackupEntity dbBackupEntity)
{
//DbHelper.ExecuteSqlCommand(string.Format("backup database {0} to disk ='{1}'", dbBackupEntity.F_DbName, dbBackupEntity.F_FilePath));
dbBackupEntity.F_FileSize = FileHelper.ToFileSize(FileHelper.GetFileSize(dbBackupEntity.F_FilePath));
dbBackupEntity.F_FilePath = "/Resource/DbBackup/" + dbBackupEntity.F_FileName;
this.Insert(dbBackupEntity);
}
}
}