public ActionResult PivotGridPartial()
        {
            var model = new BusinessIntelligenceModel
            {
                PivotGridData     = Session["PivotGridData"] as IEnumerable <object>,
                PivotGridSettings = Session["PivotGridSettings"] as PivotGridSettings
            };

            return(PartialView("_PivotGridPartial", model));
        }
        public ActionResult SalesByEmployeeByDivision(BusinessIntelligenceModel model)
        {
            var service = new ReportSalesService();

            Session["PivotGridData"] = service.GetSalesByEmployeeByDivision(model.DateStart, model.DateEnd);

            if (Request.Params["ExportTo"] == null)
            {
                return(View(model));
            }

            model.PivotGridData     = (IEnumerable <object>)Session["PivotGridData"];
            model.PivotGridSettings = Session["PivotGridSettings"] as PivotGridSettings;

            return(PivotGridDataExportHelper.ExportActionResult(model.PivotGridExportOptions, model));
        }
        public ActionResult SalesByEmployeeByDivision()
        {
            var model = new BusinessIntelligenceModel();

            var lastMonthDate = DateTime.Today.AddMonths(-1);
            var dateStart     = new DateTime(lastMonthDate.Year, lastMonthDate.Month, 1);
            var dateEnd       = dateStart.AddMonths(1).AddDays(-1);

            model.DateStart = dateStart;
            model.DateEnd   = dateEnd;


            var service = new ReportSalesService();

            Session["PivotGridData"]     = service.GetSalesByEmployeeByDivision(dateStart, dateEnd);
            Session["PivotGridSettings"] = BusinessIntelligenceSettings.SalesByEmployeeByDivisionSettings();

            return(View(model));
        }
Esempio n. 4
0
        public static ActionResult ExportActionResult(PivotGridExportOptionsModel optionsModel, BusinessIntelligenceModel model)
        {
            if (exportTypes == null)
            {
                exportTypes = CreateExportTypes();
            }

            var format = optionsModel.ExportFormat;

            switch (format)
            {
            //case ExportFormats.Excel:
            //    return exportTypes[format].ExcelMethod(model.PivotGridSettings, model.BindData, new XlsxExportOptionsEx() { ExportType = ExportType.WYSIWYG });

            case ExportFormats.Excel:
                XlsxExportOptionsEx exportOptions = new XlsxExportOptionsEx()
                {
                    ExportType = ExportType.DataAware
                };
                exportOptions.AllowFixedColumnHeaderPanel = exportOptions.AllowFixedColumns = optionsModel.DataAwareOptions.AllowFixedColumnAndRowArea ? DefaultBoolean.True : DefaultBoolean.False;
                exportOptions.AllowGrouping  = optionsModel.DataAwareOptions.AllowGrouping ? DefaultBoolean.True : DefaultBoolean.False;
                exportOptions.RawDataMode    = optionsModel.DataAwareOptions.ExportRawData;
                exportOptions.TextExportMode = optionsModel.DataAwareOptions.ExportDisplayText ? TextExportMode.Text : TextExportMode.Value;
                return(exportTypes[format].ExcelMethod(model.PivotGridSettings, model.PivotGridData, exportOptions));

            default:
                return(exportTypes[format].Method(model.PivotGridSettings, model.PivotGridData));
            }
        }