Exemple #1
0
        public ActionResult ExportTo(string OutputFormat)
        {
            var model = Session["TypedListModel"];

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                return(GridViewExtension.ExportToCsv(GridViewHelper.ExportGridViewSettings, model));

            case "PDF":
                return(GridViewExtension.ExportToPdf(GridViewHelper.ExportGridViewSettings, model));

            case "RTF":
                return(GridViewExtension.ExportToRtf(GridViewHelper.ExportGridViewSettings, model));

            case "XLS":
                return(GridViewExtension.ExportToXls(GridViewHelper.ExportGridViewSettings, model));

            case "XLSX":
                return(GridViewExtension.ExportToXlsx(GridViewHelper.ExportGridViewSettings, model));

            default:
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult ExportTo(string id, string OutputFormat)
        {
            ActionResult obj;
            var          model = Session[id + "_resultado"] as ListadoResultado;

            var settings = Session[id + "Settings"] as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Listado, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Listado, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Listado, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Listado, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Listado, true);
                break;

            default:
                obj = RedirectToAction("Index", "Home");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.TituloListado ?? "ListadosMarfil") + "." + OutputFormat.ToLower();
            return(result);
        }
Exemple #3
0
        public ActionResult ExportTo(string exportid, string OutputFormat)
        {
            ActionResult obj;
            var          model    = Session[session] as TarifasModel;
            var          settings = Session["TarifasSettings"]  as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Lineas, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Lineas, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Lineas, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Lineas, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Lineas, true);
                break;

            default:
                obj = RedirectToAction("Index");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.Descripcion ?? Tarifas.TituloEntidad) + "." + OutputFormat.ToLower();
            return(result);
        }
        public ActionResult ExportDetailsTo(string OutputFormat)
        {
            ActionResult obj;
            var          model    = Session["_tablasvariaslin_"] as BaseTablasVariasModel;;
            var          settings = Session["TablavariaSettings"] as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Lineas, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Lineas, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Lineas, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Lineas, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Lineas, true);
                break;

            default:
                obj = RedirectToAction("Index");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.DisplayName ?? "ExportMarfil") + "." + OutputFormat.ToLower();
            return(result);
        }
        public ActionResult ExportTo(GridViewExportFormat format)
        {
            var setting = GetGridViewSetting();
            var data    = QuotesProvider.GetQuotes();

            if (format == GridViewExportFormat.Pdf)
            {
                return(GridViewExtension.ExportToPdf(setting, data));
            }

            if (format == GridViewExportFormat.Rtf)
            {
                return(GridViewExtension.ExportToRtf(setting, data));
            }

            if (format == GridViewExportFormat.Xls)
            {
                return(GridViewExtension.ExportToXls(setting, data, new XlsExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            if (format == GridViewExportFormat.Xlsx)
            {
                return(GridViewExtension.ExportToXlsx(setting, data, new XlsxExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            if (format == GridViewExportFormat.Csv)
            {
                return(GridViewExtension.ExportToCsv(setting, data, new CsvExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            return(Content(string.Empty));
        }
        private ActionResult ExportToType(string OutputFormat, GridViewSettings exportSettings, dynamic model)
        {
            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                return(GridViewExtension.ExportToCsv(exportSettings, model));

            case "PDF":
                return(GridViewExtension.ExportToPdf(exportSettings, model));

            case "RTF":
                return(GridViewExtension.ExportToRtf(exportSettings, model));

            case "XLS":
                return(GridViewExtension.ExportToXls(exportSettings, model));

            case "XLSX":
                return(GridViewExtension.ExportToXlsx(exportSettings, model));

            default:
                return(RedirectToAction("Index"));
            }
        }