|
- using Learun.Util;
- using System;
- using System.Collections.Generic;
-
- namespace Learun.Application.IM
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
- /// Copyright (c) 2013-2018 上海力软信息技术有限公司
- /// 创建人:力软-框架开发组
- /// 日 期:2018.05.31
- /// 描 述:最近联系人列表
- /// </summary>
- public class IMContactsBLL: IMContactsIBLL
- {
- private IMContactsService iMContactsService = new IMContactsService();
-
- #region 获取数据
-
- /// <summary>
- /// 获取列表数据
- /// </summary>
- /// <param name="userId">用户Id</param>
- /// <returns></returns>
- public IEnumerable<IMContactsEntity> GetList(string userId)
- {
- try
- {
- return iMContactsService.GetList(userId);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 获取列表数据
- /// </summary>
- /// <param name="userId">用户Id</param>
- /// <param name="time">时间</param>
- /// <returns></returns>
- public IEnumerable<IMContactsEntity> GetList(string userId,DateTime time)
- {
- try
- {
- return iMContactsService.GetList(userId, time);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 获取实体
- /// </summary>
- /// <param name="userId">发送人</param>
- /// <param name="otherUserId">接收人</param>
- /// <returns></returns>
- public IMContactsEntity GetEntity(string userId, string otherUserId)
- {
- try
- {
- return iMContactsService.GetEntity(userId, otherUserId);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="entity">实体数据</param>
- /// <summary>
- /// <returns></returns>
- public void SaveEntity(IMContactsEntity entity)
- {
- try
- {
- iMContactsService.SaveEntity(entity);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 更新记录读取状态
- /// </summary>
- /// <param name="myUserId">自己本身用户ID</param>
- /// <param name="otherUserId">对方用户ID</param>
- public void UpdateState(string myUserId, string otherUserId)
- {
- try
- {
- iMContactsService.UpdateState(myUserId,otherUserId);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- /// <summary>
- /// 删除最近联系人
- /// </summary>
- /// <param name="myUserId">发起者id</param>
- /// <param name="otherUserId">对方用户ID</param>
- public void DeleteEntity(string myUserId, string otherUserId)
- {
- try
- {
- iMContactsService.DeleteEntity(myUserId, otherUserId);
- }
- catch (Exception ex)
- {
- if (ex is ExceptionEx)
- {
- throw;
- }
- else
- {
- throw ExceptionEx.ThrowBusinessException(ex);
- }
- }
- }
- #endregion
- }
- }
|