Example #1
0
    protected string RenderJGData()
    {
        var result = new StringBuilder();
        Dictionary <DateTime, decimal> sums    = OrderStatisticsService.GetOrdersSumByPeriod(minDate, maxDate);
        Dictionary <DateTime, decimal> profits = OrderStatisticsService.GetOrdersProfitByPeriod(minDate, maxDate);

        if (sums == null)
        {
            return("");
        }
        string[] monthsArr = Resources.Resource.Admin_Charts_Months.Split(',');
        for (var i = new DateTime(minDate.AddMonths(1).Year, minDate.AddMonths(1).Month, 1); i < maxDate;)
        {
            decimal sum    = 0;
            decimal profit = 0;
            if (sums.ContainsKey(i))
            {
                sum = sums[i];
            }
            if (profits.ContainsKey(i))
            {
                profit = profits[i];
            }
            result.AppendFormat("[{0}, {1}, {2}],", monthsArr[i.Month - 1], sum.ToString(System.Globalization.CultureInfo.InvariantCulture), profit.ToString(System.Globalization.CultureInfo.InvariantCulture));
            i = i.AddMonths(1);
        }
        result.Remove(result.ToString().LastIndexOf(','), 1);
        return(result.ToString());
    }
Example #2
0
    protected string RenderJGData()
    {
        var result = new StringBuilder();
        Dictionary <DateTime, decimal> data = OrderStatisticsService.GetOrdersSumByPeriod(minDate, maxDate);

        if (data == null)
        {
            return("");
        }
        string[] monthsArr = Resources.Resource.Admin_Charts_Months.Split(',');
        for (var i = new DateTime(minDate.AddMonths(1).Year, minDate.AddMonths(1).Month, 1); i < maxDate;)
        {
            result.AppendFormat("[{0}, {1}],", monthsArr[i.Month - 1], data.ContainsKey(i) ? data[i] : 0);
            i = i.AddMonths(1);
        }
        result.Remove(result.ToString().LastIndexOf(','), 1);
        return(result.ToString());
    }