protected void Page_Load(object sender, EventArgs e) { var state = Session[DataTableSessionConstants.UserExperienceServerState] as UserExperienceServerViewModel; var serverParam = Request.Params["Server"] ?? string.Empty; //If any query string parameters differ from previous model state filters, build a new model if (state != null && state.FilterConditions.Server != serverParam) { state = null; } var model = state ?? new UserExperienceServerViewModel(); Initialize(model, serverParam); var scores = _userExperience.GetOverallScores(); QoSNavButton.HRef = QosNavigationUrl; QuarterlyScore.Attributes["class"] = _indicatorService.GetCssClassForScore(scores.QuarterlyUserExperienceScore, true); QuarterlyScore.InnerText = _indicatorService.GetIndicatorForScore(scores.QuarterlyUserExperienceScore) != PDB.Core.Enumerations.QualityIndicator.None ? scores.QuarterlyUserExperienceScore.ToString() : "N/A"; QuarterlyScore.Attributes["href"] = QosNavigationUrl; var servers = _userExperience.ListAllServers().Where(x => x.ArtifactId > 0).ToList(); pageServerSelect.DataValueField = "ArtifactId"; pageServerSelect.DataTextField = "Name"; pageServerSelect.DataSource = servers; pageServerSelect.DataBind(); if (!string.IsNullOrEmpty(model.FilterConditions.Server)) { var selectedServer = pageServerSelect.Items.FindByValue(model.FilterConditions.Server); if (selectedServer != null) { selectedServer.Selected = true; } } DateFormatString.Value = DateFormat; TimeFormatString.Value = TimeFormat; var timezoneOffset = RequestService.GetTimezoneOffset(this.Request); startDate.Value = model.GridConditions.StartDate.HasValue ? model.GridConditions.StartDate.Value.AddMinutes(timezoneOffset).ToShortDateString() : GlassInfo.MinSampleDate.GetValueOrDefault(DateTime.UtcNow).AddMinutes(timezoneOffset).ToShortDateString(); endDate.Value = model.GridConditions.EndDate.HasValue ? model.GridConditions.EndDate.Value.AddMinutes(timezoneOffset).ToShortDateString() : DateTime.UtcNow.AddMinutes(timezoneOffset).ToShortDateString(); }
protected void Page_Load(object sender, EventArgs e) { var state = Session[DataTableSessionConstants.UserExperienceHoursState] as UserExperienceHoursViewModel; var serverParam = Request.Params["Server"] ?? string.Empty; var workspaceParam = Request.Params["Workspace"] ?? string.Empty; //If any query string parameters differ from previous model state filters, build a new model if (state != null && (state.FilterConditions.Server.ToString() != serverParam || state.FilterConditions.Workspace != workspaceParam)) { state = null; } var model = state ?? new UserExperienceHoursViewModel(); Initialize(model, serverParam, workspaceParam); var server = _userExperience.ListDatabaseServers().FirstOrDefault(x => x.ArtifactId == model.FilterConditions.Server); var serverName = server != null ? server.Name : model.FilterConditions.Server.ToString(); var scores = _userExperience.GetOverallScores(); QoSNavButton.HRef = QosNavigationUrl; QuarterlyScore.Attributes["class"] = _indicatorService.GetCssClassForScore(scores.QuarterlyUserExperienceScore, true); QuarterlyScore.InnerText = _indicatorService.GetIndicatorForScore(scores.QuarterlyUserExperienceScore) != PDB.Core.Enumerations.QualityIndicator.None ? scores.QuarterlyUserExperienceScore.ToString() : "N/A"; QuarterlyScore.Attributes["href"] = QosNavigationUrl; ReportHeader.InnerHtml = $"Hours View Report<br/>Server: {serverName} ({model.FilterConditions.Server})"; DateFormatString.Value = DateFormat; TimeFormatString.Value = TimeFormat; var timezoneOffset = RequestService.GetTimezoneOffset(this.Request); startDate.Value = model.GridConditions.StartDate.HasValue ? model.GridConditions.StartDate.Value.AddMinutes(timezoneOffset).ToShortDateString() : GlassInfo.MinSampleDate.GetValueOrDefault(DateTime.UtcNow).AddMinutes(timezoneOffset).ToShortDateString(); endDate.Value = model.GridConditions.EndDate.HasValue ? model.GridConditions.EndDate.Value.AddMinutes(timezoneOffset).ToShortDateString() : DateTime.UtcNow.AddMinutes(timezoneOffset).ToShortDateString(); }