Beispiel #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));
        }
Beispiel #2
0
        public ActionResult GetAuthorSalesSummary(eDashReportKinds summaryRepKind)
        {
            decimal total30 = 0;

            switch (summaryRepKind)
            {
            case eDashReportKinds.content:
                var list1 = BaseAuthorServices.GetAuthorSales(CurrentUserId, ReportEnums.ePeriodSelectionKinds.thisMonth).ToArray();
                total30 = list1.Any() ? (int)list1.Sum(x => x.TotalAmount) : 0;
                break;

            case eDashReportKinds.stores:
                var list2 = _webStoreServices.GetOwnerStoreSales(CurrentUserId, ReportEnums.ePeriodSelectionKinds.thisMonth, null, null, null).ToArray();
                total30 = list2.Any() ? (int)list2.Sum(x => x.TotalAmount) : 0;
                break;
            }

            var response = new {
                total7 = 0
                , total30
            };

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