예제 #1
0
        public ActionResult GetSalesChartData(int periodSelectionKind, eDashReportKinds kind)
        {
            var period = periodSelectionKind.ToPeriodSelectionKind();

            var groupping = ReportEnums.eChartGroupping.Day;

            switch (period)
            {
            case ReportEnums.ePeriodSelectionKinds.thisMonth:
            case ReportEnums.ePeriodSelectionKinds.week:
                groupping = ReportEnums.eChartGroupping.Day;
                break;

            case ReportEnums.ePeriodSelectionKinds.lastMonth:
            case ReportEnums.ePeriodSelectionKinds.last90:
                groupping = ReportEnums.eChartGroupping.Week;
                break;

            case ReportEnums.ePeriodSelectionKinds.last180:
            case ReportEnums.ePeriodSelectionKinds.all:
                groupping = ReportEnums.eChartGroupping.Month;
                break;
            }

            var list = new List <SalesAnalyticChartDTO>();

            switch (kind)
            {
            case eDashReportKinds.content:
                list = BaseAuthorServices.GetSalesChartData(CurrentUserId, period, groupping);
                break;

            case eDashReportKinds.stores:
                list = _webStoreServices.GetSalesChartData(CurrentUserId, period, groupping);
                break;
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }