/// <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); } }