private FilterResult FilterData(SystemLoadService svc, SystemLoadWaitsViewModel viewModel, bool isDownload, IQualityIndicatorService qualityIndicatorService)
        {
            var grid    = svc.Waits(viewModel.GridConditions, viewModel.FilterConditions, viewModel.FilterOperands);
            var sysInfo = svc.ReadSystemInformation().ToList();
            var aaData  = grid.Data.Select(d => new string[] {
                $"{d.SummaryDayHour.ToShortDateString()} {d.SummaryDayHour.ToString("t")}",
                $"{d.Server} ({d.ServerId})",
                isDownload
                    ? d.OverallScore.ToString()
                                        :$"<span class='{qualityIndicatorService.GetCssClassForScore(d.OverallScore, false)}'>{d.OverallScore}</span>",
                $"{d.SignalWaitsRatio}%",
                d.PercentOfCPUThreshold.ToString("f2"),
                isDownload
                    ? d.WaitType
                    : $"<div style='display:inline-block;' title='{d.WaitDescription}'>{d.WaitType}</div>",
                d.SignalWaitTime.ToString(),
                d.TotalWaitTime.ToString(),
                d.DifferentialWaitingTasksCount.ToString(),
                d.IsPoisonWait ? "Yes" : "No",
                d.IsActiveWeeklySample ? "Yes" : "No"
            }).ToArray();

            return(new kCura.PDD.Web.Controllers.FilterResult()
            {
                Data = aaData, TotalRecordCount = grid.Count
            });
        }
Exemple #2
0
        private FilterResult FilterData(SystemLoadService svc, SystemLoadServerViewModel viewModel, bool IsDownload, IQualityIndicatorService qualityIndicatorService)
        {
            var grid    = svc.ServerHours(viewModel.GridConditions, viewModel.FilterConditions, viewModel.FilterOperands);
            var sysInfo = svc.ReadSystemInformation().ToList();
            var aaData  = grid.Data.Select(d => new string[] {
                IsDownload
                                        ? $"{d.SummaryDayHour.ToShortDateString()} {d.SummaryDayHour.ToString("t")}"
                                        : $"<a href='{GetPageUrl(Names.Tab.ServerHealth, "ServerHealth", $"startDate={d.SummaryDayHour.ToShortDateString()}&endDate={d.SummaryDayHour.ToShortDateString()}")}' target='_parent'>{ d.SummaryDayHour.ToShortDateString()} {d.SummaryDayHour.ToString("t")} </a>",
                IsDownload
                                        ? string.Format("{0} ({1})", d.Server, d.ServerId)
                                        : string.Format(@"<div style=""display:inline-block"" title=""{0}"" data-placement=""right"">{1}</div>",
                                                        (sysInfo.FirstOrDefault(i => i.ServerArtifactId == d.ServerId) ?? new SystemInformation()).SummaryHtml,
                                                        string.Format("{0} ({1})", d.Server, d.ServerId)
                                                        ),
                d.ServerType,
                IsDownload ?
                d.OverallScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.OverallScore, false)}'>{d.OverallScore}</span>",
                IsDownload ?
                d.CPUScore.ToString()
                                : $"<a href='{GetPageUrl(Names.Tab.ServerHealth, "ServerHealth", $"startDate={d.SummaryDayHour.ToShortDateString()}&endDate={d.SummaryDayHour.ToShortDateString()}&measureType={(int)MeasureTypes.Processor}")}' target='_parent'>" +
                $"<span class='{qualityIndicatorService.GetCssClassForScore(d.CPUScore, false)}'>{d.CPUScore}</span>" +
                $"</a>",
                IsDownload ?
                d.RAMScore.ToString()
                                : $"<a href='{GetPageUrl(Names.Tab.ServerHealth, "ServerHealth", $"startDate={d.SummaryDayHour.ToShortDateString()}&endDate={d.SummaryDayHour.ToShortDateString()}&measureType={(int)MeasureTypes.Ram}")}' target='_parent'>" +
                $"<span class='{qualityIndicatorService.GetCssClassForScore(d.RAMScore, false)}'>{d.RAMScore}</span>" +
                $"</a>",
                IsDownload || d.ServerType != "SQL"
                                        ? d.FriendlyMemorySignalStateScore
                                        : $"<div style='display:inline-block' title='{d.MemorySignalStateRatio}% occurence of low memory<br/>{d.Pageouts} pageout(s)' data-placement='right'>" +
                $"<span class='{qualityIndicatorService.GetCssClassForScore(d.MemorySignalStateScore, false)}'>{d.MemorySignalStateScore}</span>" +
                $"</div>",
                IsDownload || d.ServerType != "SQL"
                                ? d.FriendlyWaitsScore
                                : $"<a href='{GetPageUrl(d.ServerId, "Waits", $"Server={d.ServerId}&Hour={d.SummaryDayHour.ToString("s")}")}' target='_self'>" +
                $"<b class='{qualityIndicatorService.GetCssClassForScore(d.WaitsScore, false)}'>{d.FriendlyWaitsScore}</b>" +
                $"</a>",
                IsDownload || d.ServerType != "SQL"
                                        ? d.FriendlyVirtualLogFilesScore
                                        :$"<div style='display:inline-block' title='{(d.MaxVirtualLogFiles > 0 ? d.MaxVirtualLogFiles + "virtual log file(s)" : string.Empty)}' data-placement='right'>" +
                $"<b class='{qualityIndicatorService.GetCssClassForScore(d.VirtualLogFilesScore, false)}'>{d.FriendlyVirtualLogFilesScore}</b>" +
                $"</div>",
                IsDownload || d.ServerType != "SQL"
                                        ? d.FriendlyLatencyScore
                                        : $"<div style='display:inline-block' " +
                $"title='{(!string.IsNullOrEmpty(d.HighestLatencyDatabase) ? string.Format("{0} ({1} File)<br/>Read Latency: {2} ms<br/>Write Latency: {3} ms", d.HighestLatencyDatabase, d.DatabaseFileType, d.ReadLatencyMs, d.WriteLatencyMs) : string.Empty)} ' data-placement='right'>" +
                $"<b class='{qualityIndicatorService.GetCssClassForScore(d.LatencyScore, false)}'>{d.FriendlyLatencyScore}</b>" +
                $"</div>",
                d.IsActiveWeeklySample ? "Yes" : "No"
            }).ToArray();

            return(new kCura.PDD.Web.Controllers.FilterResult()
            {
                Data = aaData, TotalRecordCount = grid.Count
            });
        }