using System.Collections.Generic;

namespace Stat.Html
{
   public class HourList
    {
        /// <summary>
        /// 小时数据列表（HTML）
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static string Get(List<Model.ViewDay> list)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (list != null && list.Count > 0)
            {
                sb.Append(" <table bgcolor=\"#cedfef\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\" class=\"padding\">");
                sb.Append(" <tr>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"14%\" align=\"center\"  height=\"25\">&nbsp;<strong>小 时 段</strong></td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>PV</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>IP</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>独立访客</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>新访客</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>访问次数</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>回访次数</strong>&nbsp;</td>");
                sb.Append("   <td bgcolor=\"#e9f1fa\" width=\"10%\" align=\"right\" ><strong>人均PV</strong>&nbsp;</td>");
                sb.Append("    <td bgcolor=\"#e9f1fa\" width=\"*\" align=\"left\"  >&nbsp;<strong>PV比例</strong></td>");
                sb.Append("  </tr>");
                /*--------------------------------------------------------*/
                for (int i = 0; i < list.Count; i++) 
                {
                    sb.Append("<tr bgcolor=\"#FFFFFF\" onmouseover=\"this.style.backgroundColor='#EEF3F9';\" onmouseout=\"this.style.backgroundColor='#FFFFFF';\">");
                    sb.Append(" <td align=\"center\" height=23>" + i + "：00- -" + (i + 1).ToString() + "：00</td>");
                    sb.Append(" <td align=\"right\" height=20><span class=\"red14\">" + list[i].pvCount + "</span></td>");
                    sb.Append(" <td align=\"right\" height=20><span class=\"red14\">" + list[i].ipCount + "</span></td>");
                    sb.Append(" <td align=\"right\" height=20><span class=\"red14\">" + list[i].cusCount + "</span></td>");
                    sb.Append(" <td align=\"right\" height=20>" + list[i].newCount + "</td>");
                    sb.Append(" <td align=\"right\">" + list[i].timCount + "</td>");
                    sb.Append(" <td align=\"right\">" + list[i].otimCount + "</td>");
                    sb.Append(" <td align=\"right\" height=20>" + list[i].AVG.ToString("0.0") + "</td>");
                    sb.Append(" <td align=\"left\" height=20><img src=\"Images/bar4.gif\" height=\"10\" width=\"" + list[i].Percent.ToString("0") + "\" />" + list[i].Percent.ToString("0.00") + "%</td>");
                    sb.Append("</tr>");
                }
                /*--------------------------------------------------------*/
                sb.Append("</table>");
            }
            return sb.ToString();
        }
    }
}
