ExChangeCheckModel.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Muchinfo.MTPClient.Data.Model
  4. {
  5. public class ExChangeCheckModel
  6. {
  7. /// <summary>
  8. /// uint是商品组的groupId ,List<uint>是goodsIds
  9. /// </summary>
  10. private Dictionary<long, List<uint>> _groupDictionary = new Dictionary<long, List<uint>>();
  11. public Dictionary<long, List<uint>> Group
  12. {
  13. get { return _groupDictionary; }
  14. set { _groupDictionary = value; }
  15. }
  16. /// <summary>
  17. /// uint ExChangeId, List<long> groupIds
  18. /// </summary>
  19. private Dictionary<long, List<long>> _exChanegGroup = new Dictionary<long, List<long>>();
  20. public Dictionary<long, List<long>> ExChangeGroup
  21. {
  22. get { return _exChanegGroup; }
  23. set { _exChanegGroup = value; }
  24. }
  25. /// <summary>
  26. /// 查看下该交易所下是否有商品
  27. /// </summary>
  28. /// <param name="exChangeId"></param>
  29. /// <returns></returns>
  30. public bool IsExchangeHasGoods(long exChangeId)
  31. {
  32. if (ExChangeGroup.Count <= exChangeId)
  33. {
  34. return false;
  35. }
  36. List<long> groups = ExChangeGroup[exChangeId]; // 先查找交易所和商品组的关系
  37. var ret = groups.Find(g => (Group.ContainsKey(g) && Group[g] != null && Group[g].Count > 0)); // 找出商品组下的商品信息,返回的是List<uint>
  38. return ret != 0;
  39. }
  40. }
  41. }