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, IDbBackupRepository { public void DeleteForm(string keyValue) { using (var db = new RepositoryBase().BeginTrans()) { var dbBackupEntity = db.FindEntity(keyValue); if (dbBackupEntity != null) { FileHelper.DeleteFile(dbBackupEntity.F_FilePath); } db.Delete(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); } } }