using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Stat.DBUtility;
using Stat.SQLServerDAL.CommonParmeters;

namespace Stat.SQLServerDAL
{
    class ViewAlexa : IDAL.IViewAlexa
    {
        #region IViewAlexa 成员

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns>Juju 2011-10-27</returns>
        public List<Model.StatItem> GetList(Stat.Model.StatInfo model)
        {
            model.TableName = "ViewAlexa";
            model.Cells = "IsAlexa,pvCount,ipCount,uvCount,nuvCount,timCount,otimCount,vYear,vMonth,vDay";
            return StatItem.GetList(Common.GetViewItemData(model), "IsAlexa", 0);
        }

        #endregion


        #region IViewOnClick 成员 ：Alexa


        /// <summary>
        /// 获取某天的详细记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// <remarks>By Juju 2011-09-17</remarks>
        public List<Model.ViewItem_Int> GetItem(global::Stat.Model.StatInfo model)
        {
            model.TableName = "View_" + model.StartTime.Year + "_" + model.StartTime.Month + "_" + model.StartTime.Day;
            model.Cells = "top 30000 id,IsAlexa,ip,mac,View_Alone";
            SqlParameter[] parms = ViewItemParmeters.SetSqlParmeter(model);
            DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionStringGather(model.GatherID), CommandType.StoredProcedure, "Stat_ViewClickLoadByWebid", parms);
            return ViewItems.GetInt.GetList(dt, "IsAlexa");
        }
        #endregion
    }
}
