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

1 year ago
  1. using NFine.Code;
  2. using NFine.Domain.Entity.SystemSecurity;
  3. using NFine.Domain.IRepository.SystemSecurity;
  4. using NFine.Repository.SystemSecurity;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. namespace NFine.Application.SystemSecurity
  9. {
  10. public class DbBackupApp
  11. {
  12. private IDbBackupRepository service = new DbBackupRepository();
  13. public List<DbBackupEntity> GetList(string queryJson)
  14. {
  15. var expression = ExtLinq.True<DbBackupEntity>();
  16. var queryParam = queryJson.ToJObject();
  17. if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty())
  18. {
  19. string condition = queryParam["condition"].ToString();
  20. string keyword = queryParam["keyword"].ToString();
  21. switch (condition)
  22. {
  23. case "DbName":
  24. expression = expression.And(t => t.F_DbName.Contains(keyword));
  25. break;
  26. case "FileName":
  27. expression = expression.And(t => t.F_FileName.Contains(keyword));
  28. break;
  29. }
  30. }
  31. return service.IQueryable(expression).OrderByDescending(t => t.F_BackupTime).ToList();
  32. }
  33. public DbBackupEntity GetForm(string keyValue)
  34. {
  35. return service.FindEntity(keyValue);
  36. }
  37. public void DeleteForm(string keyValue)
  38. {
  39. service.DeleteForm(keyValue);
  40. }
  41. public void SubmitForm(DbBackupEntity dbBackupEntity)
  42. {
  43. dbBackupEntity.F_Id = Common.GuId();
  44. dbBackupEntity.F_EnabledMark = true;
  45. dbBackupEntity.F_BackupTime = DateTime.Now;
  46. service.ExecuteDbBackup(dbBackupEntity);
  47. }
  48. }
  49. }