PublishDAL.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.TeachingMaterial;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.Common.TeachingMaterial
  10. {
  11. public class PublishDAL
  12. {
  13. public PublishRepository PublishRepository { get; set; }
  14. /// <summary>
  15. /// 获取出版单位信息列表
  16. /// </summary>
  17. /// <param name="exp"></param>
  18. /// <returns></returns>
  19. public IQueryable<PublisherView> GetPulishGridView(Expression<Func<CF_Publish, bool>> exp)
  20. {
  21. var view = PublishRepository.GetList(exp).Select(x => new PublisherView
  22. {
  23. PublishID = x.PublishID,
  24. Email = x.Email,
  25. Address = x.Address,
  26. BandCard = x.BandCard,
  27. BandName = x.BandName,
  28. ContectUser = x.ContectUser,
  29. Ein = x.Ein,
  30. Desc = x.Desc,
  31. Fax = x.Fax,
  32. IsPrint = x.IsPrint.Value,
  33. IsPrintName = x.IsPrint.Value == true ? "是" : "否",
  34. IsPulish = x.IsPulish.Value,
  35. IsPulishName = x.IsPulish.Value ==true ? "是" : "否",
  36. IsSupplier = x.IsSupplier.Value,
  37. IsSupplierName = x.IsSupplier.Value == true ? "是" : "否",
  38. Mobile = x.Mobile,
  39. Phone = x.Phone,
  40. UnitCode = x.UnitCode,
  41. UnitName = x.UnitName,
  42. UnitShortName = x.UnitShortName
  43. });
  44. return view;
  45. }
  46. /// <summary>
  47. /// 获取出版单位单位
  48. /// </summary>
  49. /// <returns></returns>
  50. public PublisherView GetSinglePublish(Guid publishID)
  51. {
  52. var publish = PublishRepository.GetSingle(x => x.PublishID == publishID);
  53. var publishView = new PublisherView()
  54. {
  55. PublishID = publish.PublishID,
  56. Ein = publish.Ein,
  57. Desc = publish.Desc,
  58. Phone = publish.Phone,
  59. Mobile = publish.Mobile,
  60. UnitName = publish.UnitName,
  61. UnitCode = publish.UnitCode,
  62. UnitShortName = publish.UnitShortName,
  63. IsPrint = publish.IsPrint.GetValueOrDefault(),
  64. IsPulish = publish.IsPulish.GetValueOrDefault(),
  65. IsSupplier = publish.IsSupplier.GetValueOrDefault(),
  66. Address = publish.Address,
  67. BandCard = publish.BandCard,
  68. BandName = publish.BandName,
  69. ContectUser = publish.ContectUser,
  70. Email = publish.Email,
  71. Fax = publish.Fax
  72. };
  73. return publishView;
  74. }
  75. }
  76. }