Exemple #1
0
        /// <summary>
        /// Get verification service profiles on demand**********
        /// </summary>
        /// <param name="parentUid"></param>
        /// <returns></returns>
        public static List <WMA.VerificationServiceProfile> GetVerificationServiceProfiles(Guid parentUid)
        {
            var output = new List <WMA.VerificationServiceProfile>();
            //make a common method - then can pass parent to use for details
            var plist = Entity_VerificationProfileManager.GetAll(parentUid);

            if (plist != null && plist.Any())
            {
                foreach (var item in plist)
                {
                    WMA.VerificationServiceProfile vsp = new WMA.VerificationServiceProfile()
                    {
                        DateEffective                 = item.DateEffective,
                        Description                   = item.Description,
                        HolderMustAuthorize           = item.HolderMustAuthorize,
                        SubjectWebpage                = item.SubjectWebpage,
                        VerificationDirectory         = item.VerificationDirectory,
                        VerificationMethodDescription = item.VerificationMethodDescription,
                        VerificationService           = item.VerificationServiceUrl
                    };
                    if (item.Jurisdiction != null && item.Jurisdiction.Any())
                    {
                        vsp.Jurisdiction = ServiceHelper.MapJurisdiction(item.Jurisdiction);
                    }
                    if (item.Region != null && item.Region.Any())
                    {
                        vsp.Region = ServiceHelper.MapJurisdiction(item.Region);
                    }
                    //CostProfiles
                    if (item.EstimatedCost != null && item.EstimatedCost.Any())
                    {
                        vsp.EstimatedCost = ServiceHelper.MapCostProfiles(item.EstimatedCost, searchType);
                    }

                    //OfferredIn
                    if (item.JurisdictionAssertions != null && item.JurisdictionAssertions.Any())
                    {
                        vsp.OfferedIn = ServiceHelper.MapJurisdiction(item.JurisdictionAssertions, "OfferedIn");
                    }
                    //
                    if (item.OfferedByAgent != null && !string.IsNullOrWhiteSpace(item.OfferedByAgent.Name))
                    {
                        var ab = ServiceHelper.MapToOutline(item.OfferedByAgent, searchType);
                        vsp.OfferedBy = ServiceHelper.MapOutlineToAJAX(ab, "Offered by {0} Organization(s)");
                    }

                    vsp.VerifiedClaimType = ServiceHelper.MapPropertyLabelLinks(item.ClaimType, searchType, false);
                    if (item.TargetCredential != null && item.TargetCredential.Any())
                    {
                        vsp.TargetCredential = ServiceHelper.MapCredentialToAJAXSettings(item.TargetCredential, "Has {0} Target Credential(s)");
                        //vsp.TargetCredential = new List<TopLevelEntityReference>();
                        //foreach ( var target in item.TargetCredential )
                        //{
                        //	if ( target != null && !string.IsNullOrWhiteSpace( target.Name ) )
                        //		vsp.TargetCredential.Add( ServiceHelper.MapToEntityReference( target, "credential" ) );
                        //}
                        //vsp.TargetCredential = ServiceHelper.MapToEntityReference( item.TargetCredential );
                    }

                    output.Add(vsp);
                }
            }
            return(output);
        }
Exemple #2
0
        private static void MapVerificationServiceProfile(Organization org, ref WMA.OrganizationDetail output, OrganizationManager.OrganizationRequest request)
        {
            if (request.IncludingVerificationProfiles)
            {
                if (org.VerificationServiceProfiles == null || !org.VerificationServiceProfiles.Any())
                {
                    return;
                }

                output.HasVerificationServiceTemp = new List <WMA.VerificationServiceProfile>();
                foreach (var item in org.VerificationServiceProfiles)
                {
                    WMA.VerificationServiceProfile vsp = new WMA.VerificationServiceProfile()
                    {
                        DateEffective                 = item.DateEffective,
                        Description                   = item.Description,
                        HolderMustAuthorize           = item.HolderMustAuthorize,
                        SubjectWebpage                = item.SubjectWebpage,
                        VerificationDirectory         = item.VerificationDirectory,
                        VerificationMethodDescription = item.VerificationMethodDescription,
                        VerificationService           = item.VerificationServiceUrl
                    };
                    if (item.Jurisdiction != null && item.Jurisdiction.Any())
                    {
                        vsp.Jurisdiction = ServiceHelper.MapJurisdiction(item.Jurisdiction);
                    }
                    if (item.Region != null && item.Region.Any())
                    {
                        vsp.Region = ServiceHelper.MapJurisdiction(item.Region);
                    }
                    //CostProfiles
                    if (item.EstimatedCost != null && item.EstimatedCost.Any())
                    {
                        vsp.EstimatedCost = ServiceHelper.MapCostProfiles(item.EstimatedCost, searchType);
                    }

                    //OfferredIn
                    if (item.JurisdictionAssertions != null && item.JurisdictionAssertions.Any())
                    {
                        vsp.OfferedIn = ServiceHelper.MapJurisdiction(item.JurisdictionAssertions, "OfferedIn");
                    }
                    //
                    //if ( item.OfferedByAgent != null && !string.IsNullOrWhiteSpace( item.OfferedByAgent.Name ) )
                    //	vsp.OfferedBy = ServiceHelper.MapToEntityReference( item.OfferedByAgent, searchType );
                    //
                    if (item.OfferedByAgent != null && !string.IsNullOrWhiteSpace(item.OfferedByAgent.Name))
                    {
                        var ab = ServiceHelper.MapToOutline(item.OfferedByAgent, searchType);
                        vsp.OfferedBy = ServiceHelper.MapOutlineToAJAX(ab, "Offered by {0} Organization(s)");
                    }
                    vsp.VerifiedClaimType = ServiceHelper.MapPropertyLabelLinks(item.ClaimType, "organization", false);
                    if (item.TargetCredential != null && item.TargetCredential.Any())
                    {
                        vsp.TargetCredential = ServiceHelper.MapCredentialToAJAXSettings(item.TargetCredential, "Has {0} Target Credential(s)");
                        //vsp.TargetCredential = new List<TopLevelEntityReference>();
                        //foreach ( var target in item.TargetCredential )
                        //{
                        //	if ( target != null && !string.IsNullOrWhiteSpace( target.Name ) )
                        //		vsp.TargetCredential.Add( ServiceHelper.MapToEntityReference( target, "credential" ) );
                        //}
                        //vsp.TargetCredential = ServiceHelper.MapToEntityReference( item.TargetCredential );
                    }

                    output.HasVerificationServiceTemp.Add(vsp);
                }
                output.HasVerificationService = new AJAXSettings()
                {
                    //Type=null,
                    Label = string.Format("Has {0} Verification Service(s)", output.HasVerificationServiceTemp.Count()),
                    Total = output.HasVerificationServiceTemp.Count()
                };
                List <object> obj = output.HasVerificationServiceTemp.Select(f => ( object )f).ToList();
                output.HasVerificationService.Values = obj;
                output.HasVerificationServiceTemp    = null;
            }
            else if (org.VerificationServiceProfileCount > 0)
            {
                var url = string.Format("detail/VerificationService/{0}", org.RowId.ToString());
                output.HasVerificationService = new AJAXSettings();
                var ajax = new AJAXSettings()
                {
                    Label   = string.Format("Has {0} Verification Service(s)", org.HasCostManifest.Count()),
                    Total   = org.VerificationServiceProfileCount,
                    URL     = externalFinderSiteURL + url,
                    TestURL = ServiceHelper.finderApiSiteURL + url
                };
                //don't need this, as have the URL
                //var qd = new ProcessProfileAjax()
                //{
                //	Id = org.RowId.ToString(),
                //	//EndPoint = externalFinderSiteURL + url + item.Id.ToString()
                //};
                //ajax.QueryData = qd;
                output.HasVerificationService = ajax;
                //var filter = ( new WMA.LabelLink()
                //{
                //	Label = "Has Verification Service",
                //	Count = org.VerificationServiceProfileCount,
                //	URL = externalFinderSiteURL + url
                //} );
                //output.HasVerificationServiceSummary.Add( filter );

                //return;
            }
        }