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

namespace Stat.SQLServerDAL
{
    class ViewIP : IDAL.IViewIP
    {
        #region ViewIP 成员

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns>Juju 2011-10-27</returns>
        [Obsolete("The mothe is obsolete,will be remove")]
        public List<Stat.Model.StatItem> GetList(Stat.Model.StatInfo model)
        {
            model.TableName = "ViewIP";
            model.Cells = "IP,pvCount,ipCount,uvCount,nuvCount,timCount,otimCount,vYear,vMonth,vDay";
            return StatItem.GetList(Common.GetViewItemData(model), "IP", 1);
        }
        #endregion



        #region IViewOnClick 成员 ：IP 数据

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List<Stat.Model.ViewItem_String> GetItem(Stat.Model.StatInfo model)
        {
            model.TableName = "View_" + model.StartTime.Year + "_" + model.StartTime.Month + "_" + model.StartTime.Day;
            model.Cells = "top 5000 [id],IP,Mac,View_Alone";
            SqlParameter[] parms = ViewItemParmeters.SetSqlParmeter(model);
            DataTable dt = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionStringGather(model.GatherID), CommandType.StoredProcedure, "Stat_ViewClickLoadByWebid", parms);

            return ViewItems.GetString.GetList(dt, "IP");
        }

        #endregion
    }
}
