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

54 lines
1.7 KiB

3 years ago
  1. using NFine.Application.SystemSecurity;
  2. using NFine.Code;
  3. using NFine.Domain.Entity.SystemSecurity;
  4. using System.Web.Mvc;
  5. namespace NFine.Web.Areas.SystemSecurity.Controllers
  6. {
  7. public class DbBackupController : ControllerBase
  8. {
  9. private DbBackupApp dbBackupApp = new DbBackupApp();
  10. [HttpGet]
  11. [HandlerAjaxOnly]
  12. public ActionResult GetGridJson(string queryJson)
  13. {
  14. var data = dbBackupApp.GetList(queryJson);
  15. return Content(data.ToJson());
  16. }
  17. [HttpPost]
  18. [HandlerAjaxOnly]
  19. [ValidateAntiForgeryToken]
  20. public ActionResult SubmitForm(DbBackupEntity dbBackupEntity)
  21. {
  22. dbBackupEntity.F_FilePath = Server.MapPath("~/Resource/DbBackup/" + dbBackupEntity.F_FileName + ".bak");
  23. dbBackupEntity.F_FileName = dbBackupEntity.F_FileName + ".bak";
  24. dbBackupApp.SubmitForm(dbBackupEntity);
  25. return Success("操作成功。");
  26. }
  27. [HttpPost]
  28. [HandlerAjaxOnly]
  29. [HandlerAuthorize]
  30. [ValidateAntiForgeryToken]
  31. public ActionResult DeleteForm(string keyValue)
  32. {
  33. dbBackupApp.DeleteForm(keyValue);
  34. return Success("删除成功。");
  35. }
  36. [HttpPost]
  37. [HandlerAuthorize]
  38. public void DownloadBackup(string keyValue)
  39. {
  40. var data = dbBackupApp.GetForm(keyValue);
  41. string filename = Server.UrlDecode(data.F_FileName);
  42. string filepath = Server.MapPath(data.F_FilePath);
  43. if (FileDownHelper.FileExists(filepath))
  44. {
  45. FileDownHelper.DownLoadold(filepath, filename);
  46. }
  47. }
  48. }
  49. }