示例#1
0
        public CaseNavigationGraph GetGraphFromCase(Guid caseId)
        {
            var @case   = _summaryContext.Find <Domain.Summaries.Case.Case>(caseId);
            var reports = _reportContext.GetEntityQuery <Report>()
                          .Where(ReportSpecifications.ByCaseNumber(@case.AgencyId, @case.Number))
                          .ToList();

            return(CaseNavigationGraphFactory.BuildNavigationGraph(@case, @case.Summaries.ToList(), reports));
        }
示例#2
0
        public CaseNavigationGraph GetGraphFromReport(Guid reportId)
        {
            var report              = _reportContext.Find <Report>(reportId);
            var moduleType          = report.ModuleType;
            var reportHasCaseNumber = !string.IsNullOrWhiteSpace(report.CaseNumber);
            var reportHasNumber     = !string.IsNullOrWhiteSpace(report.Number);

            #region Report Has Case

            if (reportHasCaseNumber)
            {
                // Find the Case
                var cCase = _summaryContext.GetEntityQuery <Domain.Summaries.Case.Case>()
                            .FirstOrDefault(CaseSpecifications.ByNumber(report.AgencyId, report.CaseNumber));

                // Return the graph for the Case.
                if (cCase != null)
                {
                    return(GetGraphFromCase(cCase.Id));
                }

                // We should not be here.
                Log.Info("Report [{0}] References Case Number [{1}] that does not exist.", report.Id, report.CaseNumber);
            }

            #endregion

            // If there is no Number, build the graph.
            if (!reportHasNumber)
            {
                return(CaseNavigationGraphFactory.BuildNavigationGraph(null, null, new List <Report>()
                {
                    report
                }));
            }

            #region Report Has Number

            // Find the Summary
            var summaries = _summaryContext.GetEntityQuery <Summary>()
                            .Where(SummarySpecifications.ByNumber(report.AgencyId, moduleType, report.Number))
                            .ToList();

            var reports = _reportContext.GetEntityQuery <Report>()
                          .Where(ReportSpecifications.ByNumber(report.AgencyId, moduleType, report.Number))
                          .ToList();

            return(CaseNavigationGraphFactory.BuildNavigationGraph(null, summaries, reports));

            #endregion
        }
示例#3
0
        public CaseNavigationGraph GetGraphFromSummary(Guid summaryId)
        {
            var summary = _summaryContext.Find <Summary>(summaryId);
            var caseId  = summary.CaseId.GetValueOrDefault(Guid.Empty);

            if (caseId != Guid.Empty)
            {
                return(GetGraphFromCase(caseId));
            }

            var reports = _reportContext.GetEntityQuery <Report>()
                          .Where(ReportSpecifications.ByNumber(summary.AgencyId, summary.ModuleType, summary.Number))
                          .ToList();

            return(CaseNavigationGraphFactory.BuildNavigationGraph(null, new List <Summary>()
            {
                summary
            }, reports));
        }