Exemplo n.º 1
0
        /// <summary>
        /// Updates the counts.
        /// </summary>
        /// <param name="releaseItems">The release items.</param>
        /// <param name="releaseCounts">The release counts.</param>
        private static void UpdateCounts(ProjectReleaseTypeCollection releaseItems, IList<ReleaseCountListItem> releaseCounts)
        {
            if (releaseCounts != null)
            {
                releaseItems.ForEach(item => item.TotalCount = 0);
                releaseCounts.SelectMany(releaseCount =>
                         releaseItems.Where(releaseType => releaseType.Id == Convert.ToInt32(releaseCount.Enviornment, CultureInfo.CurrentCulture) && releaseCount.ReleaseCalendarCount.HasValue)

                         .Select(releaseType => releaseType.TotalCount = releaseType.TotalCount + releaseCount.ReleaseCalendarCount.Value).ToList()).ToList();

                var totalCount = releaseItems.Where(releaseType => releaseType.Id != 0).Sum(item => item.TotalCount);
                releaseItems.Where(releaseType => releaseType.Id == 0).ToList().ForEach(releaseType => releaseType.TotalCount = totalCount);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the dashboard release count.
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <param name="releaseList">The release list.</param>
        /// <returns>Environment's release count.</returns>
        public string GetDashboardReleaseCount(string environment, ProjectReleaseTypeCollection releaseList)
        {
            string releaseCount;
            switch (environment)
            {
                case AllReleasesShort:
                    return releaseCount = releaseList.Where(count => count.Name == AllReleasesShort).FirstOrDefault().TotalCount.ToString();
                    break;

                case InternalShort:
                    return releaseCount = releaseList.Where(count => count.ShortName == InternalShort).FirstOrDefault().TotalCount.ToString();
                    break;

                case ProductionShort:
                    return releaseCount = releaseList.Where(count => count.ShortName == ProductionShort).FirstOrDefault().TotalCount.ToString();
                    break;

                case UATShort:
                    return releaseCount = releaseList.Where(count => count.ShortName == UATShort).FirstOrDefault().TotalCount.ToString();
                    break;

                default:
                    return releaseCount = string.Empty;
                    break;
            }
        }