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

namespace Stat.SQLServerDAL
{
    class ViewEnter : IDAL.IViewEnter
    {
        #region IViewOnClick 成员 ：网站入口

        public List<Model.ViewItem_String> GetItem(global::Stat.Model.StatInfo model)
        {
            model.TableName = "View_" + model.StartTime.Year + "_" + model.StartTime.Month + "_" + model.StartTime.Day;
            model.Cells = "[id],[UrlPage],IP,Mac,ViewTime,View_Alone";
            return ViewItems.GetString.GetList(Get(model), "UrlPage");

        }
        #endregion


        #region IViewEnter 成员
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns>Juju 2011-10-27</returns>
        public List<Stat.Model.StatItem> GetList(Stat.Model.StatInfo model)
        {
            model.TableName = "ViewEnter";
            model.Cells = "UrlPage,pvCount,ipCount,uvCount,nuvCount,timCount,otimCount,vYear,vMonth,vDay";
            return StatItem.GetList(Common.GetViewItemData(model), "UrlPage", 1);
        }

        #endregion

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <param name="Cells"></param>
        /// <returns></returns>
        private DataTable Get(Stat.Model.StatInfo model)
        {
            SqlParameter[] parms = ViewItemParmeters.SetSqlParmeter(model);
            return SqlHelper.ExecuteDataTable(SqlHelper.ConnectionStringGather(model.GatherID), CommandType.StoredProcedure, "Stat_ViewClickLoadEnterByWebid", parms);
        }
    }
}
