WeChatAppService.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using LeaRun.Application.Entity;
  2. using LeaRun.Application.Entity.WeChatManage;
  3. using LeaRun.Application.IService;
  4. using LeaRun.Application.IService.WeChatManage;
  5. using LeaRun.Data.Repository;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. namespace LeaRun.Application.Service.WeChatManage
  9. {
  10. /// <summary>
  11. /// 版 本 6.1
  12. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  13. /// 创建人:佘赐雄
  14. /// 日 期:2015.12.23 11:31
  15. /// 描 述:企业号应用
  16. /// </summary>
  17. public class WeChatAppService : RepositoryFactory<WeChatAppEntity>, IWeChatAppService
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 应用列表
  22. /// </summary>
  23. /// <returns></returns>
  24. public IEnumerable<WeChatAppEntity> GetList()
  25. {
  26. return this.BaseRepository().IQueryable().OrderBy(t => t.CreateDate).ToList();
  27. }
  28. /// <summary>
  29. /// 应用实体
  30. /// </summary>
  31. /// <param name="keyValue">主键值</param>
  32. /// <returns></returns>
  33. public WeChatAppEntity GetEntity(string keyValue)
  34. {
  35. return this.BaseRepository().FindEntity(keyValue);
  36. }
  37. #endregion
  38. #region 提交数据
  39. /// <summary>
  40. /// 删除应用
  41. /// </summary>
  42. /// <param name="keyValue">主键</param>
  43. public void RemoveForm(string keyValue)
  44. {
  45. this.BaseRepository().Delete(keyValue);
  46. }
  47. /// <summary>
  48. /// 应用(新增、修改)
  49. /// </summary>
  50. /// <param name="keyValue">主键值</param>
  51. /// <param name="weChatAppEntity">应用实体</param>
  52. /// <returns></returns>
  53. public void SaveForm(string keyValue, WeChatAppEntity weChatAppEntity)
  54. {
  55. if (!string.IsNullOrEmpty(keyValue))
  56. {
  57. weChatAppEntity.Modify(keyValue);
  58. this.BaseRepository().Update(weChatAppEntity);
  59. }
  60. else
  61. {
  62. weChatAppEntity.Create();
  63. this.BaseRepository().Insert(weChatAppEntity);
  64. }
  65. }
  66. #endregion
  67. }
  68. }