コード例 #1
0
            private UpsertCourseUploadRowsRecord CreateRecord(
                Guid courseId,
                Guid courseRunId,
                string learnAimRef,
                string whoThisCourseIsFor,
                string entryRequirements,
                string whatYouWillLearn,
                string howYouWillLearn,
                string whatYouWillNeedToBring,
                string howYouWillBeAssessed,
                string whereNext,
                string courseName,
                string providerCourseRef,
                string deliveryMode,
                string startDate,
                string flexibleStartDate,
                string venueName,
                string providerVenueRef,
                string nationalDelivery,
                string subRegions,
                string courseWebpage,
                string cost,
                string costDescription,
                string duration,
                string durationUnit,
                string studyMode,
                string attendancePattern,
                Guid?venueId,
                IEnumerable <string> errors = null)
            {
                var errorsArray = errors?.ToArray() ?? Array.Empty <string>();
                var isValid     = !errorsArray.Any();

                return(new UpsertCourseUploadRowsRecord()
                {
                    RowNumber = _records.Count + 2,
                    IsValid = isValid,
                    Errors = errorsArray,
                    CourseId = courseId,
                    CourseRunId = courseRunId,
                    LearnAimRef = learnAimRef,
                    WhoThisCourseIsFor = whoThisCourseIsFor,
                    EntryRequirements = entryRequirements,
                    WhatYouWillLearn = whatYouWillLearn,
                    HowYouWillLearn = howYouWillLearn,
                    WhatYouWillNeedToBring = whatYouWillNeedToBring,
                    HowYouWillBeAssessed = howYouWillBeAssessed,
                    WhereNext = whereNext,
                    CourseName = courseName,
                    ProviderCourseRef = providerCourseRef,
                    DeliveryMode = deliveryMode,
                    StartDate = startDate,
                    FlexibleStartDate = flexibleStartDate,
                    VenueName = venueName,
                    ProviderVenueRef = providerVenueRef,
                    NationalDelivery = nationalDelivery,
                    SubRegions = subRegions,
                    CourseWebpage = courseWebpage,
                    Cost = cost,
                    CostDescription = costDescription,
                    Duration = duration,
                    DurationUnit = durationUnit,
                    StudyMode = studyMode,
                    AttendancePattern = attendancePattern,
                    VenueId = venueId,
                    ResolvedDeliveryMode = ParsedCsvCourseRow.ResolveDeliveryMode(deliveryMode),
                    ResolvedStartDate = ParsedCsvCourseRow.ResolveStartDate(startDate),
                    ResolvedFlexibleStartDate = ParsedCsvCourseRow.ResolveFlexibleStartDate(flexibleStartDate),
                    ResolvedNationalDelivery = ParsedCsvCourseRow.ResolveNationalDelivery(nationalDelivery, subRegions),
                    ResolvedCost = ParsedCsvCourseRow.ResolveCost(cost),
                    ResolvedDuration = ParsedCsvCourseRow.ResolveDuration(duration),
                    ResolvedDurationUnit = ParsedCsvCourseRow.ResolveDurationUnit(durationUnit),
                    ResolvedStudyMode = ParsedCsvCourseRow.ResolveStudyMode(studyMode),
                    ResolvedAttendancePattern = ParsedCsvCourseRow.ResolveAttendancePattern(attendancePattern),
                    ResolvedSubRegions = ParsedCsvCourseRow.ResolveSubRegions(subRegions, _allRegions)?.Select(r => r.Id)
                });
            }