Exemple #1
0
        private static void MapJurisdictions(ThisEntity input, ref ThisEntityDetail output)
        {
            if (input.Jurisdiction != null && input.Jurisdiction.Any())
            {
                output.Jurisdiction = ServiceHelper.MapJurisdiction(input.Jurisdiction);
            }
            //return if no assertions
            if (input.JurisdictionAssertions == null || !input.JurisdictionAssertions.Any())
            {
                return;
            }
            //TODO - return all in a group or individual?
            //output.JurisdictionAssertion = ServiceHelper.MapJurisdiction( input.JurisdictionAssertions, "OfferedIn" );
            //OR

            var assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_AccreditedBy).ToList();

            if (assertedIn != null && assertedIn.Any())
            {
                output.AccreditedIn = ServiceHelper.MapJurisdiction(assertedIn, "AccreditedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_ApprovedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.ApprovedIn = ServiceHelper.MapJurisdiction(assertedIn, "ApprovedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_OFFERED_BY).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.OfferedIn = ServiceHelper.MapJurisdiction(assertedIn, "OfferedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RecognizedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RecognizedIn = ServiceHelper.MapJurisdiction(assertedIn, "RecognizedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RegulatedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RegulatedIn = ServiceHelper.MapJurisdiction(assertedIn, "RegulatedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RenewedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RenewedIn = ServiceHelper.MapJurisdiction(assertedIn, "RenewedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RevokedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RevokedIn = ServiceHelper.MapJurisdiction(assertedIn, "RevokedIn");
            }
        }
Exemple #2
0
        public void Credential(string id)
        {
            int           recordId      = 0;
            var           label         = "Credential";
            var           response      = new ApiResponse();
            var           entity        = new MD.CredentialDetail();
            bool          skippingCache = FormHelper.GetRequestKeyValue("skipCache", false);
            List <string> messages      = new List <string>();

            try
            {
                if (int.TryParse(id, out recordId))
                {
                    entity = API.CredentialServices.GetDetailForAPI(recordId, skippingCache);
                }
                else if (ServiceHelper.IsValidCtid(id, ref messages))
                {
                    entity = API.CredentialServices.GetDetailByCtidForAPI(id, skippingCache);
                }
                else
                {
                    messages.Add("ERROR - Invalid request. Either provide a CTID which starts with 'ce-' or the number. ");
                }
                //HttpContext.Server.ScriptTimeout = 300;

                if (entity.Meta_Id == 0)
                {
                    messages.Add(string.Format("ERROR - Invalid request - the {0} was not found. ", label));
                }

                if (messages.Any())
                {
                    response.Successful = false;
                    response.Messages.AddRange(messages);
                    SendResponse(response);
                }
                else
                {
                    ActivityServices.SiteActivityAdd("Credential", "View", "Detail", string.Format("User viewed Credential: {0} ({1})", entity.Name, entity.Meta_Id), 0, 0, recordId);

                    //string jsonoutput = JsonConvert.SerializeObject( entity, JsonHelper.GetJsonSettings() );
                    //SendResponse( jsonoutput );
                    response.Successful = true;
                    response.Result     = entity;
                    SendResponse(response);
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, "API-CredentialDetail. Id" + id);
                response.Messages.Add(string.Format("Error encountered returning data. {0} ", ex.Message));
                response.Successful = false;
                SendResponse(response);
            }
        }
Exemple #3
0
        private static void MapProcessProfiles(ThisEntity input, ref ThisEntityDetail output)
        {
            if (input.ProcessProfilesSummary != null && input.ProcessProfilesSummary.Any())
            {
                var url = string.Format("detail/ProcessProfile/{0}/", input.RowId.ToString());
                output.ProcessProfiles = new List <AJAXSettings>();
                foreach (var item in input.ProcessProfilesSummary)
                {
                    var ajax = new AJAXSettings()
                    {
                        Label       = item.Name,
                        Description = "",
                        Total       = item.Totals,
                        URL         = externalFinderSiteURL + url + item.Id.ToString(),
                        TestURL     = ServiceHelper.finderApiSiteURL + url + item.Id.ToString(),
                    };
                    //not sure we need this as part of the URL
                    var qd = new ProcessProfileAjax()
                    {
                        Id            = input.RowId.ToString(),
                        ProcessTypeId = item.Id,
                        //EndPoint = externalFinderSiteURL + url + item.Id.ToString()
                    };
                    ajax.QueryData = qd;

                    /*need to know
                     * endpoint: detail/processprofile
                     * id:		 input.RowId
                     * processProfileTypeId: item.Id?
                     *
                     */
                    //var filter = ( new MD.LabelLink()
                    //{
                    //	Label = item.Name,
                    //	Count = item.Totals,
                    //	URL = externalFinderSiteURL + url + item.Id.ToString()
                    //} );


                    output.ProcessProfiles.Add(ajax);
                }

                return;
            }

            //process profiles
            if (input.AdministrationProcess.Any())
            {
                output.AdministrationProcess = ServiceHelper.MapAJAXProcessProfile("Administration Process", "", input.AdministrationProcess);
            }
            if (input.AppealProcess.Any())
            {
                output.AppealProcess = ServiceHelper.MapAJAXProcessProfile("Appeal Process", "", input.AppealProcess);
            }
            if (input.ComplaintProcess.Any())
            {
                output.ComplaintProcess = ServiceHelper.MapAJAXProcessProfile("Complaint Process", "", input.ComplaintProcess);
            }
            if (input.DevelopmentProcess.Any())
            {
                output.DevelopmentProcess = ServiceHelper.MapAJAXProcessProfile("Development Process", "", input.DevelopmentProcess);
            }
            if (input.MaintenanceProcess.Any())
            {
                output.MaintenanceProcess = ServiceHelper.MapAJAXProcessProfile("Maintenance Process", "", input.MaintenanceProcess);
            }
            if (input.ReviewProcess.Any())
            {
                output.ReviewProcess = ServiceHelper.MapAJAXProcessProfile("Review Process", "", input.ReviewProcess);
            }
            if (input.RevocationProcess.Any())
            {
                output.RevocationProcess = ServiceHelper.MapAJAXProcessProfile("Revocation Process", "", input.RevocationProcess);
            }
        }
Exemple #4
0
        private static WMA.CredentialDetail MapToAPI(ThisEntity input)
        {
            var output = new WMA.CredentialDetail()
            {
                Meta_Id               = input.Id,
                CTID                  = input.CTID,
                Name                  = input.Name,
                Description           = input.Description,
                SubjectWebpage        = input.SubjectWebpage,
                EntityTypeId          = 1,
                CTDLTypeLabel         = input.CredentialType,
                CTDLType              = input.CredentialTypeSchema,
                CredentialRegistryURL = RegistryServices.GetResourceUrl(input.CTID),
                RegistryData          = ServiceHelper.FillRegistryData(input.CTID)
            };

            //
            //output.CTDLType = record.CredentialType; ;
            //output.AgentSectorType = ServiceHelper.MapPropertyLabelLinks( org.AgentSectorType, "organization" );
            output.FriendlyName  = HttpUtility.UrlPathEncode(input.Name);
            output.AlternateName = input.AlternateName;

            //owned by and offered by
            //need a label link for header
            if (input.OwningOrganizationId > 0)
            {
                output.OwnedByLabel = ServiceHelper.MapDetailLink("Organization", input.OrganizationName, input.OwningOrganizationId);
            }
            var work = ServiceHelper.MapOrganizationRoleProfileToOutline(input.OrganizationRole, Entity_AgentRelationshipManager.ROLE_TYPE_OWNER);

            output.OwnedBy = ServiceHelper.MapOutlineToAJAX(work, "");
            //
            work             = ServiceHelper.MapOrganizationRoleProfileToOutline(input.OrganizationRole, Entity_AgentRelationshipManager.ROLE_TYPE_OFFERED_BY);
            output.OfferedBy = ServiceHelper.MapOutlineToAJAX(work, "Offered by {0} Organization(s)");
            //

            //QA for owner,not offerer
            if (input.OwningOrganization != null && input.OwningOrganization.Id > 0)
            {
                if (input.OwningOrganization.OrganizationRole_Recipient != null && input.OwningOrganization.OrganizationRole_Recipient.Any())
                {
                    output.OwnerQAReceived = ServiceHelper.MapQAReceived(input.OwningOrganization.OrganizationRole_Recipient, searchType);
                }
                //var inheritedRoles = SetupRoles( roleSet.ActingAgent.OrganizationRole_Recipient, loadedAgentIDs );
                //wrapper.QAFromOwner = inheritedRoles.QADirect;
            }
            //
            output.Meta_LastUpdated = input.EntityLastUpdated;
            output.Meta_StateId     = input.EntityStateId;
            output.EntityTypeId     = input.EntityTypeId;
            if (input.InLanguageCodeList != null && input.InLanguageCodeList.Any())
            {
                //output.Meta_Language = input.InLanguageCodeList[ 0 ].TextTitle;
                output.InLanguage = new List <string>();
                foreach (var item in input.InLanguageCodeList)
                {
                    output.InLanguage.Add(item.TextTitle);
                }
            }
            try
            {
                if (input.HasVerificationType_Badge)
                {
                    output.CTDLTypeLabel += " + Badge Issued";
                }
                output.Image = input.Image;
                //
                if (!string.IsNullOrWhiteSpace(input.AvailabilityListing))
                {
                    output.AvailabilityListing = new List <string>()
                    {
                        input.AvailabilityListing
                    }
                }
                ;
                if (!string.IsNullOrWhiteSpace(input.AvailableOnlineAt))
                {
                    output.AvailableOnlineAt = new List <string>()
                    {
                        input.AvailableOnlineAt
                    }
                }
                ;

                if (input.CopyrightHolderOrganization != null && input.CopyrightHolderOrganization.Any())
                {
                    output.CopyrightHolder = new List <WMA.Outline>();
                    //output.CopyrightHolder2 = new List<WMA.LabelLink>();
                    foreach (var target in input.CopyrightHolderOrganization)
                    {
                        if (target != null && target.Id > 0)
                        {
                            //TODO - add overload to only get minimum data - like Link
                            output.CopyrightHolder.Add(ServiceHelper.MapToOutline(target, "organization"));

                            //var link = ServiceHelper.MapDetailLink( "organization", target.Name, target.Id );
                            //output.CopyrightHolder2.Add( link );
                        }
                    }
                    //or Link objects
                }

                output.CredentialStatusType = ServiceHelper.MapPropertyLabelLink(input.CredentialStatusType, searchType);
                output.CredentialType       = ServiceHelper.MapPropertyLabelLink(input.CredentialTypeEnum, searchType);

                output.DateEffective     = input.DateEffective;
                output.ExpirationDate    = input.ExpirationDate;
                output.EstimatedDuration = ServiceHelper.MapDurationProfiles(input.EstimatedDuration);
                output.RenewalFrequency  = ServiceHelper.MapDurationItem(input.RenewalFrequency);
                //
                if (input.DegreeConcentration != null && input.DegreeConcentration.Any())
                {
                    output.DegreeConcentration = ServiceHelper.MapPropertyLabelLinks(input.DegreeConcentration, searchType);
                }
                if (input.DegreeMajor != null && input.DegreeMajor.Any())
                {
                    output.DegreeMajor = ServiceHelper.MapPropertyLabelLinks(input.DegreeMajor, searchType);
                }
                if (input.DegreeMinor != null && input.DegreeMinor.Any())
                {
                    output.DegreeMinor = ServiceHelper.MapPropertyLabelLinks(input.DegreeMinor, searchType);
                }
                //
                if (input.EmbeddedCredentials != null && input.EmbeddedCredentials.Any())
                {
                    output.HasPart2 = new List <WMA.Outline>();
                    foreach (var target in input.EmbeddedCredentials)
                    {
                        if (target != null && !string.IsNullOrWhiteSpace(target.Name))
                        {
                            output.HasPart2.Add(ServiceHelper.MapToOutline(target, searchType));
                        }
                    }
                    output.HasPart  = ServiceHelper.MapOutlineToAJAX(output.HasPart2, "Includes {0} Credential(s)");
                    output.HasPart2 = null;
                }
                //
                if (input.IsPartOf != null && input.IsPartOf.Any())
                {
                    output.IsPartOf2 = new List <WMA.Outline>();
                    foreach (var target in input.IsPartOf)
                    {
                        if (target != null && !string.IsNullOrWhiteSpace(target.Name))
                        {
                            output.IsPartOf2.Add(ServiceHelper.MapToOutline(target, searchType));
                        }
                    }
                    output.IsPartOf  = ServiceHelper.MapOutlineToAJAX(output.IsPartOf2, "Is Part of {0} Credential(s)");
                    output.IsPartOf2 = null;
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, string.Format(thisClassName + ".MapToAPI. Section 1, Name: {0}, Id: [1}", input.Name, input.Id));
            }

            //addresses
            //MapAddress( input, ref output );
            output.AvailableAt = ServiceHelper.MapAddress(input.Addresses);

            //
            output.Image = input.Image;
            if (!string.IsNullOrWhiteSpace(input.CredentialTypeSchema))
            {
                output.Meta_Icon = WorkITSearchServices.GetCredentialIcon(input.CredentialTypeSchema.ToLower());
            }
            //
            output.IndustryType             = ServiceHelper.MapReferenceFrameworkLabelLink(input.IndustryType, searchType, CodesManager.PROPERTY_CATEGORY_NAICS);
            output.OccupationType           = ServiceHelper.MapReferenceFrameworkLabelLink(input.OccupationType, searchType, CodesManager.PROPERTY_CATEGORY_SOC);
            output.InstructionalProgramType = ServiceHelper.MapReferenceFrameworkLabelLink(input.InstructionalProgramType, searchType, CodesManager.PROPERTY_CATEGORY_CIP);
            //
            output.IsReferenceVersion = input.IsReferenceVersion;
            //
            if (input.Keyword != null && input.Keyword.Any())
            {
                output.Keyword = ServiceHelper.MapPropertyLabelLinks(input.Keyword, searchType);
            }
            if (input.Subject != null && input.Subject.Any())
            {
                output.Subject = ServiceHelper.MapPropertyLabelLinks(input.Subject, searchType);
            }
            //
            output.AssessmentDeliveryType = ServiceHelper.MapPropertyLabelLinks(input.AssessmentDeliveryType, searchType);
            output.AudienceLevelType      = ServiceHelper.MapPropertyLabelLinks(input.AudienceLevelType, searchType);
            output.AudienceType           = ServiceHelper.MapPropertyLabelLinks(input.AudienceType, searchType);
            output.LearningDeliveryType   = ServiceHelper.MapPropertyLabelLinks(input.LearningDeliveryType, searchType);

            //
            //condition profiles
            try
            {
                output.Corequisite = ServiceHelper.MapToConditionProfiles(input.Corequisite, searchType);
                output.Recommends  = ServiceHelper.MapToConditionProfiles(input.Recommends, searchType);
                output.Renewal     = ServiceHelper.MapToConditionProfiles(input.Renewal, searchType);
                output.Requires    = ServiceHelper.MapToConditionProfiles(input.Requires, searchType);
                if (input.CommonConditions != null && input.CommonConditions.Any())
                {
                    //these will likely just be mapped to specific conditions
                    output.CommonConditions = ServiceHelper.MapConditionManifests(input.CommonConditions, searchType);
                    if (output.CommonConditions != null && output.CommonConditions.Any())
                    {
                        foreach (var item in output.CommonConditions)
                        {
                            if (item.Requires != null && item.Requires.Any())
                            {
                                output.Requires = AppendConditions(item.Requires, output.Requires);
                            }
                            if (item.Recommends != null && item.Recommends.Any())
                            {
                                output.Recommends = AppendConditions(item.Recommends, output.Recommends);
                            }
                            if (item.Corequisite != null && item.Corequisite.Any())
                            {
                                output.Corequisite = AppendConditions(item.Requires, output.Corequisite);
                            }
                            if (item.Renewal != null && item.Renewal.Any())
                            {
                                output.Renewal = AppendConditions(item.Renewal, output.Renewal);
                            }
                        }
                    }
                }
                //connection profiles
                if (input.CredentialConnections != null && input.CredentialConnections.Any())
                {
                    //var list = input.CredentialConnections.Where( s => s.ConditionSubTypeId == 2 && s.ConnectionProfileTypeId == Entity_ConditionProfileManager.ConnectionProfileType_AdvancedStandingFor ).ToList();
                    //foreach ( var item in input.CredentialConnections )
                    //{
                    //	//some default for 1??
                    //	if ( item.ConditionSubTypeId == 2 && item.ConnectionProfileTypeId == Entity_ConditionProfileManager.ConnectionProfileType_AdvancedStandingFor )
                    //		input.IsAdvancedStandingFor.Add( item );
                    //	else if ( item.ConditionSubTypeId == 2 && item.ConnectionProfileTypeId == Entity_ConditionProfileManager.ConnectionProfileType_AdvancedStandingFrom )
                    //		input.AdvancedStandingFrom.Add( item );
                    //	else if ( item.ConditionSubTypeId == 2 && item.ConnectionProfileTypeId == Entity_ConditionProfileManager.ConnectionProfileType_PreparationFor )
                    //		input.IsPreparationFor.Add( item );
                    //	else if ( item.ConditionSubTypeId == 2 && item.ConnectionProfileTypeId == Entity_ConditionProfileManager.ConnectionProfileType_PreparationFrom )
                    //		input.PreparationFrom.Add( item );
                    //	{
                    //		//????;
                    //	}


                    //}
                }
                output.AdvancedStandingFrom  = ServiceHelper.MapToConditionProfiles(input.AdvancedStandingFrom, searchType);
                output.IsAdvancedStandingFor = ServiceHelper.MapToConditionProfiles(input.IsAdvancedStandingFor, searchType);
                //
                output.PreparationFrom  = ServiceHelper.MapToConditionProfiles(input.PreparationFrom, searchType);
                output.IsPreparationFor = ServiceHelper.MapToConditionProfiles(input.IsPreparationFor, searchType);
                //
                output.IsRequiredFor    = ServiceHelper.MapToConditionProfiles(input.IsRequiredFor, searchType);
                output.IsRecommendedFor = ServiceHelper.MapToConditionProfiles(input.IsRecommendedFor, searchType);
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, string.Format(thisClassName + ".MapToAPI. Section 2, Name: {0}, Id: [1}", input.Name, input.Id));
            }
            //====================================
            //the following can be made a common method
            var dataMergedRequirements    = new MergedConditions();
            var dataMergedRecommendations = new MergedConditions();
            var dataConnections           = new ConnectionData();

            ServiceHelper.GetAllChildren(dataMergedRequirements, dataMergedRecommendations, dataConnections, input, null, null);
            //now pull out estimated durations
            if (dataMergedRequirements.TargetCredential != null && dataMergedRequirements.TargetCredential.Any())
            {
                output.CredentialEstimatedDuration = ServiceHelper.GetAllDurations(dataMergedRequirements.CredentialsSansSelf(input.Id), "Estimated Time to Complete Required Embedded Credentials");
            }
            if (dataMergedRequirements.TargetAssessment != null && dataMergedRequirements.TargetAssessment.Any())
            {
                //output.AssessmentEstimatedDuration = ServiceHelper.GetAllDurationsOLD( dataMergedRequirements.TargetAssessment, "Estimated Time to Complete Required Assessments" );
                output.AssessmentEstimatedDuration = ServiceHelper.GetAllDurations(dataMergedRequirements.TargetAssessment, "Estimated Time to Complete Required Assessments");
            }
            if (dataMergedRequirements.TargetLearningOpportunity != null && dataMergedRequirements.TargetLearningOpportunity.Any())
            {
                output.LearningOpportunityEstimatedDuration = ServiceHelper.GetAllDurations(dataMergedRequirements.TargetLearningOpportunity, "Estimated Time to Complete Required Learning Opportunities");
            }


            //competencies
            var dataAllCompetencies = ServiceHelper.GetAllCompetencies(dataMergedRequirements);

            var allCompetencies = dataAllCompetencies.RequiresByFramework
                                  .Concat(dataAllCompetencies.AssessesByFramework)
                                  .Concat(dataAllCompetencies.TeachesByFramework)
                                  .ToList();
            var allFrameWorks = new Dictionary <string, List <string> >();

            foreach (var frameWork in allCompetencies)
            {
                if (!string.IsNullOrWhiteSpace(frameWork.CaSSViewerUrl) && !allFrameWorks.ContainsKey(frameWork.CaSSViewerUrl ?? ""))
                {
                    allFrameWorks.Add(frameWork.CaSSViewerUrl, frameWork.Items.Select(m => m.TargetNode).ToList());
                }
            }
            var frameworkGraphs = new List <string>();

            foreach (var framework in allCompetencies)
            {
                var uri = (framework.FrameworkUri ?? "").Replace("/resources/", "/graph/");
                if (framework.IsARegistryFrameworkUrl && framework.ExistsInRegistry)
                {
                    var frameworkData = RegistryServices.GetRegistryData("", uri);
                    if (!string.IsNullOrWhiteSpace(frameworkData) && frameworkData.IndexOf("<") != 0)                           //Avoid empty results and results like "<h2>Incomplete response received from application</h2>"
                    {
                        frameworkGraphs.Add(frameworkData);
                    }
                }
            }

            if (dataAllCompetencies.RequiresByFramework.Count() > 0)
            {
            }
            if (dataAllCompetencies.AssessesByFramework.Count() > 0)
            {
            }
            if (dataAllCompetencies.TeachesByFramework.Count() > 0)
            {
            }
            //=======================================
            try
            {
                //
                if (input.CommonCosts != null && input.CommonCosts.Any())
                {
                    output.CommonCosts   = ServiceHelper.MapCostManifests(input.CommonCosts, searchType);
                    output.EstimatedCost = new List <Models.Elastic.CostProfile>();
                    foreach (var item in output.CommonCosts)
                    {
                        output.EstimatedCost.AddRange(item.EstimatedCost);
                    }
                    output.CommonCosts = null;
                }

                if (input.EstimatedCost != null && input.EstimatedCost.Any())
                {
                    if (output.EstimatedCost == null)
                    {
                        output.EstimatedCost = new List <Models.Elastic.CostProfile>();
                    }

                    var estimatedCost = ServiceHelper.MapCostProfiles(input.EstimatedCost, searchType);
                    if (estimatedCost != null && estimatedCost.Any())
                    {
                        output.EstimatedCost.AddRange(estimatedCost);
                    }
                }
                //loop costs
                if (input.Requires.SelectMany(x => x.TargetLearningOpportunity.Where(y => y.EstimatedCost.Count() + y.CommonCosts.Count() > 0)).Count() > 0)
                {
                    var list = input.Requires.SelectMany(x => x.TargetLearningOpportunity).ToList();
                    foreach (var item in list)
                    {
                        if (item.CommonCosts.Any() || item.EstimatedCost.Any())
                        {
                            var commonCosts = ServiceHelper.MapCostManifests(item.CommonCosts, searchType);
                            output.LearningOpportunityCost = new List <Models.Elastic.CostProfile>();
                            if (commonCosts != null && commonCosts.Any())
                            {
                                foreach (var cc in commonCosts)
                                {
                                    output.LearningOpportunityCost.AddRange(cc.EstimatedCost);
                                }
                            }
                        }
                        //
                        if (item.EstimatedCost != null && item.EstimatedCost.Any())
                        {
                            if (output.LearningOpportunityCost == null)
                            {
                                output.LearningOpportunityCost = new List <Models.Elastic.CostProfile>();
                            }

                            var estimatedCost = ServiceHelper.MapCostProfiles(item.EstimatedCost, searchType);
                            if (estimatedCost != null && estimatedCost.Any())
                            {
                                output.LearningOpportunityCost.AddRange(estimatedCost);
                            }
                        }
                    }
                }
                //asmt costs
                if (input.Requires.SelectMany(x => x.TargetAssessment.Where(y => y.EstimatedCost.Count() + y.CommonCosts.Count() > 0)).Count() > 0)
                {
                    var list = input.Requires.SelectMany(x => x.TargetAssessment).ToList();
                    foreach (var item in list)
                    {
                        if (item.CommonCosts.Any() || item.EstimatedCost.Any())
                        {
                            var commonCosts = ServiceHelper.MapCostManifests(item.CommonCosts, searchType);
                            output.AssessmentCost = new List <Models.Elastic.CostProfile>();
                            if (commonCosts != null && commonCosts.Any())
                            {
                                foreach (var cc in commonCosts)
                                {
                                    output.AssessmentCost.AddRange(cc.EstimatedCost);
                                }
                            }
                        }
                        //
                        if (item.EstimatedCost.Any() || item.EstimatedCost.Any())
                        {
                            if (output.AssessmentCost == null)
                            {
                                output.AssessmentCost = new List <Models.Elastic.CostProfile>();
                            }

                            var estimatedCost = ServiceHelper.MapCostProfiles(item.EstimatedCost, searchType);
                            if (estimatedCost != null && estimatedCost.Any())
                            {
                                output.AssessmentCost.AddRange(estimatedCost);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, string.Format(thisClassName + ".MapToAPI. Section 3, Name: {0}, Id: [1}", input.Name, input.Id));
            }


            //
            if (input.FinancialAssistance != null && input.FinancialAssistance.Any())
            {
                output.FinancialAssistance = ServiceHelper.MapFinancialAssistanceProfiles(input.FinancialAssistance, searchType);
            }
            //
            output.CredentialId = input.CredentialId;
            output.ISICV4       = input.ISICV4;
            //InLanguage

            //
            output.Identifier = ServiceHelper.MapIdentifierValue(input.Identifier);
            //
            MapProcessProfiles(input, ref output);
            output.SameAs = ServiceHelper.MapTextValueProfileTextValue(input.SameAs);
            //
            //output.ProcessStandards = input.ProcessStandards;
            //output.ProcessStandardsDescription = input.ProcessStandardsDescription;
            output.ProcessStandards = ServiceHelper.MapPropertyLabelLink(input.ProcessStandards, "Process Standards", input.ProcessStandardsDescription);

            //
            output.Revocation = ServiceHelper.MapRevocationProfile(searchType, input.Revocation);

            //these are can be links to existing credentials, likely to be in finder
            output.LatestVersion   = ServiceHelper.MapPropertyLabelLink(input.LatestVersion, "Latest Version");
            output.NextVersion     = ServiceHelper.MapPropertyLabelLink(input.NextVersion, "Next Version");
            output.PreviousVersion = ServiceHelper.MapPropertyLabelLink(input.PreviousVersion, "Previous Version");
            output.Supersedes      = ServiceHelper.MapPropertyLabelLink(input.Supersedes, "Supersedes");
            output.SupersededBy    = ServiceHelper.MapPropertyLabelLink(input.SupersededBy, "Superseded By");
            //
            output.TargetPathway = ServiceHelper.MapPathwayToAJAXSettings(input.TargetPathway, "Has {0} Target Pathway(s)");

            //
            output.VersionIdentifier = ServiceHelper.MapIdentifierValue(input.VersionIdentifierList, "Version Identifier");
            try
            {
                MapJurisdictions(input, ref output);
                //
                //QA received
                //==> need to exclude 30-published by
                if (input.OrganizationRole.Any())
                {
                    output.QAReceived = ServiceHelper.MapQAReceived(input.OrganizationRole, searchType);
                    //old
                    var renewedBy2 = ServiceHelper.MapRoleReceived(input.OrganizationRole, searchType, Entity_AgentRelationshipManager.ROLE_TYPE_RenewedBy);
                    var revokedBy2 = ServiceHelper.MapRoleReceived(input.OrganizationRole, searchType, Entity_AgentRelationshipManager.ROLE_TYPE_RevokedBy);
                    //new
                    output.RenewedBy = ServiceHelper.MapOutlineToAJAX(renewedBy2, "Renewed by {0} Organization(s)");
                    output.RevokedBy = ServiceHelper.MapOutlineToAJAX(revokedBy2, "Revoked by {0} Organization(s)");
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, string.Format(thisClassName + ".MapToAPI. Section 4, Name: {0}, Id: [1}", input.Name, input.Id));
            }
            //



            //
            return(output);
        }