コード例 #1
0
        public JsonResult QueryActivityStatistics(QF_Report filter)
        {
            var list      = ReportBigService.ActivityStatisticsList(filter);
            var chartList = ReportBigService.ActivityStatisticsChart(filter);

            return(Json(new AjaxResult()
            {
                Success = true,
                Data = new
                {
                    chartList,
                    list
                }
            }));
        }
コード例 #2
0
        public ActionResult SearchExportActivityStatistics()
        {
            var filter = SerializeHelper.JsonDeserializeFixed <QF_Report>(Request.Form["queryString"]);
            var list   = ReportBigService.ActivityStatisticsList(filter);

            list.ForEach(p => { p.SerialNumber = list.IndexOf(p) + 1; });
            var tables = new List <DataTable>
            {
                DataMapper.ListToDataTable(list)
            };
            var columns = new List <List <ColumnData> >
            {
                new List <ColumnData>
                {
                    new ColumnData {
                        FieldName = "SerialNumber", Width = 10, Title = "序号", HorizontalAlignment = HorizAlignments.Centered
                    },
                    new ColumnData {
                        FieldName = "DepartmentName", Width = 20, Title = "公司名称", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "ActivityCount", Width = 10, Title = "活跃度", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastYearActivityCount", Width = 20, Title = "去年同期活跃度", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastYearActivityCountProportion", Width = 10, Title = "同比", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastMonthActivityCount", Width = 20, Title = "上月同期活跃度", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastMonthComplaintCountProportion", Width = 10, Title = "环比", HorizontalAlignment = HorizAlignments.Left
                    }
                }
            };
            var excelExport = new ExcelFileExporter();
            var fileName    = string.Empty;
            var excelByte   = excelExport.CreateFile(tables, new List <string>()
            {
                "活跃度统计"
            }, columns, null, out fileName, "活跃度统计");

            fileName = "活跃度统计.xls";
            return(File(new MemoryStream(excelByte), "application/ms-excel", fileName));
        }