爱思开
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.

48 lines
1.7 KiB

2 years ago
  1. using ICSSoft.Entity;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. namespace ICSSoft.DataProject
  6. {
  7. public static class LanguageHelper
  8. {
  9. /// <summary>
  10. /// 根据传入代码模糊查找获取对应的语言提示信息
  11. /// </summary>
  12. /// <param name="Code"></param>
  13. /// <returns></returns>
  14. public static Dictionary<string, string> GetName(string Code)
  15. {
  16. WMSBarCoreModel model = new WMSBarCoreModel();
  17. model.Code = Code;
  18. var resultStr = ICSSubmitService.PromptInformationGet(model);
  19. Dictionary<string, string> dic = new Dictionary<string, string>();
  20. foreach (DataRow dr in resultStr.Rows)
  21. {
  22. dic.Add(dr["Code"].ToString(), dr["Name"].ToString());
  23. }
  24. return dic;
  25. }
  26. /// <summary>
  27. /// 根据传入代码模糊查找获取对应的一行语言提示信息
  28. /// </summary>
  29. /// <param name="Code"></param>
  30. /// <returns></returns>
  31. public static string GetNameSingle(string Code)
  32. {
  33. WMSBarCoreModel model = new WMSBarCoreModel();
  34. model.Code = Code;
  35. var resultStr = ICSSubmitService.PromptInformationGet(model);
  36. if (resultStr == null || resultStr.Rows.Count <= 0)
  37. throw new Exception(string.Format("未查询到编码:{0} 对应的语言信息!",Code));
  38. return resultStr.Rows[0]["Name"].ToString();
  39. }
  40. public static string GetNameByCode(this Dictionary<string, string> language, string Code)
  41. {
  42. return language.ContainsKey(Code) ? language[Code] : "未维护多语言代码:"+Code+"!";
  43. }
  44. }
  45. }