Как отправить параметр в действие печати отчета activulsoft? - PullRequest
0 голосов
/ 15 апреля 2019

У меня есть отчет, созданный программойtimulsoft в ядре asp.net. и в поле зрения установите это действие:

@using Stimulsoft.Report.Mvc;

@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        PrintReport = "PrintReport",            
        ViewerEvent = "ViewerEvent"
    }
})

и 3 действия:

public async Task<IActionResult> PrintInsurance(int id)
    {          
       return View();
    }

Параметр id необходим для загрузки информации для отчета.

public ActionResult GetReport()
{
var insurance = await _insuranceService.GetInsuranceForEdit(id);
        StiReport report = new StiReport();
        report.Load(StiNetCoreHelper.MapPath(this, 
           "wwwroot/Reports/PrintInsurance.mrt"));

        report.RegData("dt", insurance);
        return StiNetCoreViewer.GetReportResult(this, report);
}

в вышеуказанном действии, как я могу получить идентификатор ??

и затем это действие для печати отчета:

public async Task<IActionResult> PrintReport()
    {
        //Change State To Printed

        bool result = await _insuranceService.ChangeToPrinted((int)id,User.Identity.Name);
        return StiNetCoreViewer.PrintReportResult(this);

    }

в приведенном выше действии снова мне нужен идентификатор. как получить доступ к значению идентификатора ???

1 Ответ

0 голосов
/ 18 июня 2019

Определите «ID» как переменную в своем отчете, затем попробуйте добавить это в свой код перед загрузкой отчета:

string ID = "ID";
report.Dictionary.Variables("ID").Value = ID;
...