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; } TaoBaoGoodsOrderService orderDal = new TaoBaoGoodsOrderService(); IList <GoodsOrderInfo> list = orderDal.GetHourOrderTotal(DateTime.Parse(date.ToShortDateString()), DateTime.Parse(date.AddDays(1).ToShortDateString()), HttpUtility.UrlDecode(Request.Cookies["nick"].Value)); SeriseText = "[{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 <GoodsOrderInfo> thisInfo = list.Where(o => o.OrderTotal == h).ToList(); if (thisInfo.Count == 0) { SeriseText += "0,"; } else { SeriseText += (int)thisInfo[0].payment + ","; } } SeriseText = SeriseText.Substring(0, SeriseText.Length - 1); SeriseText += "]}]"; DateText = DateText.Substring(0, DateText.Length - 1); DateText += "]"; TB_Start.Text = date.ToShortDateString(); HF_Date.Value = date.ToShortDateString(); }