Beispiel #1
0
        private void UpdateOrDeleteProjects()
        {
            foreach (Project existingProject in this.dataContext.ListExistingProjects())
            {
                ProjectVersion projectVersion = this.dataContext.GetProjectVersion(existingProject.Id);
                IProjectParser strategy       = this.strategies.FirstOrDefault(s => s.IsExists(existingProject.Guid));

                if (strategy == null)
                {
                    if (projectVersion != null)
                    {
                        projectVersion.IsDeleted = true;
                    }
                }
                else
                {
                    if (projectVersion == null)
                    {
                        projectVersion = this.dataContext.CreateProjectVersion(existingProject);
                    }

                    strategy.UpdateProjectVersion(projectVersion, existingProject.Guid);
                    projectVersion.IsDeleted = false;
                }
            }
        }