IndustryBranchInfoRepository.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. namespace YZXYH.Repository
  5. {
  6. public partial class IndustryBranchInfoRepository
  7. {
  8. public string GetIndustryBranchs()
  9. {
  10. StringBuilder sb = new StringBuilder();
  11. var lists = Get(c => c.IsLocked == "N", a => a.OrderBy(s => s.SortNo));
  12. foreach (var list in lists)
  13. {
  14. sb.Append("<option value=\"" + list.Id + "\">" + list.IndustryBranchName + "</option>");
  15. }
  16. return sb.ToString();
  17. }
  18. public string GetIndustryBranchs(string id)
  19. {
  20. StringBuilder sb = new StringBuilder();
  21. var industryBranchs = UnitOfWork.IndustryBranchUserRepository.Get(a => a.UserNo == id);
  22. List<string> industryBranchNos = new List<string>();
  23. foreach (var industryBranch in industryBranchs)
  24. industryBranchNos.Add(industryBranch.IndustryBranchNo);
  25. var lists = Get(c => c.IsLocked == "N", a => a.OrderBy(s => s.SortNo));
  26. foreach (var list in lists)
  27. {
  28. if (industryBranchNos.Contains(list.Id))
  29. sb.Append("<option value=\"" + list.Id + "\" selected=\"selected\">" + list.IndustryBranchName + "</option>");
  30. else
  31. sb.Append("<option value=\"" + list.Id + "\">" + list.IndustryBranchName + "</option>");
  32. }
  33. return sb.ToString();
  34. }
  35. }
  36. }