PosMachinesTwoDbconn.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MySystem.MainModels;
  5. namespace MySystem
  6. {
  7. public class PosMachinesTwoDbconn
  8. {
  9. public readonly static PosMachinesTwoDbconn Instance = new PosMachinesTwoDbconn();
  10. #region 获取单个字段
  11. public PosMachinesTwo Get(int Id)
  12. {
  13. WebCMSEntities db = new WebCMSEntities();
  14. PosMachinesTwo order = db.PosMachinesTwo.FirstOrDefault(m => m.Id == Id);
  15. if (order != null)
  16. {
  17. // RedisDbconn.Instance.Set(key, order);
  18. // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
  19. }
  20. db.Dispose();
  21. return order;
  22. }
  23. public PosMachinesTwo Get(string PosSn)
  24. {
  25. WebCMSEntities db = new WebCMSEntities();
  26. MachineForSnNo machineFor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == PosSn) ?? new MachineForSnNo();
  27. PosMachinesTwo order = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machineFor.SnId);
  28. if (order != null)
  29. {
  30. }
  31. return order;
  32. }
  33. #endregion
  34. }
  35. }