using System;
using System.Collections.Generic;
using System.Web;
namespace Stat.BLL
{
    /// <summary>
    /// 
    /// </summary>
    [System.Obsolete("The class is obsolete,will be remove")]
    public class ViewKeyword
    {
        static Stat.IDAL.IViewEngine dal = Stat.DALFactory.AbstractFactory.GetInstance().CreateViewEngine();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Obsolete("The method is obsolete will be remove", true)]
        public static IList<Model.StatItem> Get(Model.StatInfo model)
        {
            string cName = "V_Keyword_" + model.WebID + "_" + model.StartTime + "_" + model.EndTime;
            if (HttpContext.Current.Cache.Get(cName) == null)
            {

                List<Model.StatItem> list = dal.GetList(model);
                //
                if (list == null || list.Count < 1)
                {
                    model.EndTime = model.StartTime.AddDays(1);
                    //详细数据
                    list = Report.Rp_ViewKeyword.SingleDay(BLL.ViewEngine.GetItem(model));
                }
                else
                {
                    //多日
                    list = Report.Rp_ViewKeyword.MultiDay(list);
                }
                //
                HttpContext.Current.Cache.Insert(cName, list, null, DateTime.MaxValue, TimeSpan.FromSeconds(10.0), System.Web.Caching.CacheItemPriority.Low, null);
                return list;
            }
            return (List<Model.StatItem>)HttpContext.Current.Cache.Get(cName);//从缓存中读取
        }

    }
}

