Ejemplo n.º 1
0
        /// <summary>
        /// Assigns the project release type counts.
        /// </summary>
        /// <param name="releaseItems">The release items.</param>
        /// <param name="userId">The user unique identifier.</param>
        private void AssignProjectReleaseTypeCounts(ProjectReleaseTypeCollection releaseItems, int userId)
        {
            IList<ReleaseCountListItem> releaseCounts = null;
            var startDate = DateTime.Now.Date;
            var endDate = startDate.AddDays(1).AddMinutes(-1);
            releaseCounts = this.releaseService.RetrieveReleaseCount(null, null, startDate, endDate, userId);

            UpdateCounts(releaseItems, releaseCounts);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Assigns the project release types.
        /// </summary>
        /// <param name="releaseItems">The release items.</param>
        /// <param name="userId">The user unique identifier.</param>
        /// <returns>Project release type collection.</returns>
        private ProjectReleaseTypeCollection AssignProjectReleaseTypes(IList<LookupItem> releaseItems, int userId)
        {
            ProjectReleaseTypeCollection environments = new ProjectReleaseTypeCollection();
            environments.Add(new ProjectReleaseType { Id = 0, Name = "All", IsSelected = "true" });

            releaseItems.Select(releaseType =>
            {
                var environment = new ProjectReleaseType { Id = releaseType.ID, Name = releaseType.Name, IsSelected = "false" };
                if (environment.Name == Internal)
                {
                    environment.ShortName = InternalShort;
                }
                else if (environment.Name == UAT)
                {
                    environment.ShortName = UATShort;
                }
                else if (environment.Name == Production)
                {
                    environment.ShortName = ProductionShort;
                }

                environments.Add(environment);
                return true;
            }).ToList();

            this.AssignProjectReleaseTypeCounts(environments, userId);
            return environments;
        }
Ejemplo n.º 4
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;
            }
        }