Пример #1
0
        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));
        }
Пример #2
0
        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");
            }
        }