public HttpResponseMessage GenerateCSV() { //Initialize service and model properties var connectionFactory = new HelperConnectionFactory(ConnectionHelper.Helper()); var sqlRepo = new SqlServerRepository(connectionFactory); var reportRepository = new LegacyRecoverabilityIntegrityReportRepository(connectionFactory); var svc = new BackupDbccService(sqlRepo, reportRepository); var qualityIndicatorService = new QualityIndicatorService(new QualityIndicatorConfigurationService(new ConfigurationRepository(connectionFactory))); var model = PopulateModelSettings(); model.GridConditions.StartRow = 1; model.GridConditions.EndRow = int.MaxValue; //Get the data var fetchedData = FetchFileData(svc, model, qualityIndicatorService); //Serialize response HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK); message.Content = new StringContent(fetchedData); message.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/csv"); message.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"); message.Content.Headers.ContentDisposition.FileName = string.Format("RecoveryObjectives-{0}.csv", DateTime.Now.ToString("yyyyMMdd-HHmmss")); return(message); }
public HttpResponseMessage GenerateCSV() { //Initialize service and model properties var connectionFactory = new HelperConnectionFactory(ConnectionHelper.Helper()); var sqlRepo = new SqlServerRepository(connectionFactory); var svc = new UserExperienceService(sqlRepo); var qualityIndicatorService = new QualityIndicatorService(new QualityIndicatorConfigurationService(new ConfigurationRepository(connectionFactory))); var model = PopulateServerModelSettings(); model.GridConditions.StartRow = 1; model.GridConditions.EndRow = int.MaxValue; //Get the data var fetchedData = FetchFileData(svc, model, qualityIndicatorService); //Serialize response var message = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(fetchedData) }; message.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/csv"); message.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") { FileName = $"UserExperienceServers-{DateTime.Now:yyyyMMdd-HHmmss}.csv" }; return(message); }
public HttpResponseMessage Waits() { //Initialize service and model properties var connectionFactory = new HelperConnectionFactory(ConnectionHelper.Helper()); var sqlRepo = new SqlServerRepository(connectionFactory); var svc = new SystemLoadService(sqlRepo); var model = PopulateServerModelSettings(); var qualityIndicatorService = new QualityIndicatorService(new QualityIndicatorConfigurationService(new ConfigurationRepository(connectionFactory))); var session = (HttpSessionState)GetSession(); session[DataTableSessionConstants.SystemLoadWaitsState] = model; //Get the data var dtResponse = FetchServerGridData(svc, model, qualityIndicatorService); //Serialize response var json = dtResponse.ToJson(); var response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); return(response); }
public HttpResponseMessage Hours() { //Initialize service and model properties var connectionFactory = new HelperConnectionFactory(ConnectionHelper.Helper()); var svc = this.GetBackupDbccService(); var qualityIndicatorService = new QualityIndicatorService(new QualityIndicatorConfigurationService(new ConfigurationRepository(connectionFactory))); var model = PopulateHoursModelSettings(); var session = (HttpSessionState)GetSession(); session[DataTableSessionConstants.RecoverabilityIntegrityState] = model; //Get the data // Pass QualityService var dtResponse = FetchHoursGridData(svc, model, qualityIndicatorService); //Serialize response var json = dtResponse.ToJson(); var response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); return(response); }
public QualityIndicatorLevel GetIndicatorLevels() { var qualityService = new QualityIndicatorService(new QualityIndicatorConfigurationService(new ConfigurationRepository(this.connectionFactory))); return(qualityService.GetIndicatorLevels()); }