Example #1
0
 public CandidateUserBuilder WithApplicationTemplate(ApplicationTemplate applicationTemplate)
 {
     _applicationTemplate = applicationTemplate;
     return(this);
 }
 public VacancyApplicationBuilder WithApplicationTemplate(ApplicationTemplate applicationTemplate)
 {
     _applicationTemplate = applicationTemplate;
     return(this);
 }
 private static ApprenticeshipApplicationDetail CreateApplicationDetail(
     Candidate candidate, ApprenticeshipVacancyDetail vacancyDetails, ApplicationStatuses applicationStatus, ApplicationTemplate applicationTemplate)
 {
     return(new ApprenticeshipApplicationDetail
     {
         EntityId = Guid.NewGuid(),
         Status = applicationStatus,
         DateCreated = DateTime.UtcNow,
         CandidateId = candidate.EntityId,
         CandidateDetails = Mapper.Map <RegistrationDetails, RegistrationDetails>(candidate.RegistrationDetails),
         VacancyStatus = vacancyDetails.VacancyStatus,
         Vacancy = new ApprenticeshipSummary
         {
             Id = vacancyDetails.Id,
             VacancyReference = vacancyDetails.VacancyReference,
             Title = vacancyDetails.Title,
             EmployerName = vacancyDetails.IsEmployerAnonymous ? vacancyDetails.AnonymousEmployerName : vacancyDetails.EmployerName,
             IsPositiveAboutDisability = vacancyDetails.IsPositiveAboutDisability,
             StartDate = vacancyDetails.StartDate,
             ClosingDate = vacancyDetails.ClosingDate,
             Description = vacancyDetails.IsEmployerAnonymous ? vacancyDetails.AnonymousAboutTheEmployer : vacancyDetails.EmployerDescription,
             NumberOfPositions = vacancyDetails.NumberOfPositions,
             Location = null, // NOTE: no equivalent in legacy vacancy details.
             VacancyLocationType = vacancyDetails.VacancyLocationType,
         },
         // Populate apprenticeshipApplication template with candidate's most recent information.
         CandidateInformation = applicationTemplate
     });
 }
Example #4
0
        private void ThreadWork(object state)
        {
            try
            {
                try
                {
                    using (new SessionScope(MetaManagerServices.GetSessionFactory(), MetaManagerServices.GetDomainInterceptor(), true, FlushMode.Never, true))
                    {
                        ((DataAccess.DomainInterceptor)MetaManagerServices.GetDomainInterceptor()).GetDataFromConfigurationManagement = true;

                        generateStartTime = DateTime.Now;

                        var selectedServices = (from id in (List <string>) state
                                                select modelService.GetDomainObject <Service>(Guid.Parse(id))).ToList();

                        // Get which business entities we need to generate depending on the selected services.
                        Dictionary <Guid, BusinessEntity> entityDictionary = new Dictionary <Guid, BusinessEntity>();

                        //Dictionary<Guid, IDomainObject> loadedObjects = new Dictionary<Guid, IDomainObject>();
                        List <Service> loadedServices = new List <Service>();

                        foreach (Service service in selectedServices)
                        {
                            //Service loadedService = (Service)loadedObjects[service.Id];
                            Service loadedService = modelService.GetDomainObject <Service>(service.Id);

                            loadedServices.Add(loadedService);

                            foreach (ServiceMethod method in loadedService.ServiceMethods)
                            {
                                if (method != null)
                                {
                                    if (!entityDictionary.ContainsKey(method.MappedToAction.BusinessEntity.Id))
                                    {
                                        entityDictionary.Add(method.MappedToAction.BusinessEntity.Id, method.MappedToAction.BusinessEntity);
                                    }
                                }
                            }
                        }

                        ApplicationTemplate template = new ApplicationTemplate();
                        template.entities           = entityDictionary.Values.ToList <BusinessEntity>();
                        template.services           = loadedServices;
                        template.solutionFileName   = Path.Combine(solutionPathTbx.Text, solutionNameTbx.Text + ".sln");
                        template.referenceDirectory = referencePathTbx.Text;
                        template.templateCallback   = CodeSmithTemplateCallback;

                        template.Render(TextWriter.Null);

                        UpdateStatusAndTime("Done!", 0, 0, 0);
                    }

                    string info = string.Format("Code generation complete.\r\n{0} files generated, {1} files written to disk", FileCacheManager.GetWrites(), FileCacheManager.GetWritesToDisk());


                    if (this.InvokeRequired)
                    {
                        this.Invoke(new System.Action(() =>
                        {
                            ShowGenerationResult.Show(this, "Generation Result", info, "Files written to disk", FileCacheManager.GetWrittenFilesToDisk());
                        })
                                    );
                    }
                    else
                    {
                        ShowGenerationResult.Show(this, "Generation Result", info, "Files written to disk", FileCacheManager.GetWrittenFilesToDisk());
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error in Codegeneration", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                ((DataAccess.DomainInterceptor)MetaManagerServices.GetDomainInterceptor()).GetDataFromConfigurationManagement = false;

                if (this.InvokeRequired)
                {
                    this.Invoke(new System.Action(() =>
                    {
                        Cursor.Current    = Cursors.Default;
                        pProgress.Visible = false;
                        EnableDisableButtons();
                    })
                                );
                }
                else
                {
                    Cursor.Current    = Cursors.Default;
                    pProgress.Visible = false;
                    EnableDisableButtons();
                }
            }
        }
 public CandidateBuilder(Guid candidateId)
 {
     _candidateId         = candidateId;
     _helpPreferences     = new HelpPreferences();
     _applicationTemplate = new ApplicationTemplate();
 }
Example #6
0
 protected ApplicationDetail()
 {
     CandidateDetails     = new RegistrationDetails();
     CandidateInformation = new ApplicationTemplate();
 }