//by JuSNS v1.0系列
//官方站：www.juSNS.com，演示站:www.ju001.com，www.julala.cn
//QQ:655071(技术)，QQ:9170617（客服）
//MSN:simplt@163.com EMail:simplt@163.com
//program design by Simplt.Xie，arjun
//========================================
using System;
using System.Collections.Generic;
using System.Text;
using JuSNS.Factory;
using JuSNS.Model;

namespace JuSNS.Home
{
    public class OnlineUser
    {
        private IOnlineUser dal;
        public OnlineUser()
        {
            dal = DataAccess.CreateOnlineUser();
        }
        /// <summary>
        /// 是否在线
        /// </summary>
        /// <param name="userid">用户ID</param>
        /// <returns></returns>
        public bool IsOnline(int userid)
        {
            return dal.IsOnline(userid);
        }
        /// <summary>
        /// 取得登陆信息
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public OnlineUserInfo getInfo(int userid)
        {
            return dal.getInfo(userid);
        }
        /// <summary>
        /// 取得登陆信息
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="isuserid"></param>
        /// <returns></returns>
        public OnlineUserInfo getInfo(int UserID, bool isuserid)
        {
            return dal.getInfo(UserID, isuserid);
        }

        /// <summary>
        /// 添加在线用户
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int Add(OnlineUserInfo info)
        {
            return dal.Add(info);
        }
        /// <summary>
        /// 更新在线用户
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int Update(OnlineUserInfo info)
        {
            return dal.Update(info);
        }
        /// <summary>
        /// 删除在线用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Delete(int id)
        {
            return dal.Delete(id);
        }        
        /// <summary>
        /// 删除在线用户
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="isuserid"></param>
        /// <returns></returns>
        public int Delete(int userid,bool isuserid)
        {
            return dal.Delete(userid,isuserid);
        }
        /// <summary>
        /// 取得在线人数
        /// </summary>
        /// <returns></returns>
        public int Count()
        {
            return dal.Count();
        }
        /// <summary>
        /// 检查在线
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="lastip"></param>
        /// <returns></returns>
        public bool CheckOnline(int userid, string lastip)
        {
            return dal.CheckOnline(userid, lastip);
        }
        /// <summary>
        /// 删除过期用户
        /// </summary>
        public void DeleteExpires()
        {
            dal.DeleteExpires();
        }
        /// <summary>
        /// 在线列表
        /// </summary>
        /// <returns></returns>
        List<OnlineUserInfo> OnlineList()
        {
            return dal.OnlineList();
        }
    }
}
