using System;

using BrnShop.Core;

namespace BrnShop.Services
{
    /// <summary>
    /// 异步操作管理类
    /// </summary>
    public class Asyn
    {
        /// <summary>
        /// 更新在线用户
        /// </summary>
        public static void UpdateOnlineUser(int uid, string sid, string nickName, string ip, int regionId)
        {
            BSPAsyn.AsynInstance.UpdateOnlineUser(new UpdateOnlineUserState(uid, sid, nickName, ip, regionId, DateTime.Now));
        }

        /// <summary>
        /// 更新浏览历史
        /// </summary>
        public static void UpdateBrowseHistory(int uid, int pid)
        {
            BSPAsyn.AsynInstance.UpdateBrowseHistory(new UpdateBrowseHistoryState(uid, pid, DateTime.Now));
        }

        /// <summary>
        /// 更新搜索历史
        /// </summary>
        public static void UpdateSearchHistory(int uid, string word)
        {
            BSPAsyn.AsynInstance.UpdateSearchHistory(new UpdateSearchHistoryState(uid, word, DateTime.Now));
        }

        /// <summary>
        /// 更新商品统计
        /// </summary>
        public static void UpdateProductStat(int pid, int regionId)
        {
            BSPAsyn.AsynInstance.UpdateProductStat(new UpdateProductStatState(pid, regionId, DateTime.Now));
        }

        /// <summary>
        /// 更新PV统计
        /// </summary>
        public static void UpdatePVStat(int uid, int regionId, string browser, string os)
        {
            BSPAsyn.AsynInstance.UpdatePVStat(new UpdatePVStatState(uid > 0, regionId, browser, os));
        }
    }
}