Esempio n. 1
0
        public Dictionary <string, string> MapOverlappingErrors(GetOverlappingApprenticeshipsQueryResponse overlappingErrors)
        {
            const string startDateKey = "StartDate";
            const string endDateKey   = "EndDate";

            var dict = new Dictionary <string, string>();

            foreach (var item in overlappingErrors.GetFirstOverlappingApprenticeships())
            {
                switch (item.ValidationFailReason)
                {
                case ValidationFailReason.OverlappingStartDate:
                    dict.AddIfNotExists(startDateKey, ValidationText.LearnStartDateOverlap.Text);
                    break;

                case ValidationFailReason.OverlappingEndDate:
                    dict.AddIfNotExists(endDateKey, ValidationText.LearnPlanEndDateOverlap.Text);
                    break;

                case ValidationFailReason.DateEmbrace:
                    dict.AddIfNotExists(startDateKey, ValidationText.LearnStartDateOverlap.Text);
                    dict.AddIfNotExists(endDateKey, ValidationText.LearnPlanEndDateOverlap.Text);
                    break;

                case ValidationFailReason.DateWithin:
                    dict.AddIfNotExists(startDateKey, ValidationText.LearnStartDateOverlap.Text);
                    dict.AddIfNotExists(endDateKey, ValidationText.LearnPlanEndDateOverlap.Text);
                    break;
                }
            }
            return(dict);
        }
Esempio n. 2
0
        public Dictionary <string, string> MapOverlappingErrors(GetOverlappingApprenticeshipsQueryResponse overlappingErrors)
        {
            var          dict      = new Dictionary <string, string>();
            const string StartText = "The start date is not valid";
            const string EndText   = "The end date is not valid";

            const string StartDateKey = "StartDateOverlap";
            const string EndDateKey   = "EndDateOverlap";


            foreach (var item in overlappingErrors.GetFirstOverlappingApprenticeships())
            {
                switch (item.ValidationFailReason)
                {
                case ValidationFailReason.OverlappingStartDate:
                    dict.AddIfNotExists(StartDateKey, StartText);
                    break;

                case ValidationFailReason.OverlappingEndDate:
                    dict.AddIfNotExists(EndDateKey, EndText);
                    break;

                case ValidationFailReason.DateEmbrace:
                    dict.AddIfNotExists(StartDateKey, StartText);
                    dict.AddIfNotExists(EndDateKey, EndText);
                    break;

                case ValidationFailReason.DateWithin:
                    dict.AddIfNotExists(StartDateKey, StartText);
                    dict.AddIfNotExists(EndDateKey, EndText);
                    break;
                }
            }
            return(dict);
        }
        public Dictionary <string, string> MapOverlappingErrors(GetOverlappingApprenticeshipsQueryResponse overlappingErrors)
        {
            var          dict      = new Dictionary <string, string>();
            const string startText = "The start date is not valid";
            const string endText   = "The end date is not valid";

            //todo: store against real StartDate and EndDate fields and handle in the same manner as employer comitments
            const string startDateKey = "StartDateOverlap";
            const string endDateKey   = "EndDateOverlap";

            foreach (var item in overlappingErrors.GetFirstOverlappingApprenticeships())
            {
                switch (item.ValidationFailReason)
                {
                case ValidationFailReason.OverlappingStartDate:
                    dict.AddIfNotExists(startDateKey, startText);
                    break;

                case ValidationFailReason.OverlappingEndDate:
                    dict.AddIfNotExists(endDateKey, endText);
                    break;

                case ValidationFailReason.DateEmbrace:
                    dict.AddIfNotExists(startDateKey, startText);
                    dict.AddIfNotExists(endDateKey, endText);
                    break;

                case ValidationFailReason.DateWithin:
                    dict.AddIfNotExists(startDateKey, startText);
                    dict.AddIfNotExists(endDateKey, endText);
                    break;
                }
            }
            return(dict);
        }
Esempio n. 4
0
        private IList <ApprenticeshipListItemViewModel> MapFrom(IEnumerable <Apprenticeship> apprenticeships, GetOverlappingApprenticeshipsQueryResponse overlaps)
        {
            var apprenticeViewModels = apprenticeships
                                       .Select(x => new ApprenticeshipListItemViewModel
            {
                HashedApprenticeshipId = HashingService.HashValue(x.Id),
                ApprenticeshipName     = x.ApprenticeshipName,
                ApprenticeDateOfBirth  = x.DateOfBirth,
                ULN           = x.ULN,
                CourseCode    = x.TrainingCode,
                CourseName    = x.TrainingName,
                StartDate     = x.StartDate,
                EndDate       = x.EndDate,
                Cost          = x.Cost,
                CanBeApproved = x.CanBeApproved,
                OverlappingApprenticeships = overlaps?.GetOverlappingApprenticeships(x.Id),
                OriginalStartDate          = x.OriginalStartDate
            }).ToList();

            return(apprenticeViewModels);
        }