protected void Page_Load(object sender, EventArgs e)
        {
            string date = RequestHelper.GetQueryString <string>("Date");

            year  = Convert.ToInt32(date.Split('|')[0]);
            month = Convert.ToInt32(date.Split('|')[1]);
            OrderSearchInfo orderSearch = new OrderSearchInfo();
            DateType        dateType    = DateType.Day;

            if (month == int.MinValue)
            {
                dateType = DateType.Month;
                orderSearch.StartAddDate = Convert.ToDateTime(year + "-01-01");
                orderSearch.EndAddDate   = Convert.ToDateTime(year + "-01-01").AddYears(1);
            }
            else
            {
                days = ShopCommon.CountMonthDays(year, month);
                orderSearch.StartAddDate = Convert.ToDateTime(year + "-" + month + "-01");
                orderSearch.EndAddDate   = Convert.ToDateTime(year + "-" + month + "-01").AddMonths(1);
            }
            DataTable dt = OrderBLL.StatisticsSaleTotal(orderSearch, dateType);

            foreach (DataRow dr in dt.Rows)
            {
                orderCountDic.Add(Convert.ToInt32(dr[0]), Convert.ToInt32(dr[1]));
                orderMoneyDic.Add(Convert.ToInt32(dr[0]), Convert.ToDecimal(dr[2]));
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string queryString = RequestHelper.GetQueryString <string>("Date");

            this.year  = Convert.ToInt32(queryString.Split(new char[] { '|' })[0]);
            this.month = Convert.ToInt32(queryString.Split(new char[] { '|' })[1]);
            OrderSearchInfo orderSearch = new OrderSearchInfo();
            DateType        day         = DateType.Day;

            if (this.month == -2147483648)
            {
                day = DateType.Month;
                orderSearch.StartAddDate = Convert.ToDateTime(this.year + "-01-01");
                orderSearch.EndAddDate   = Convert.ToDateTime(this.year + "-01-01").AddYears(1);
            }
            else
            {
                this.days = ShopCommon.CountMonthDays(this.year, this.month);
                orderSearch.StartAddDate = Convert.ToDateTime(string.Concat(new object[] { this.year, "-", this.month, "-01" }));
                orderSearch.EndAddDate   = Convert.ToDateTime(string.Concat(new object[] { this.year, "-", this.month, "-01" })).AddMonths(1);
            }
            DataTable table = OrderBLL.StatisticsOrderCount(orderSearch, day);

            foreach (DataRow row in table.Rows)
            {
                this.orderCountDic.Add(Convert.ToInt32(row[0]), Convert.ToInt32(row[1]));
            }
        }
示例#3
0
        protected void SaleTotalData(string date, ref DataTable dt)
        {
            int             days        = 0;
            int             year        = Convert.ToInt32(date.Split('|')[0]);
            int             month       = Convert.ToInt32(date.Split('|')[1]);
            OrderSearchInfo orderSearch = new OrderSearchInfo();
            DateType        dateType    = DateType.Day;

            if (month == int.MinValue)
            {
                dateType = DateType.Month;
                orderSearch.StartAddDate = Convert.ToDateTime(year + "-01-01");
                orderSearch.EndAddDate   = Convert.ToDateTime(year + "-01-01").AddYears(1);
            }
            else
            {
                days = ShopCommon.CountMonthDays(year, month);
                orderSearch.StartAddDate = Convert.ToDateTime(year + "-" + month + "-01");
                orderSearch.EndAddDate   = Convert.ToDateTime(year + "-" + month + "-01").AddMonths(1);
            }
            dt = OrderBLL.StatisticsSaleTotal(orderSearch, dateType);


            string jsonStr  = "[";
            string countStr = string.Empty;
            string moneyStr = string.Empty;

            if (month == int.MinValue)
            {
                for (int i = 1; i <= 12; i++)
                {
                    int countNum = 0;
                    int moneyNum = 0;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (Convert.ToInt32(dr[0]) == i)
                        {
                            countNum = Convert.ToInt32(dr[1]);
                            moneyNum = Convert.ToInt32(dr[2]);
                        }
                    }
                    countStr += countNum + ",";
                    moneyStr += moneyNum + ",";
                }
            }
            else
            {
                for (int i = 1; i <= days; i++)
                {
                    int countNum = 0;
                    int moneyNum = 0;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (Convert.ToInt32(dr[0]) == i)
                        {
                            countNum = Convert.ToInt32(dr[1]);
                            moneyNum = Convert.ToInt32(dr[2]);
                        }
                    }
                    countStr += countNum + ",";
                    moneyStr += moneyNum + ",";
                }
            }
            countStr = countStr.Substring(0, countStr.Length - 1);
            countStr = "{name:'订单量',type:'line',data:[" + countStr + "]}";
            moneyStr = moneyStr.Substring(0, moneyStr.Length - 1);
            moneyStr = "{name:'销售额',type:'line',data:[" + moneyStr + "]}";
            jsonStr  = countStr + "," + moneyStr + "]";
        }