Problem creating new Report to Business Object

Stimulsoft Reports.NET discussion
Post Reply
romulocpd
Posts: 73
Joined: Thu Oct 17, 2013 10:39 pm
Location: Nova Friburgo, Rio de Janeiro, Brasil

Problem creating new Report to Business Object

Post by romulocpd »

Hello.

I'm trying create new reporto for my business objects. I work with Entity Framework and I've got objects do query and show data to MVC views.

If I pass the business object and call method Design() (Windows Forms), the Dictionary is filled correct.

In Windows Forms:

My Object:

Code: Select all

public class ObjRelatorio
    {
        public ObjRelatorio()
        {
            Clientes = new List<Cliente>();
        }

        public int CodigoEmpresa { get; set; }
        public string RazaoSocial { get; set; }

        public List<Cliente> Clientes { get; set; }
        
    }
Call to show Design (Windows Forms yet):

Code: Select all

            ObjRelatorio Rel = new ObjRelatorio();

            GerarDados(Rel);

            StiReport S = new StiReport();
            S.RegBusinessObject("DadosEmpresa", Rel);            
            S.Design();
In this moment whe Stimulsoft recognized (like attachment) my object! Very good.

My problem is: In MVC Designer it won't work.

Code: Select all

         public ActionResult EditarRelatorioMaster()
        {
            StiReport S = new StiReport();
         
            // My Business Object !!!!!!!!!!!!!!!!!!1   
            S.RegBusinessObject("Cabecalho", new Models.View.ModelViewCabecalhoRelatoriosView());

            return StiMvcDesigner.GetReportTemplateResult(S);
        }
And in the view

Code: Select all

@using System.Web.UI.WebControls;
@using Stimulsoft.Report.Mvc;

@{
    ViewBag.Title = "EditarRelatorioMaster";
    Layout = "~/Views/Shared/_AlterarRelatorio.cshtml";
}

<h2>Alterar Relatório Master</h2>

@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
        ActionGetReportTemplate = "EditarRelatorioMaster",
        ActionSaveReportTemplate = "SalvarRelatorioMaster",
        ActionGetReportSnapshot = "DadosAlteracaoRelatorioMaster",
        ActionGetLocalization = "GetLocalization",
        Width = Unit.Percentage(100),
        Height = Unit.Pixel(800)
})


It won't work!!!!

What my soluciton? I've create a equal object in Windows Forms, call the Designer, create the .mrt file. If I get this file and use in MVC project, the report works!!!!!!!

So, my problem is create new reports reading data from my Business Object.

Thank you!
Attachments
MVC Designer don't recognized my Business Object
MVC Designer don't recognized my Business Object
StimulSoft2.png (33.58 KiB) Viewed 1598 times
Design recognized my Business Object
Design recognized my Business Object
StimulSoft1.png (8.68 KiB) Viewed 1598 times
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Problem creating new Report to Business Object

Post by Vladimir »

Hello,

Please use the following code:

Code: Select all

        public ActionResult EditarRelatorioMaster()
        {
            StiReport S = new StiReport();
         
            // My Business Object !!!!!!!!!!!!!!!!!!1   
            S.RegBusinessObject("Cabecalho", new Models.View.ModelViewCabecalhoRelatoriosView());
            S.Dictionary.Synchronize();

            return StiMvcDesigner.GetReportTemplateResult(S);
        }
Thank you.
Post Reply