Ejemplo n.º 1
0
    private void ShowChart(DateTime date)
    {
        if (date.ToShortDateString() != DateTime.Now.ToShortDateString())
        {
            Btn_Totay.Visible = true;
        }
        //大于今天
        if (DateTime.Parse(date.ToShortDateString()) > DateTime.Parse(DateTime.Now.ToShortDateString()))
        {
            TB_Start.Text = HF_Date.Value;
            return;
        }
        VisitService          visitDal = new VisitService();
        IList <HourTotalInfo> list     = visitDal.GetHourZhiTongOrZuanZhanPVTotal(DataHelper.Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value)), date, true);

        IList <HourTotalInfo> zuanlist = visitDal.GetHourZhiTongOrZuanZhanPVTotal(DataHelper.Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value)), date, false);


        SeriseText = "[{name:'直通车量', data:[";
        string iptotal = ",{name:'钻展流量',data:[";

        DateText = "[";
        int nowhour = 23;

        if (date.ToShortDateString() == DateTime.Now.ToShortDateString())
        {
            nowhour = date.Hour;
        }
        for (int h = 0; h <= nowhour; h++)
        {
            DateText += "'" + h + "',";
            IList <HourTotalInfo> thisInfo     = list.Where(o => o.Hour == h).ToList();
            IList <HourTotalInfo> thiszuanInfo = zuanlist.Where(o => o.Hour == h).ToList();

            if (thisInfo.Count == 0)
            {
                SeriseText += "0,";
            }
            else
            {
                SeriseText += thisInfo[0].PVCount + ",";
            }

            if (thiszuanInfo.Count == 0)
            {
                iptotal += "0,";
            }
            else
            {
                iptotal += thiszuanInfo[0].PVCount + ",";
            }
        }
        SeriseText = SeriseText.Substring(0, SeriseText.Length - 1) + "]}";
        iptotal    = iptotal.Substring(0, iptotal.Length - 1) + "]}";
        SeriseText = SeriseText + iptotal + "]";

        DateText      = DateText.Substring(0, DateText.Length - 1);
        DateText     += "]";
        TB_Start.Text = date.ToShortDateString();
        HF_Date.Value = date.ToShortDateString();
    }