Произошла ошибка во время локальной обработки отчета. Произошла непредвиденная ошибка в Исключении обработки отчета типа - PullRequest
0 голосов
/ 27 сентября 2019

Приложение MVC, пожалуйста, помогите мне

ошибка:

Произошла ошибка во время локальной обработки отчета.Произошла непредвиденная ошибка при обработке отчета.Было сгенерировано исключение типа System.OutOfMemoryException.

Код:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int intIncidentId = 0;
                int intModuletype = 0;
                string txtModuletype = "";
                if (Request.QueryString["intIncidentId"] != null)
                {
                    intIncidentId = Convert.ToInt32(Request.QueryString["intIncidentId"]);
                }

                if (Request.QueryString["ModuleTypeId"] != null)
                {
                    intModuletype = Convert.ToInt32(Request.QueryString["ModuleTypeId"]);
                }

                if (Request.QueryString["ModuleTypetxt"] != null)
                {
                    txtModuletype = Request.QueryString["ModuleTypetxt"];
                }

                List<SP_GETIncidentPDFReport_Result> listIncident = null;
                List<SP_GETIncidentPDFReport_Attachment_Result> listIncident1 = null;
                List<SP_GETIncidentPDFReport_Attachment_Result> listIncident3 = null;
                List<SP_GETIncidentPDFReport_Visibilities_Result> listIncident2 = null;
                List<SP_GETIncidentPDFReport_Narratives_Result> listIncident4 = null;
                List<SP_GETIncidentPDFReport_InvolvedPerson_Result> listIncident5 = null;
                List<SP_GETIncidentPDFReport_InvolvedOrganization_Result> listIncident6 = null;
                List<SP_GETIncidentPDFReport_InvolvedItem_Result> listIncident7 = null;
                List<SP_GETIncidentPDFReport_InvolvedVehicle_Result> listIncident8 = null;
                List<SP_GETIncidentPDFReport_Flags_Result> listIncident9 = null;
                List<SP_GETIncidentPDFReport_Assignments_Result> listIncident10 = null;
                List<SP_GETIncidentPDFReport_DetailedLoss_Result> listIncident11 = null;
                List<SP_GETIncidentPDFReport_DetailedLoss_1_Result> listIncident12 = null;
                using (var _context = new MERRAS_DEVEntities())
                {
                    try
                    {
                        listIncident = _context.SP_GETIncidentPDFReport(intIncidentId, intModuletype).ToList();   //_context.trnActivities.ToList();
                        listIncident1 = _context.SP_GETIncidentPDFReport_Attachment(intIncidentId, intModuletype).ToList();   //_context.trnActivities.ToList();
                        listIncident3 = _context.SP_GETIncidentPDFReport_Attachment(intIncidentId, intModuletype).ToList();   //_context.trnActivities.ToList();
                        listIncident2 = _context.SP_GETIncidentPDFReport_Visibilities(intIncidentId, intModuletype).ToList();   //_context.trnActivities.ToList();
                        listIncident4 = _context.SP_GETIncidentPDFReport_Narratives(intIncidentId, intModuletype).ToList();
                        listIncident5 = _context.SP_GETIncidentPDFReport_InvolvedPerson(intIncidentId, intModuletype).ToList();
                        listIncident6 = _context.SP_GETIncidentPDFReport_InvolvedOrganization(intIncidentId, intModuletype).ToList();
                        listIncident7 = _context.SP_GETIncidentPDFReport_InvolvedItem(intIncidentId, intModuletype).ToList();
                        listIncident8 = _context.SP_GETIncidentPDFReport_InvolvedVehicle(intIncidentId, intModuletype).ToList();
                        listIncident9 = _context.SP_GETIncidentPDFReport_Flags(intIncidentId, intModuletype).ToList();
                        listIncident10 = _context.SP_GETIncidentPDFReport_Assignments(intIncidentId, intModuletype).ToList();
                        listIncident11 = _context.SP_GETIncidentPDFReport_DetailedLoss(intIncidentId, intModuletype).ToList();
                        listIncident12 = _context.SP_GETIncidentPDFReport_DetailedLoss_1(intIncidentId, intModuletype).ToList();


                        if (txtModuletype == "Incident" || txtModuletype == "INCIDENT" || txtModuletype == "incident")
                        {
                            //IncidentReportViewer.LocalReport.ReportPath = Server.MapPath("~/Areas/Report/IncidentReport_RDLC/IncidentReport.rdlc");
                            IncidentReportViewer.LocalReport.ReportPath = Server.MapPath("~/bin/Areas/Report/IncidentReport_RDLC/IncidentReport.rdlc");
                        }
                        else if (txtModuletype == "activity" || txtModuletype == "Activity" || txtModuletype == "ACTIVITY")
                        {
                            IncidentReportViewer.LocalReport.ReportPath = Server.MapPath("~/Areas/Report/IncidentReport_RDLC/ActivityReport2.rdlc");
                        }
                        IncidentReportViewer.LocalReport.DataSources.Clear();

                        string InctNo = "Inc";
                        foreach (var value in listIncident)
                        {
                            InctNo = value.IncidentNumber;
                        }

                        ReportDataSource rdc = new ReportDataSource("DataSet1", listIncident);
                        ReportDataSource rdc1 = new ReportDataSource("DataSet4_Att", listIncident1);
                        ReportDataSource rdc2 = new ReportDataSource("DataSet3", listIncident2);
                        ReportDataSource rdc3 = new ReportDataSource("DataSet2", listIncident3);
                        ReportDataSource rdc4 = new ReportDataSource("DataSet4", listIncident4);
                        ReportDataSource rdc5 = new ReportDataSource("Incident_InvolvedPerson", listIncident5);
                        ReportDataSource rdc6 = new ReportDataSource("Incident_InvolvedOrganization", listIncident6);
                        ReportDataSource rdc7 = new ReportDataSource("Incident_InvolvementItem", listIncident7);
                        ReportDataSource rdc8 = new ReportDataSource("Incident_InvolvementVehical", listIncident8);
                        ReportDataSource rdc9 = new ReportDataSource("Incident_Flag", listIncident9);
                        ReportDataSource rdc10 = new ReportDataSource("Incident_Assignment", listIncident10);
                        ReportDataSource rdc11 = new ReportDataSource("Incident_LossDetails", listIncident11);
                        ReportDataSource rdc12 = new ReportDataSource("Incident_LossDeatils1", listIncident12);
                        IncidentReportViewer.LocalReport.EnableExternalImages = true;
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc1);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc2);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc3);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc4);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc5);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc6);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc7);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc8);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc9);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc10);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc11);
                        IncidentReportViewer.LocalReport.DataSources.Add(rdc12);
                        IncidentReportViewer.LocalReport.DisplayName = InctNo;
                        IncidentReportViewer.LocalReport.Refresh();
                        //IncidentReportViewer.DataBind();
                    }
                    catch(Exception ex)
                    {

                        CommonClasses.LogFileWrite("IncidewntReport_CallReport", "PageLoad", ex);
                    }
                }
            }
        }
...