MacOrderDal.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Cksoft.Data;
  2. using DllEapEntity;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace DllScan.DAL
  8. {
  9. public class MacOrderDal
  10. {
  11. public IDatabase CurrDb;
  12. public MacOrderDal(IDatabase db)
  13. {
  14. CurrDb = db;
  15. }
  16. public IEnumerable<MacOrder> GetMacOrders(int start, int length, string order, string sort, string filter, string errorinfo)
  17. {
  18. var pros = CurrDb.FindListForCondition<MacOrder>($" {filter} order by {sort} {order} limit {start - 1},{length}", ref errorinfo);
  19. return pros;
  20. }
  21. public int GetCount(string filter)
  22. {
  23. string errorinfo = string.Empty;
  24. //string sql = $"select count(1) from ProgramRule a where 1=1 {filter}";
  25. var entities = CurrDb.FindListForCondition<MacOrder>(filter, ref errorinfo);
  26. if (entities != null)
  27. {
  28. return entities.Count();
  29. }
  30. return 0;
  31. }
  32. }
  33. }