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