protected string RenderJGData() { var result = new StringBuilder(); Dictionary <DateTime, decimal> sums = OrderStatisticsService.GetOrdersSumByDays(minDate, maxDate); Dictionary <DateTime, decimal> profits = OrderStatisticsService.GetOrdersProfitByDays(minDate, maxDate); if (sums == null) { return(""); } string[] monthsArr = Resources.Resource.Admin_Charts_Months.Split(','); for (DateTime i = minDate.Date; 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}],", i.Date.ToString("dd.MM"), sum.ToString(System.Globalization.CultureInfo.InvariantCulture), profit.ToString(System.Globalization.CultureInfo.InvariantCulture)); i = i.AddDays(1); } result.Remove(result.ToString().LastIndexOf(','), 1); return(result.ToString()); }
protected string RenderDataByMonths(DateTime date) { var listProfit = OrderStatisticsService.GetOrdersProfitByDays(date, Now); var listSum = OrderStatisticsService.GetOrdersSumByDays(date, Now); return(String.Format("[{{label: '{0}', data:[{1}]}}, {{label: '{2}', data:[{3}]}}]", Resource.Admin_Chart_Profit, GetByMonths(listProfit, date, Now), Resource.Admin_Default_Orders, GetByMonths(listSum, date, Now))); }