using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TopWinCMS.WebControls;
using TopWinCMS.BLL;
using System.Text;
namespace TopWinCMS.WebUI.Admin.Counter
{
    public partial class Counter_Month : System.Web.UI.Page
    {
        protected StringBuilder css = new StringBuilder();
        protected StringBuilder tocal = new StringBuilder();
        protected int AllCount;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RightsCheck.CheckWorkPower("Count_Read");
                Bind();
            }
        }

        private void Bind()
        {
            Dictionary<int, int> dic = new CounterDiaryManage().Month();
            GV_List.DataSource = dic;
            GV_List.DataBind();

            for (int i = 1; i < 13; i++)
            {
                AllCount += dic[i];
            }
//            for (int i = 0; i < 12; i++)
//            {
//                css.AppendFormat(@"#q{0} {{
//	left:{1}px;
//	height:{2}px;
//	background:url(c2008428195153.gif) #fff no-repeat scroll -{3}px 0;
//    }}
//", (i + 1), (10 + i * 49), height(dic,i),(scroll(i) * 34));
                
//                tocal.AppendFormat("<li id=\"q{0}\">{1}</li>\r\n", (i + 1), dic[(i + 1)]);
//            }
        }
        private int height(Dictionary<int, int> dic,int index)
        {
            int max = dic[1];
            if (max == 0) return 0;
            for (int i = 1; i < 13; i++)
            {
                if (i < 12 && dic[i] < dic[i + 1])
                {
                    max = dic[i + 1];
                }
            }
            
            return (int)(dic[index+1] * 590 / max);
             
        }
        private int scroll(int index)
        { 
            switch (index)
            {
                case 4: return 0;
                case 5: return 1;
                case 6: return 2;
                case 7: return 3;
                case 8: return 0;
                case 9: return 1;
                case 10: return 2;
                case 11: return 3;
                default: return index;
            }
          
        }
    }
}
