コード例 #1
0
        /// <summary>
        /// Function to save release details.
        /// </summary>
        /// <param name="releaseCalendar">Release information</param>
        /// <param name="artifacts">List of artifacts</param>
        /// <param name="subprojects">List of sub project</param>
        /// <param name="developerId">Developer id</param>
        /// <param name="oldProjectId">The old project identifier.</param>
        public void InsertOrUpdate(ReleaseCalendar releaseCalendar, IList<ArtifactFillListItem> artifacts, IList<ProjectFillItem> subprojects, int developerId, int oldProjectId)
        {
            if (releaseCalendar == null)
            {
                throw new ArgumentNullException(ReleaseCalendarConst);
            }

            releaseCalendar.ModifiedByDeveloperID = developerId;

            if (artifacts != null)
            {
                releaseCalendar.ProjectArtifacts = artifacts.RetrieveAddedOrDeleted().Select(item => item.MapToReleaseArtifact(releaseCalendar)).ToList();
                if (releaseCalendar.ReleaseCalendarID != default(int) && releaseCalendar.ProjectID != oldProjectId)
                {
                    releaseCalendar.ProjectArtifacts = (from actualArtifact in this.projectArtifactService.RetrieveProjectArtifactByReleaseCalendarId(releaseCalendar.ReleaseCalendarID)
                                                        from artifact in artifacts.RetrieveModified()
                                                        where actualArtifact.ProjectArtifactID == artifact.ProjectArtifactID
                                                        select actualArtifact.RetrieveUpdatedArtifact(releaseCalendar)).Concat(releaseCalendar.ProjectArtifacts).ToList();
                }
            }

            if (subprojects != null)
            {
                subprojects = subprojects.Where(item => (item.LinkId <= 0 && item.IsSelected)
                    || (item.LinkId > 0 && !item.IsSelected)).ToList();
                releaseCalendar.ReleaseSubProjects = subprojects.Select(item => item.MapToReleaseSubproject(releaseCalendar)).ToList();
            }

            this.releaseRepository.InsertOrUpdate(releaseCalendar);
            this.unitOfWork.Save();
            if (releaseCalendar.ProjectID == oldProjectId)
            {
                this.UpdateDueDates(releaseCalendar, artifacts, developerId);
            }
        }
コード例 #2
0
 /// <summary>
 /// Updates the due dates.
 /// </summary>
 /// <param name="releaseCalendar">The release calendar.</param>
 /// <param name="artifacts">The artifacts.</param>
 /// <param name="developerId">The developer identifier.</param>
 private void UpdateDueDates(ReleaseCalendar releaseCalendar, IList<ArtifactFillListItem> artifacts, int developerId)
 {
     var modifiedIds = artifacts.Except(artifacts.RetrieveAddedOrDeleted()).Where(a => a.IsSelected.Value).Select(a => a.ProjectArtifactID.Value).ToList();
     this.projectArtifactService.UpdateDueDate(modifiedIds, releaseCalendar.StartDate.Date, developerId);
 }
コード例 #3
0
        /// <summary>
        /// Saves the project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="artifacts">The artifact</param>
        /// <param name="developerId">The developerId.</param>
        public void InsertOrUpdate(Project project, IList<ArtifactFillListItem> artifacts, int developerId)
        {
            if (project == null)
            {
                throw new ArgumentNullException(ProjectConst);
            }

            project.ModifiedByDeveloperID = developerId;
            project.Name = !string.IsNullOrEmpty(project.Name) ? project.Name.Trim() : project.Name;

            if (artifacts != null)
            {
                project.ProjectArtifacts = artifacts.RetrieveAddedOrDeleted().Select(item => item.MapToProjectArtifact(project)).ToList();
            }

            this.projectRepository.InsertOrUpdate(project);
            this.unitOfWork.Save();
        }