DictionaryHelper.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.Entities;
  6. using EMIS.ViewModel;
  7. using EMIS.ViewModel.CacheManage;
  8. namespace EMIS.Utility
  9. {
  10. public class DictionaryHelper
  11. {
  12. /// <summary>
  13. ///
  14. /// </summary>
  15. /// <param name="dictionaryItem"></param>
  16. /// <returns></returns>
  17. public static IEnumerable<Sys_DictionaryItem> GetDictionaryValue(DictionaryItem dictionaryItem)
  18. {
  19. return GetDictionaryValue(dictionaryItem.ToString());
  20. }
  21. /// <summary>
  22. ///
  23. /// </summary>
  24. /// <param name="dictionaryValue"></param>
  25. /// <param name="dictionaryCode"></param>
  26. /// <returns></returns>
  27. public static Sys_DictionaryItem GetSingleDictionary(int dictionaryValue, string dictionaryCode)
  28. {
  29. return GetDictionaryValue(dictionaryCode).FirstOrDefault(x => x.Value == dictionaryValue);
  30. }
  31. /// <summary>
  32. ///
  33. /// </summary>
  34. /// <param name="dictionaryCode"></param>
  35. /// <returns></returns>
  36. public static IEnumerable<Sys_DictionaryItem> GetDictionaryValue(string dictionaryCode)
  37. {
  38. return IdNameExt.GetDictionaryItem(dictionaryCode);
  39. }
  40. }
  41. }