EmailCategoryService.cs 2.4 KB

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