예제 #1
0
        public IActionResult Report(string id, string anchorName)
        {
            if (!IsOnline)
            {
                return(RedirectToAction(ReportingController.ActionNames.Offline, ReportingController.Name));
            }

            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext,
                ReportId      = Parse.ParseInt32(id)
            };
            var reportVisual = ReportVisualService.GetReportVisual(reportSearchCriteria);

            if (reportVisual == null)
            {
                return(RedirectToAction(ActionNames.Index));
            }

            Logger.Information("{@EventType} {@ReportId}", EventType.LoggingEventTypes.ViewedReport.ToString(), reportVisual.Id.ToString());

            var tableauReportViewModel = new TableauReportViewModel(reportVisual);

            return(View(tableauReportViewModel));
        }
        protected static Report GetReport(LogicalHL7EventArgs item)
        {
            var criteria = new ReportSearchCriteria();

            criteria.OID.EqualTo(item.ReportOID);
            return(PersistenceScope.CurrentContext.GetBroker <IReportBroker>().FindOne(criteria));
        }
예제 #3
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The Dfa user object running the code example.
        /// </param>
        public override void Run(DfaUser user)
        {
            // Create ReportRemoteService instance.
            ReportRemoteService service = (ReportRemoteService)user.GetService(
                DfaService.v1_19.ReportRemoteService);

            long queryId = long.Parse(_T("INSERT_QUERY_ID_HERE"));

            // Create report search criteria object.
            ReportSearchCriteria reportSearchCriteria = new ReportSearchCriteria();

            reportSearchCriteria.queryId = queryId;

            try {
                // Get report information.
                ReportInfoRecordSet reportInfoRecordSet =
                    service.getReportsByCriteria(reportSearchCriteria);

                // Display information on reports.
                if (reportInfoRecordSet.records != null && reportInfoRecordSet.records.Length > 0)
                {
                    foreach (ReportInfo report in reportInfoRecordSet.records)
                    {
                        Console.WriteLine("Report with ID '{0}', status of '{1}' and URL of '{2}' was found.",
                                          report.reportId, report.status, report.url);
                    }
                }
                else
                {
                    Console.WriteLine("No reports found for your query ID.");
                }
            } catch (Exception ex) {
                Console.WriteLine("Failed to retrieve all reports. Exception says \"{0}\"", ex.Message);
            }
        }
예제 #4
0
        public async Task <IActionResult> Report(int contactId, string id, string anchorName)
        {
            if (!IsReportingOnline)
            {
                return(RedirectToAction(ReportingController.ActionNames.Offline, ReportingController.Name));
            }

            var contact = await FindContactByIdAsync(contactId);

            SetHeroLayoutViewData(contact, PageKeys.Messages);

            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext,
                ReportId      = Parse.ParseInt32(id)
            };
            var reportVisual = ReportVisualService.GetReportVisual(reportSearchCriteria);

            if (reportVisual == null)
            {
                RedirectToAction(ActionNames.ContactBackground);
            }

            Logger.Information("{@EventType} {@ReportId} {@ContactId}", EventType.LoggingEventTypes.ViewedReport.ToString(), reportVisual.Id.ToString(), contactId);

            var tableauReportViewModel = new TableauReportViewModel(reportVisual);

            return(View(tableauReportViewModel));
        }
예제 #5
0
        private IReportVisual GetReportVisual(string id)
        {
            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext,
                ReportId      = Parse.ParseInt32(id)
            };
            var reportVisual = ReportVisualService.GetReportVisual(reportSearchCriteria);

            return(reportVisual);
        }
예제 #6
0
        private SerializableTreeNode <ReportVisualFolder> GetRelatedReports(IReportVisual baseReport)
        {
            baseReport.Tags.Remove(DefaultTags);

            var searchCriteria = new ReportSearchCriteria
            {
                VisualContext    = VisualContext.Tenant,
                TagFilter        = baseReport.Tags,
                BaseReportVisual = baseReport
            };
            var relatedReports = ReportVisualService.GetReportFolder(searchCriteria, RelatedReports);

            return(relatedReports);
        }
예제 #7
0
        public IActionResult Index()
        {
            if (!IsOnline)
            {
                return(RedirectToAction(ActionNames.Offline));
            }

            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext
            };
            var root = ReportVisualService.GetReportFolderTreeRoot(reportSearchCriteria);

            return(View(root));
        }
예제 #8
0
        public IActionResult Index()
        {
            if (!IsOnline)
            {
                return(RedirectToAction(ReportingController.ActionNames.Offline, ReportingController.Name));
            }

            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext,
                TagFilter     = new List <string> {
                    ReportTagFilters.RiskIndex
                }
            };
            var root = ReportVisualService.GetReportFolderTreeRoot(reportSearchCriteria);

            return(View(root));
        }
예제 #9
0
        public async Task <IActionResult> ReportIndex(int id)
        {
            if (!IsReportingOnline)
            {
                return(RedirectToAction(ReportingController.ActionNames.Offline, ReportingController.Name));
            }

            var contact = await FindContactByIdAsync(id);

            if (contact == null)
            {
                return(NotFound());
            }
            SetHeroLayoutViewData(contact, PageKeys.Reports);

            var reportSearchCriteria = new ReportSearchCriteria
            {
                VisualContext = ReportVisualContext
            };
            var root = ReportVisualService.GetReportFolderTreeRoot(reportSearchCriteria);

            return(View(root));
        }
        /// <summary>
        /// Executes the SQL Report query.
        /// </summary>
        /// <param name="reportId">The SQL Report Id.</param>
        /// <param name="criteria">The search criteria.</param>
        /// <returns>
        /// The query execution result.
        /// </returns>
        public ReportQueryResult ExecuteQuery(long reportId, ReportSearchCriteria criteria)
        {
            var report = _db.Set <RefReportSql>().Find(reportId);

            Util.CheckFoundEntity(report, reportId, "reportId");

            var result = new ReportQueryResult();

            using (var connection = _db.Database.GetDbConnection())
            {
                _db.Database.OpenConnection();

                string query = report.SQLRequest;

                // set Session Id parameter
                if (criteria.InventorySessionId != null)
                {
                    query = query.Replace("@InventorySessionId", criteria.InventorySessionId.ToString());
                }

                // get total count
                // result.TotalCount = GetTotalCount(connection, query);

                // read Items
                using (var command = connection.CreateCommand())
                {
                    command.CommandTimeout = 300;

                    /* construct order by
                    *  var orderBy = !string.IsNullOrWhiteSpace(criteria.SortBy)
                    *   ? $"{criteria.SortBy} {criteria.SortType}"
                    *   : "(SELECT NULL)"; */

                    // apply paging & sort, if provided
                    if (criteria.PageSize > 0 && criteria.PageIndex > 0)
                    {
                        int offset = criteria.PageSize * (criteria.PageIndex - 1);
                        query = $"select top 5000 * from ({query}) as tmp ";
                    }

                    command.CommandText = query;
                    using (var reader = command.ExecuteReader())
                    {
                        // read column names
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            result.Headers.Add(reader.GetName(i));
                        }

                        // read all records
                        while (reader.Read())
                        {
                            var record = new List <object>();
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                object value = reader.GetValue(i);
                                record.Add(value);
                            }

                            result.Items.Add(record);
                        }
                    }
                }
            }

            result.TotalCount = result.Items.Count;
            return(result);
        }