private static IEnumerable <InstallationSummaryDto> GetInstallations() { IEnumerable <InstallationSummary> installationSummaries; using (var prestoWcf = new PrestoWcf <IInstallationSummaryService>()) { installationSummaries = prestoWcf.Service.GetMostRecentByStartTime(50); } var installationSummaryDtos = new List <InstallationSummaryDto>(); // Just use this until we can give the user the flexibility to choose a different time zone. var timeZoneHelper = new TimeZoneHelperThisComputer(); foreach (InstallationSummary installationSummary in installationSummaries) { InstallationSummaryDto dto = new InstallationSummaryDto(); dto.ApplicationName = installationSummary.ApplicationWithOverrideVariableGroup.ToString(); dto.Id = installationSummary.Id; dto.Result = installationSummary.InstallationResult.ToString(); dto.ServerName = installationSummary.ApplicationServer.Name; timeZoneHelper.SetStartAndEndTimes(installationSummary, dto); installationSummaryDtos.Add(dto); } return(installationSummaryDtos.OrderByDescending(x => x.InstallationStart)); }
public void SetStartAndEndTimes(InstallationSummary installationSummary, InstallationSummaryDto dto) { if (installationSummary == null) { throw new ArgumentNullException("installationSummary"); } if (dto == null) { throw new ArgumentNullException("dto"); } dto.InstallationStart = installationSummary.InstallationStartUtc; dto.InstallationEnd = installationSummary.InstallationEndUtc; }
public void SetStartAndEndTimes(InstallationSummary installationSummary, InstallationSummaryDto dto) { if (installationSummary == null) { throw new ArgumentNullException("installationSummary"); } if (dto == null) { throw new ArgumentNullException("dto"); } dto.InstallationStart = TimeZone.CurrentTimeZone.ToLocalTime(installationSummary.InstallationStartUtc); dto.InstallationEnd = TimeZone.CurrentTimeZone.ToLocalTime(installationSummary.InstallationEndUtc); }
public IEnumerable <InstallationSummaryDto> Get(AppAndServerAndOverrides appAndServerAndOverrides) { try { if (appAndServerAndOverrides.MaxResults <= 0) { appAndServerAndOverrides.MaxResults = _defaultInstallsToRetrieve; } var installationSummaries = GetInstallationSummaries(appAndServerAndOverrides); var installationSummaryDtos = new List <InstallationSummaryDto>(); // Just use this until we can give the user the flexibility to choose a different time zone. var timeZoneHelper = new TimeZoneHelperThisComputer(); foreach (InstallationSummary installationSummary in installationSummaries) { InstallationSummaryDto dto = new InstallationSummaryDto(); dto.ApplicationName = installationSummary.ApplicationWithOverrideVariableGroup.ToString(); dto.Id = installationSummary.Id; dto.Result = installationSummary.InstallationResult.ToString(); dto.ServerName = installationSummary.ApplicationServer.Name; dto.Environment = installationSummary.ApplicationServer.InstallationEnvironment.ToString(); dto.TaskDetails = installationSummary.TaskDetails; timeZoneHelper.SetStartAndEndTimes(installationSummary, dto); installationSummaryDtos.Add(dto); } return(installationSummaryDtos.OrderByDescending(x => x.InstallationStart)); } catch (Exception ex) { Logger.LogException(ex); throw Helper.CreateHttpResponseException(ex, "Error Getting Installations"); } }
private void SetInstallationSummaryDtos() { if (this.InstallationSummaryList == null || this.InstallationSummaryList.Count < 1) { return; } List <InstallationSummaryDto> installationSummaryDtos = new List <InstallationSummaryDto>(); foreach (InstallationSummary installationSummary in this.InstallationSummaryList) { InstallationSummaryDto dto = new InstallationSummaryDto(); try { dto.ApplicationName = installationSummary.ApplicationWithOverrideVariableGroup.ToString(); dto.Id = installationSummary.Id; dto.Result = installationSummary.InstallationResult.ToString(); dto.ServerName = installationSummary.ApplicationServer == null ? "(unavailable)" : installationSummary.ApplicationServer.Name; } catch (NullReferenceException ex) { // This is here because we sometimes get this exception. Let's see if we can find out why... // Log everything we can about this installation summary. SendEmailWithInstallationSummaryProperties(installationSummary); CommonUtility.ProcessException(ex); continue; // Skip this installation summary; something is wrong with it. } this.SelectedTimeZoneHelper.SetStartAndEndTimes(installationSummary, dto); installationSummaryDtos.Add(dto); } this.InstallationSummaryDtos = installationSummaryDtos.OrderByDescending(x => x.InstallationStart).ToList(); }