private void DoCreatePackage(Guid uniqueClientId, string requesterIdentity, DeploymentInfo deploymentInfoDto, ProjectInfo projectInfo, string packageDirPath)
        {
            var deploymentTask =
                new CreateManualDeploymentPackageDeploymentTask(
                    ObjectFactory.Instance.CreateProjectInfoRepository(),
                    ObjectFactory.Instance.CreateEnvironmentInfoRepository(),
                    ObjectFactory.Instance.CreateArtifactsRepository(),
                    ObjectFactory.Instance.CreateDirectoryAdapter(),
                    ObjectFactory.Instance.CreateFileAdapter(),
                    ObjectFactory.Instance.CreateZipFileAdapter(),
                    packageDirPath);

            Core.Domain.DeploymentInfo deploymentInfo =
                DtoMapper.ConvertDeploymentInfo(deploymentInfoDto, projectInfo);

            StartTask(deploymentTask, uniqueClientId, requesterIdentity, deploymentInfo);
        }
        private ProjectConfigurationBuild GetLatestSuccessfulBuild(string projectName, string projectConfigurationName)
        {
            Guard.NotNullNorEmpty(projectName, "projectName");
            Guard.NotNullNorEmpty(projectConfigurationName, "projectConfigurationName");

            ProjectInfo projectInfo = _projectInfoRepository.FindByName(projectName);

            TeamCityBuildType teamCityBuildType = _teamCityClient.GetBuildTypes(projectInfo.ArtifactsRepositoryName).FirstOrDefault(x => x.Name == projectConfigurationName);

            if (teamCityBuildType == null)
            {
                return(null);
            }

            TeamCityBuild lastSuccessfulBuild = _teamCityClient.GetLastSuccessfulBuild(teamCityBuildType.Id);

            ProjectConfigurationBuild projectConfigurationOfLastBuild = DtoMapper.Map <TeamCityBuild, ProjectConfigurationBuild>(lastSuccessfulBuild);

            return(projectConfigurationOfLastBuild);
        }
        public void DeployAsync(Guid deploymentId, Guid uniqueClientId, string requesterIdentity, DeploymentInfo deploymentInfoDto)
        {
            try
            {
                Guard.NotEmpty(deploymentId, "deploymentId");
                Guard.NotEmpty(uniqueClientId, "uniqueClientId");
                Guard.NotNullNorEmpty(requesterIdentity, "requesterIdentity");
                Guard.NotNull(deploymentInfoDto, "deploymentInfo");

                ProjectInfo projectInfo =
                    _projectInfoRepository.FindByName(deploymentInfoDto.ProjectName);

                if (projectInfo == null)
                {
                    throw new FaultException <ProjectNotFoundFault>(new ProjectNotFoundFault {
                        ProjectName = deploymentInfoDto.ProjectName
                    });
                }

                Core.Domain.DeploymentInfo deploymentInfo = DtoMapper.ConvertDeploymentInfo(deploymentInfoDto, projectInfo);

                ThreadPool.QueueUserWorkItem(
                    state =>
                {
                    try
                    {
                        DoDeploy(uniqueClientId, requesterIdentity, deploymentInfo, projectInfo);
                    }
                    catch (Exception exc)
                    {
                        HandleDeploymentException(exc, uniqueClientId);
                    }
                });
            }
            catch (Exception exc)
            {
                HandleDeploymentException(exc, uniqueClientId);
            }
        }
 public void SetSelectedDbScriptsToRun(Guid deploymentId, Proxy.Dto.DbScriptsToRunSelection scriptsToRunSelection)
 {
     ScriptsToRunSelector.SetSelectedScriptsToRun(
         deploymentId,
         DtoMapper.Map <Proxy.Dto.DbScriptsToRunSelection, DbScriptsToRunSelection>(scriptsToRunSelection));
 }
        public void SetSelectedDependentProjectsToDeploy(Guid deploymentId, List <DependentProject> dependenciesToDeploy)
        {
            DependentProjectsToDeploySelection dependentProjectsToDeploySelection = new DependentProjectsToDeploySelection()
            {
                SelectedProjects = new List <Core.ExternalDataCollectors.DependentProjectsSelection.DependentProject>(DtoMapper.Map <List <Proxy.Dto.DependentProject>, List <Core.ExternalDataCollectors.DependentProjectsSelection.DependentProject> >(dependenciesToDeploy))
            };

            DependentProjectsToDeployWebSelector
            .SetSelectedProjectsToDeploy(deploymentId, dependentProjectsToDeploySelection);
        }