コード例 #1
0
        public ActionResult MemberListOnPage(StatisticalView model)
        {
            var result = new DataTableJsonResult();
            List <StatisticalReports> statisticalReports = new List <StatisticalReports>();


            int    draw, pageIndex = 1, pageSize = 10000, totalCount = 1;
            string sortColumn;
            bool   isDesc;

            Request.GetDatatableParameters(out draw, out pageIndex, out pageSize, out sortColumn, out isDesc);
            result.draw = draw;

            //取查询条件
            var year = Request.Get("extra_search[Year]");

            var statisticalway    = Request.Get("extra_search[Statisticalway]");
            var statisticalwayint = statisticalway.To <int>();

            var      startTime           = Request.Get("extra_search[StartTime]");
            DateTime?createTimestartTime = null;

            if (startTime != "")
            {
                createTimestartTime = startTime.To <DateTime>().DayZero();
            }

            var      endTime           = Request.Get("extra_search[EndTime]");
            DateTime?createTimeendTime = null;

            if (endTime != "")
            {
                createTimeendTime = endTime.To <DateTime>().DayEnd();
            }

            switch (statisticalwayint)
            {
            case 1:    //年
            {
                statisticalReports = _statisticalService.YearStatisticalReportsMember();
            }
            break;

            case 2:    //月
            {
                statisticalReports = _statisticalService.MonthStatisticalReportsMember(year);
            }
            break;

            case 3:    //区间
            {
                var statistical = _statisticalService.StatisticalReportsMember(createTimestartTime, createTimeendTime);
                statisticalReports.Add(statistical);
            }
            break;

            default:
                break;
            }
            result.data            = statisticalReports;
            result.recordsTotal    = totalCount;
            result.recordsFiltered = totalCount;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }