stimulsoft报道mvc杀戮会议

时间:2017-08-08 08:40:41

标签: asp.net-mvc report stimulsoft

我使用stimulssoft report mvc在asp.net网站上生成报告。 该报告在" local"但是当站点上传到服务器并生成报告时,用户的会话已被销毁,用户被重定向到登录页面。这是报告视图:

@using Stimulsoft.Report.Mvc;
@{Layout = null;} 
<html> 
<head>
    <title>plan report</title>
</head>
<body>
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
    Theme = StiTheme.Office2013,
    ActionGetReportSnapshot = "ShowPlanReport",
    ActionViewerEvent = "ViewerEvent",
    ActionExportReport = "ExportReport",
    ActionPrintReport = "PrintReport",
    ClientRequestTimeout = 90000,
    ServerRelativeUrls = true,
})
</body>
</html>

这是管理员控制器中的ShowPlanReport操作。

public virtual ActionResult ShowPlanReport()
{          
        List<ReportPlanFullViewModel> FinalResult = new 
        List<ReportPlanFullViewModel>();
        var db = new anjomanEntities();
        foreach(Plan temp in reportList)
        {
            ReportPlanFullViewModel model = new ReportPlanFullViewModel();
            model.PlanID = temp.ID;
            model.Farmer = temp.Farmer;
            model.NationalCode = temp.NationalCode;
            model.System = temp.WaterSystem.Name;
            model.RainArea = temp.RainArea;
            model.DropArea = temp.DropsArea;
            model.Mobile = temp.Mobile;
            model.Address = temp.Address;
            model.Village = temp.Village;
            if(db.PlanTopograpger.Where(x=>x.PlanID == temp.ID).Count() > 0)
            {
                model.Topograph = db.PlanTopograpger.FirstOrDefault(x => x.PlanID == temp.ID).Topographer.Name;
                model.Topograph += " ";
                model.Topograph = db.PlanTopograpger.FirstOrDefault(x => x.PlanID == temp.ID).Topographer.Family;
            }
            else
            {
                model.Topograph = "";
            }
            if(db.PlanDesignerAdvisor.Where(x => x.PlanID == temp.ID).Count() > 0)
            {
                model.Design = db.PlanDesignerAdvisor.FirstOrDefault(x => x.PlanID == temp.ID).Advisor.Name;
                model.Design += " ";
                model.Design += db.PlanDesignerAdvisor.FirstOrDefault(x => x.PlanID == temp.ID).Advisor.Family;
            }
            else if (db.PlanDesignerCompany.Where(x => x.PlanID == temp.ID).Count() > 0)
            {
                model.Design = db.PlanDesignerCompany.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
            }
            else
            {
                model.Design = "";
            }
            if(db.PlanChecker.Where(x => x.PlanID == temp.ID).Count() > 0)
            {
                model.Checker = db.PlanChecker.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
            }
            else
            {
                model.Checker = "";
            }
            if(db.PlanExecute.Where(x => x.PlanID == temp.ID).Count() > 0)
            {
                model.Executer = db.PlanExecute.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
            }
            else if (db.PlanExeHistory.Where(x => x.PlanID == temp.ID).Count() > 0)
            {
                model.Executer = db.PlanExeHistory.FirstOrDefault(x => x.PlanID == temp.ID).Company.Name;
            }
            else
            {
                model.Executer = "";
            }
            if(db.PlanValidate.Where(x => x.PlanID == temp.ID && x.Validate == true && x.PlanExecute == true).Count() > 0)
            {
                model.ValidDate = ToJalali(db.PlanValidate.FirstOrDefault(x => x.PlanID == temp.ID && x.Validate == true && x.PlanExecute == true).ValidDate);
            }
            else
            {
                model.ValidDate = "";
            }
            FinalResult.Add(model);
        }
        var mainReport = new Stimulsoft.Report.StiReport();
        mainReport.Load(Server.MapPath("~/Report/PlanReport.mrt"));
        // 
        try
        {
            mainReport.Compile();
        }
        catch(Exception c)
        {
            ViewBag.Message = c.Message;
        }
        mainReport.RegBusinessObject("plan_business", FinalResult);
        return 
     Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport);
}

没有日志,也没有例外,我无法找到问题的根源。请帮忙。

0 个答案:

没有答案