You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

166 lines
4.6 KiB

  1. using Learun.Util;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace Learun.Application.IM
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
  8. /// Copyright (c) 2013-2018 上海力软信息技术有限公司
  9. /// 创建人:力软-框架开发组
  10. /// 日 期:2018.05.31
  11. /// 描 述:最近联系人列表
  12. /// </summary>
  13. public class IMContactsBLL: IMContactsIBLL
  14. {
  15. private IMContactsService iMContactsService = new IMContactsService();
  16. #region 获取数据
  17. /// <summary>
  18. /// 获取列表数据
  19. /// </summary>
  20. /// <param name="userId">用户Id</param>
  21. /// <returns></returns>
  22. public IEnumerable<IMContactsEntity> GetList(string userId)
  23. {
  24. try
  25. {
  26. return iMContactsService.GetList(userId);
  27. }
  28. catch (Exception ex)
  29. {
  30. if (ex is ExceptionEx)
  31. {
  32. throw;
  33. }
  34. else
  35. {
  36. throw ExceptionEx.ThrowBusinessException(ex);
  37. }
  38. }
  39. }
  40. /// <summary>
  41. /// 获取列表数据
  42. /// </summary>
  43. /// <param name="userId">用户Id</param>
  44. /// <param name="time">时间</param>
  45. /// <returns></returns>
  46. public IEnumerable<IMContactsEntity> GetList(string userId,DateTime time)
  47. {
  48. try
  49. {
  50. return iMContactsService.GetList(userId, time);
  51. }
  52. catch (Exception ex)
  53. {
  54. if (ex is ExceptionEx)
  55. {
  56. throw;
  57. }
  58. else
  59. {
  60. throw ExceptionEx.ThrowBusinessException(ex);
  61. }
  62. }
  63. }
  64. /// <summary>
  65. /// 获取实体
  66. /// </summary>
  67. /// <param name="userId">发送人</param>
  68. /// <param name="otherUserId">接收人</param>
  69. /// <returns></returns>
  70. public IMContactsEntity GetEntity(string userId, string otherUserId)
  71. {
  72. try
  73. {
  74. return iMContactsService.GetEntity(userId, otherUserId);
  75. }
  76. catch (Exception ex)
  77. {
  78. if (ex is ExceptionEx)
  79. {
  80. throw;
  81. }
  82. else
  83. {
  84. throw ExceptionEx.ThrowBusinessException(ex);
  85. }
  86. }
  87. }
  88. #endregion
  89. #region 提交数据
  90. /// <summary>
  91. /// 保存实体数据(新增、修改)
  92. /// <param name="entity">实体数据</param>
  93. /// <summary>
  94. /// <returns></returns>
  95. public void SaveEntity(IMContactsEntity entity)
  96. {
  97. try
  98. {
  99. iMContactsService.SaveEntity(entity);
  100. }
  101. catch (Exception ex)
  102. {
  103. if (ex is ExceptionEx)
  104. {
  105. throw;
  106. }
  107. else
  108. {
  109. throw ExceptionEx.ThrowBusinessException(ex);
  110. }
  111. }
  112. }
  113. /// <summary>
  114. /// 更新记录读取状态
  115. /// </summary>
  116. /// <param name="myUserId">自己本身用户ID</param>
  117. /// <param name="otherUserId">对方用户ID</param>
  118. public void UpdateState(string myUserId, string otherUserId)
  119. {
  120. try
  121. {
  122. iMContactsService.UpdateState(myUserId,otherUserId);
  123. }
  124. catch (Exception ex)
  125. {
  126. if (ex is ExceptionEx)
  127. {
  128. throw;
  129. }
  130. else
  131. {
  132. throw ExceptionEx.ThrowBusinessException(ex);
  133. }
  134. }
  135. }
  136. /// <summary>
  137. /// 删除最近联系人
  138. /// </summary>
  139. /// <param name="myUserId">发起者id</param>
  140. /// <param name="otherUserId">对方用户ID</param>
  141. public void DeleteEntity(string myUserId, string otherUserId)
  142. {
  143. try
  144. {
  145. iMContactsService.DeleteEntity(myUserId, otherUserId);
  146. }
  147. catch (Exception ex)
  148. {
  149. if (ex is ExceptionEx)
  150. {
  151. throw;
  152. }
  153. else
  154. {
  155. throw ExceptionEx.ThrowBusinessException(ex);
  156. }
  157. }
  158. }
  159. #endregion
  160. }
  161. }