Example #1
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case ApplicationEvents.Submitted e:
                Id             = new ApplicationId(e.Id);
                ApplicantId    = new ApplicantId(e.ApplicantId);
                VisaId         = new VisaId(e.VisaId);
                SubmissionDate = SubmissionDate.FromDateTimeOffset(e.SubmissionDate);
                Status         = ApplicationStatus.Submitted;
                break;

            case ApplicationEvents.AssignedToReviewer e:
                ReviewerId = new EmbassyEmployeeId(e.ReviewerId);
                Status     = ApplicationStatus.PendingForReview;
                break;

            case ApplicationEvents.DocumentAdded e:
                var document = new Uri(e.DocumentUrl);
                Documents.Add(document);
                break;

            case ApplicationEvents.ChangesRequested _:
                Status = ApplicationStatus.ChangesRequested;
                break;

            case ApplicationEvents.Approved _:
                Status = ApplicationStatus.Approved;
                break;
            }
        }
Example #2
0
 public Application(ApplicantId applicantId, VisaId visaId, SubmissionDate submissionDate)
 {
     Documents = new List <Uri>();
     Apply(new ApplicationEvents.Submitted
     {
         Id             = Guid.NewGuid(),
         ApplicantId    = applicantId,
         VisaId         = visaId,
         SubmissionDate = submissionDate ?? DateTimeOffset.Now
     });
 }