Ejemplo n.º 1
0
        private FilterResult FilterData(BackupDbccService svc, RecoverabilityIntegrityViewModel viewModel, bool isDownload, IQualityIndicatorService qualityIndicatorService)
        {
            var grid   = svc.RecoverabilityIntegritySummary(viewModel.GridConditions, viewModel.FilterConditions, viewModel.FilterOperands);
            var aaData = grid.Data.Select(d => new string[] {
                d.FriendlySummaryDayHour,
                isDownload ?
                d.RecoverabilityIntegrityScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.RecoverabilityIntegrityScore, false)}'>{d.RecoverabilityIntegrityScore}</span>",
                isDownload ?
                d.BackupFrequencyScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.BackupFrequencyScore, false)}'>{d.BackupFrequencyScore}</span>",
                isDownload ?
                d.BackupCoverageScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.BackupCoverageScore, false)}'>{d.BackupCoverageScore}</span>",
                isDownload ?
                d.DbccFrequencyScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.DbccFrequencyScore, false)}'>{d.DbccFrequencyScore}</span>",
                isDownload ?
                d.DbccCoverageScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.DbccCoverageScore, false)}'>{d.DbccCoverageScore}</span>",
                isDownload ?
                d.RPOScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.RPOScore, false)}' title='{(d.RPOScore < 100 ? d.PotentialDataLossMinutes + " minute(s) of potential data loss on "+ d.WorstRPODatabase : String.Empty)}'>{d.RPOScore}</span>",
                isDownload ?
                d.RTOScore.ToString()
                                        : $"<span class='{qualityIndicatorService.GetCssClassForScore(d.RTOScore, false)}' title='{(d.RTOScore < 100 ? "Estimated " + d.EstimatedTimeToRecoverHours + " hours(s) to restore "+ d.WorstRTODatabase : String.Empty)}'>{d.RTOScore}</span>"
            }).ToArray();

            return(new kCura.PDD.Web.Controllers.FilterResult()
            {
                Data = aaData, TotalRecordCount = grid.Count
            });
        }
Ejemplo n.º 2
0
        private void Initialize(RecoverabilityIntegrityViewModel model)
        {
            var json = new JavaScriptSerializer().Serialize(model);

            VarscatState.Value = json;

            TimezoneOffset.Value = RequestService.GetTimezoneOffset(this.Request).ToString();
            SampleStart.Value    = base.GlassInfo.MinSampleDate.GetValueOrDefault(DateTime.UtcNow).ToString("s");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Translates a Backup/DBCC view into grid data
        /// </summary>
        /// <param name="viewModel"></param>
        /// <returns></returns>
        private DataTableResponse FetchHoursGridData(BackupDbccService svc, RecoverabilityIntegrityViewModel viewModel, IQualityIndicatorService qualityIndicatorService)
        {
            var data       = FilterData(svc, viewModel, false, qualityIndicatorService);
            var dtResponse = new DataTableResponse()
            {
                sEcho = string.IsNullOrEmpty(viewModel.GridConditions.sEcho)
                                        ? "1"
                                        : viewModel.GridConditions.sEcho,
                aaData          = data.Data,
                recordsTotal    = data.Data.Count(),
                recordsFiltered = data.TotalRecordCount
            };

            return(dtResponse);
        }
Ejemplo n.º 4
0
        private string FetchFileData(BackupDbccService svc, RecoverabilityIntegrityViewModel viewModel, IQualityIndicatorService qualityIndicatorService)
        {
            var filterResult = FilterData(svc, viewModel, true, qualityIndicatorService);

            using (var sw = new System.IO.StringWriter())
            {
                var heaaderArr = new string[]
                {
                    "Hour", "Overall Score", "Backup Frequency Score", "Backup Coverage Score",
                    "DBCC Frequency Score", "DBCC Coverage Score", "RPO Score", "RTO Score"
                };
                sw.WriteLine(string.Join(",", heaaderArr));
                foreach (var row in filterResult.Data)
                {
                    sw.WriteCsvSafeLine(row);
                }
                return(sw.ToString());
            }
        }