ConfiguretermsInfoServices.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.Entities;
  6. using EMIS.DataLogic.Repositories;
  7. using Bowin.Common.JSON;
  8. using Bowin.Common.Linq;
  9. using System.Web;
  10. using EMIS.ViewModel;
  11. using System.Linq.Expressions;
  12. namespace EMIS.CommonLogic.SystemServices
  13. {
  14. public class ConfiguretermsInfoServices : BaseServices, IConfiguretermsInfoServices
  15. {
  16. public ConfiguretermsInfoRepository configuretermsInfoRepository { get; set; }
  17. public ConfiguretermsExpandRepository configuretermsExpandRepository { get; set; }
  18. /// <summary>
  19. /// 获取查询条件列表
  20. /// </summary>
  21. /// <param name="munClass">例如 表名</param>
  22. /// <param name="munID">页面ID</param>
  23. /// <returns></returns>
  24. public List<Entities.Sys_ConfiguretermsInfo> GetConfiguretermsInfo(string munID, string munClass)
  25. {
  26. //查询条件
  27. Expression<Func<Sys_ConfiguretermsInfo, bool>> expression = x => x.MNUID == munID && x.MUNClass == munClass && x.RecordStatus == (int)SYS_STATUS.USABLE;
  28. var result = configuretermsInfoRepository.GetList(expression, i => i.Sys_ConfiguretermsExpand).OrderBy(x => x.OrderNo).ToList();
  29. foreach (var item in result.SelectMany(s => s.Sys_ConfiguretermsExpand))
  30. {
  31. item.Sys_ConfiguretermsInfo = null;
  32. }
  33. return result;
  34. }
  35. public List<Sys_ConfiguretermsExpand> GetConfiguretermsExpand(Guid ConfiguretermsInfoID)
  36. {
  37. //查询条件
  38. System.Linq.Expressions.Expression<Func<Sys_ConfiguretermsExpand, bool>> expression = (x => true);
  39. if (ConfiguretermsInfoID != null && ConfiguretermsInfoID != Guid.Empty)
  40. expression = (x => x.ConfiguretermsInfoID == ConfiguretermsInfoID);
  41. return configuretermsExpandRepository.GetList(expression).OrderBy(x => x.CreateTime).ToList();
  42. }
  43. /// <summary>
  44. /// 获取控件名称
  45. /// </summary>
  46. /// <param name="ConfiguretermsInfo"></param>
  47. /// <returns></returns>
  48. public string GetConControlName(Sys_ConfiguretermsInfo ConfiguretermsInfo)
  49. {
  50. string name = ConfiguretermsInfo.Value.Replace(".", "");
  51. if (ConfiguretermsInfo.ControlType == "TextBox")
  52. name = name + "_QueryTextBox";
  53. else if (ConfiguretermsInfo.ControlType == "DropdownList")
  54. name = name + "_QueryDropdownList";
  55. else if (ConfiguretermsInfo.ControlType == "DictionaryDropDownList")
  56. name = name + "_QueryDictionaryDropDownList";
  57. else if (ConfiguretermsInfo.ControlType == "CheckBox")
  58. name = name + "_QueryCheckBox";
  59. else if (ConfiguretermsInfo.ControlType == "ComboGrid")
  60. name = name + "_QueryComboGrid";
  61. else if (ConfiguretermsInfo.ControlType == "TextBoxDate")
  62. name = name + "_QueryTextBoxDate";
  63. return name;
  64. }
  65. }
  66. }