private void ShowChart(DateTime start, DateTime end) { //两个时间差 if (start > end) { Page.RegisterStartupScript("error", "<script>alert('时间选择有误!');</script>"); return; } SiteTotalService stDal = new SiteTotalService(); IList <TopSiteTotalInfo> list = stDal.GetNickOrderTotal(start, end, HttpUtility.UrlDecode(Request.Cookies["nick"].Value)); SeriseText = "[{name:'订单量', data:["; string orderPay = ",{name:'订单金额',data:["; string cusPay = ",{name:'每单均价',data:["; DateText = "["; for (DateTime i = start; i <= end; i = i.AddDays(1)) { DateText += "'" + i.ToString("yyyyMMdd").Substring(6, 2) + "',"; IList <TopSiteTotalInfo> mylist = list.Where(o => o.SiteTotalDate == i.ToString("yyyyMMdd")).ToList(); if (mylist.Count > 0) { SeriseText += mylist[0].SiteOrderCount + ","; orderPay += mylist[0].SiteOrderPay + ","; if (mylist[0].SiteOrderCount == 0) { cusPay += "0,"; } else { cusPay += ((double)mylist[0].SiteOrderPay / mylist[0].SiteOrderCount).ToString(".00") + ","; } } else { orderPay += "0,"; SeriseText += "0,"; cusPay += "0,"; } } SeriseText = SeriseText.Substring(0, SeriseText.Length - 1); SeriseText += "]}"; orderPay = orderPay.Substring(0, orderPay.Length - 1); orderPay += "]}"; cusPay = orderPay + cusPay.Substring(0, cusPay.Length - 1); SeriseText += cusPay + "]}]"; DateText = DateText.Substring(0, DateText.Length - 1); DateText += "]"; TB_Start.Text = start.ToShortDateString(); TB_End.Text = end.ToShortDateString(); }
private void ShowChart(DateTime start, DateTime end) { //两个时间差 if (start > end) { Page.RegisterStartupScript("error", "<script>alert('时间选择有误!');</script>"); return; } SiteTotalService stDal = new SiteTotalService(); IList <TopSiteTotalInfo> list = stDal.GetNickOrderTotal(start, end, HttpUtility.UrlDecode(Request.Cookies["nick"].Value)); SeriseText = "[{name:'PV量', data:["; string uvtotal = ",{name:'UV量',data:["; string backtotal = ",{name:'浏览回头客',data:["; DateText = "["; for (DateTime i = start; i <= end; i = i.AddDays(1)) { DateText += "'" + i.ToString("yyyyMMdd").Substring(6, 2) + "',"; IList <TopSiteTotalInfo> mylist = list.Where(o => o.SiteTotalDate == i.ToString("yyyyMMdd")).ToList(); if (mylist.Count > 0) { SeriseText += mylist[0].SitePVCount + ","; uvtotal += mylist[0].SiteUVCount + ","; backtotal += mylist[0].SiteUVBack + ","; } else { uvtotal += "0,"; SeriseText += "0,"; backtotal += "0,"; } } SeriseText = SeriseText.Substring(0, SeriseText.Length - 1); SeriseText += "]}"; uvtotal = uvtotal.Substring(0, uvtotal.Length - 1); uvtotal += "]}"; backtotal = uvtotal + backtotal.Substring(0, backtotal.Length - 1); SeriseText += backtotal + "]}]"; DateText = DateText.Substring(0, DateText.Length - 1); DateText += "]"; TB_Start.Text = start.ToShortDateString(); TB_End.Text = end.ToShortDateString(); }