コード例 #1
0
        /// <summary>
        /// Gets the master data asynchronous.
        /// </summary>
        /// <returns>The Master Data.</returns>
        public async Task<MasterData> RetrieveMasterDataAsync()
        {
            var masterData = new MasterData();
            var countryListTask = this.referenceDataRepository.ListCountryAsync();
            var personTypeListTask = this.referenceDataRepository.ListPersonTypeAsync();
            var documentTypeTask = this.referenceDataRepository.ListDocumentTypeAsync();
            var loyaltyTypesTask = this.referenceDataRepository.ListLoyaltyLevelTypeAsync();
            var shipTimeTask = this.shipTimeRepository.GetByIdAsync(this.applicationSettings.ShipId, null);
            var shipTask = this.shipRepository.GetByIdAsync(this.applicationSettings.ShipId, null, null);
            var voyageTask = this.voyageRepository.RetrieveVoyagesAsync(this.applicationSettings.ShipId);
            var visitorTypeTask = this.visitorRepository.ListVisitorTypeAsync();
            var visitPurposeTask = this.visitorRepository.ListVisitPurposeAsync();
            var deparmtentTask = this.visitorRepository.ListDepartmentsAsync();
            var crewDepartment = this.crewRepository.RetrieveCrewDepartmentsList();
            var alertTypes = this.alertRepository.ListAlertTypes();
            var gangwayLocations = this.shipRepository.RetrieveLocationsListAsync();
           
            masterData.AssignCountries((await countryListTask).Items);
            masterData.AssignPersonTypes((await personTypeListTask).Items);
            var documentTypes = await documentTypeTask;
            foreach (var documentType in documentTypes.Items)
            {
                masterData.IdTypes.Add(new IdType { IdTypeId = documentType.DocumentTypeId, Name = documentType.Name, CountryId = documentType.CountryId });
            }

            masterData.ShipTimeUtcOffset = await shipTimeTask;
            masterData.Ship = await shipTask;
            masterData.AssignVoyages(await this.MapVoyageData((await voyageTask).Items));
            masterData.AssignCrewDepartments((await crewDepartment).Items);
            masterData.AssignVisitorTypes((await visitorTypeTask).Items);
            masterData.AssignVisitPurposes((await visitPurposeTask).Items);
            masterData.AssignDepartments((await deparmtentTask).Items);
            masterData.AssignLoyaltyTypes((await loyaltyTypesTask).Items);
            masterData.AssignAlertTypes((await alertTypes).Items);
            masterData.AssignLocations((await gangwayLocations).Items);

            return masterData;
        }