Esempio n. 1
0
            public static ProjectServiceTemplate Create(string name,
                                                        ConfigurationManagementService serviceCMSType,
                                                        CloudProviderService serviceCPSType,
                                                        string description,
                                                        string url,
                                                        string logo,
                                                        PipeType pipeType,
                                                        TemplateType templateType,
                                                        TemplateAccess templateAccess,
                                                        bool needCredentials,
                                                        Guid programmingLanguageId,
                                                        string framework,
                                                        string createdBy)
            {
                var entity = new ProjectServiceTemplate()
                {
                    Name                  = name,
                    ServiceCMSType        = serviceCMSType,
                    ServiceCPSType        = serviceCPSType,
                    Description           = description,
                    Url                   = url,
                    Logo                  = logo,
                    PipeType              = pipeType,
                    TemplateType          = templateType,
                    TemplateAccess        = templateAccess,
                    NeedCredentials       = needCredentials,
                    ProgrammingLanguageId = programmingLanguageId,
                    Framework             = framework,
                    CreatedBy             = createdBy
                };

                var validationResult = new DataValidatorManager <ProjectServiceTemplate>().Build().Validate(entity);

                if (!validationResult.IsValid)
                {
                    throw new ApplicationException(validationResult.Errors);
                }

                return(entity);
            }
Esempio n. 2
0
        public ProjectServiceTemplate AddProjectTemplateService(Guid organizationId, string name, ConfigurationManagementService serviceCMSType,
                                                                CloudProviderService serviceCPSType, string description, string url, string logo,
                                                                PipeType pipeType, TemplateType templateType, TemplateAccess templateAccess,
                                                                bool needCredentials,
                                                                Guid programmingLanguageId, string framework, ConfigurationManagementService cmsType, string accessId, string accessSecret, string accessToken,
                                                                List <ProjectServiceTemplateParameter> parameters)
        {
            Organization organization = FindOrganizationById(organizationId);

            if (organization == null)
            {
                throw new ApplicationException($"The organization with id {organizationId} does not exists");
            }

            var newOrganizationProjectServiceTemplate = ProjectServiceTemplate.Factory.Create(name, serviceCMSType, serviceCPSType, description, url, logo, pipeType, templateType, templateAccess, needCredentials, programmingLanguageId, framework, this.Id);

            newOrganizationProjectServiceTemplate.AddCredential(cmsType, needCredentials, accessId, accessSecret, accessToken);

            newOrganizationProjectServiceTemplate.AddParameters(parameters);
            newOrganizationProjectServiceTemplate.AddOrganization(organizationId);

            return(newOrganizationProjectServiceTemplate);
        }