<commit_before>﻿using System;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Data;
using MvcReportViewer.Example.Models;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;

namespace MvcReportViewer.Example.Controllers
{
    public class HomeController : Controller
    {
        private const string RemoteReportName = "/TestReports/TestReport";
        private const string LocalReportName = "App_Data/Reports/Products.rdlc";
        private const string LocalNoDataReportName = "App_Data/Reports/NoDataReport.rdlc";

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Fluent()
        {
            return View();
        }

        public ActionResult Post()
        {
            return View();
        }

        public ActionResult Multiple()
        {
            return View();
        }

        public ActionResult VisibilityCheck()
        {
            return View();
        }

        public ActionResult NoDataLocalReport()
        {
            return View();
        }

        public ActionResult DownloadPdfLocalNoData()
        {
            return this.Report(
                ReportFormat.Pdf,
                LocalNoDataReportName,
                new { TodayDate = DateTime.Now },
                ProcessingMode.Local);
        }

        public ActionResult DownloadExcel()
        {
            return DownloadReport(ReportFormat.Excel, true, "Report.xls");
        }

        public ActionResult DownloadWord()
        {
            return DownloadReportMultipleValues(ReportFormat.Word, "Report.doc");
        }

        public ActionResult DownloadPdf()
        {
            return DownloadReport(ReportFormat.Pdf, false);
        }

        private ActionResult DownloadReport(ReportFormat format, bool isLocalReport, string filename = null)
        {
            if (isLocalReport)
            {
                return this.Report(
                    format,
                    LocalReportName,
                    new { Parameter1 = "Test", Parameter2 = 123 },
                    ProcessingMode.Local,
                    new Dictionary<string, DataTable>
                    {
                        { "Products", GetProducts() },
                        { "Cities", GetCities() }
                    },
                    filename);
            }

            return this.Report(
                format,
                RemoteReportName,
                new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345 },
                filename: filename);
        }

        private ActionResult DownloadReportMultipleValues(ReportFormat format, string filename = null)
        {
            return this.Report(
                format,
                RemoteReportName,
                new List<KeyValuePair<string, object>>
                {
                    new KeyValuePair<string, object>("Parameter1", "Value 1"),
                    new KeyValuePair<string, object>("Parameter1", "Value 2"),
                    new KeyValuePair<string, object>("Parameter2", DateTime.Now),
                    new KeyValuePair<string, object>("Parameter2", DateTime.Now.AddYears(10)),
                    new KeyValuePair<string, object>("Parameter3", 12345)
                },
                filename: filename);
        }<commit_msg>#103. Testing nullable report parameter support for ReportRunnerExtensions<commit_after>﻿using System;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Data;
using MvcReportViewer.Example.Models;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;

namespace MvcReportViewer.Example.Controllers
{
    public class HomeController : Controller
    {
        private const string RemoteReportName = "/TestReports/TestReport";
        private const string LocalReportName = "App_Data/Reports/Products.rdlc";
        private const string LocalNoDataReportName = "App_Data/Reports/NoDataReport.rdlc";

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Fluent()
        {
            return View();
        }

        public ActionResult Post()
        {
            return View();
        }

        public ActionResult Multiple()
        {
            return View();
        }

        public ActionResult VisibilityCheck()
        {
            return View();
        }

        public ActionResult NoDataLocalReport()
        {
            return View();
        }

        public ActionResult DownloadPdfLocalNoData()
        {
            return this.Report(
                ReportFormat.Pdf,
                LocalNoDataReportName,
                new { TodayDate = DateTime.Now },
                ProcessingMode.Local);
        }

        public ActionResult DownloadExcel()
        {
            return DownloadReport(ReportFormat.Excel, true, "Report.xls");
        }

        public ActionResult DownloadWord()
        {
            return DownloadReportMultipleValues(ReportFormat.Word, "Report.doc");
        }

        public ActionResult DownloadPdf()
        {
            return DownloadReport(ReportFormat.Pdf, false);
        }

        private ActionResult DownloadReport(ReportFormat format, bool isLocalReport, string filename = null)
        {
            if (isLocalReport)
            {
                return this.Report(
                    format,
                    LocalReportName,
                    new { Parameter1 = "Test", Parameter2 = 123 },
                    ProcessingMode.Local,
                    new Dictionary<string, DataTable>
                    {
                        { "Products", GetProducts() },
                        { "Cities", GetCities() }
                    },
                    filename);
            }

            return this.Report(
                format,
                RemoteReportName,
                new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345, Parameter4 = (DateTime?)null },
                filename: filename);
        }

        private ActionResult DownloadReportMultipleValues(ReportFormat format, string filename = null)
        {
            return this.Report(
                format,
                RemoteReportName,
                new List<KeyValuePair<string, object>>
                {
                    new KeyValuePair<string, object>("Parameter1", "Value 1"),
                    new KeyValuePair<string, object>("Parameter1", "Value 2"),
                    new KeyValuePair<string, object>("Parameter2", DateTime.Now),
                    new KeyValuePair<string, object>("Parameter2", DateTime.Now.AddYears(10)),
                    new KeyValuePair<string, object>("Parameter3", 12345)
                },
                filename: filename);
        }
{'fraction_non_alphanumeric': 0.08281543575661222, 'fraction_numerical': 0.008382714265067205, 'mean_word_length': 1.585949177877429, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '821458', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1557, 'n_words': 365}