コード例 #1
0
        public Connects.Profiles.Service.DataContracts.PublicationMatchDetailList GetProfilePublicationMatchSummary(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            qd.Version = 2;

            Connects.Profiles.Service.DataContracts.PersonList pl = ProfileSearch(qd, isSecure);
            Connects.Profiles.Service.DataContracts.PublicationMatchDetailList pubMatch = new Connects.Profiles.Service.DataContracts.PublicationMatchDetailList();
            HashSet <string> searchPhraseDistinct      = new HashSet <string>();
            HashSet <string> publicationPhraseDistinct = new HashSet <string>();

            if (pl != null)
            {
                foreach (Connects.Profiles.Service.DataContracts.Publication pub in pl.Person[0].PublicationList)
                {
                    foreach (Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetail in pub.PublicationMatchDetailList)
                    {
                        Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetailStripped = new Connects.Profiles.Service.DataContracts.PublicationMatchDetail();
                        pubMatchDetailStripped.SearchPhrase = pubMatchDetail.SearchPhrase;

                        if (!searchPhraseDistinct.Contains(pubMatchDetail.SearchPhrase))
                        {
                            pubMatch.Add(pubMatchDetailStripped);

                            searchPhraseDistinct.Add(pubMatchDetail.SearchPhrase);
                        }

                        foreach (Connects.Profiles.Service.DataContracts.PublicationPhraseDetail pubPhraseDetail in pubMatchDetail.PublicationPhraseDetailList)
                        {
                            //PublicationPhraseDetail pubPhraseDetailStripped = new PublicationPhraseDetail();
                            //pubPhraseDetailStripped.PublicationPhrase = pubPhraseDetail.PublicationPhrase;

                            //PublicationMatchDetail pmd = pubMatch.Find(delegate(PublicationMatchDetail t) { return t.SearchPhrase == pubMatchDetail.SearchPhrase; });

                            //// Handle the structure
                            //if (!publicationPhraseDistinct.Contains(pubPhraseDetail.PublicationPhrase))
                            //{
                            //    if (pmd.PublicationPhraseDetailList == null)
                            //        pmd.PublicationPhraseDetailList = new PublicationPhraseDetailList();

                            //    pmd.PublicationPhraseDetailList.Add(pubPhraseDetailStripped);

                            //    publicationPhraseDistinct.Add(pubPhraseDetail.PublicationPhrase);
                            //}

                            //// Get the Phrase Measurements
                            //PublicationPhraseDetail ppd = pmd.PublicationPhraseDetailList.Find(delegate(PublicationPhraseDetail t) { return t.PublicationPhrase == pubPhraseDetail.PublicationPhrase; });
                            //ppd.PhraseMeasurements = pubPhraseDetail.PhraseMeasurements;

                            //if (ppd.PublicationList == null)
                            //    ppd.PublicationList = new PublicationList();
                            //ppd.PublicationList.Add(pub);
                            Connects.Profiles.Service.DataContracts.PublicationMatchDetail pmd = pubMatch.Find(delegate(Connects.Profiles.Service.DataContracts.PublicationMatchDetail t) { return(t.SearchPhrase == pubMatchDetail.SearchPhrase); });

                            if (pmd.PublicationPhraseDetailList == null)
                            {
                                pmd.PublicationPhraseDetailList = new Connects.Profiles.Service.DataContracts.PublicationPhraseDetailList();
                            }

                            pubPhraseDetail.Publication = pub;
                            pmd.PublicationPhraseDetailList.Add(pubPhraseDetail);
                        }
                    }
                }
            }

            // IEnumerable<PublicationMatchDetail> noduplicates = pubMatch.Distinct();

            return(pubMatch);
        }
コード例 #2
0
        public Connects.Profiles.Service.DataContracts.PublicationMatchDetailList GetProfilePublicationMatchSummary(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            qd.Version = 2;

            Connects.Profiles.Service.DataContracts.PersonList pl = ProfileSearch(qd, isSecure);
            Connects.Profiles.Service.DataContracts.PublicationMatchDetailList pubMatch = new Connects.Profiles.Service.DataContracts.PublicationMatchDetailList();
            HashSet<string> searchPhraseDistinct = new HashSet<string>();
            HashSet<string> publicationPhraseDistinct = new HashSet<string>();

            if (pl != null)
            {

                foreach (Connects.Profiles.Service.DataContracts.Publication pub in pl.Person[0].PublicationList)
                {

                    foreach (Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetail in pub.PublicationMatchDetailList)
                    {
                        Connects.Profiles.Service.DataContracts.PublicationMatchDetail pubMatchDetailStripped = new Connects.Profiles.Service.DataContracts.PublicationMatchDetail();
                        pubMatchDetailStripped.SearchPhrase = pubMatchDetail.SearchPhrase;

                        if (!searchPhraseDistinct.Contains(pubMatchDetail.SearchPhrase))
                        {
                            pubMatch.Add(pubMatchDetailStripped);

                            searchPhraseDistinct.Add(pubMatchDetail.SearchPhrase);
                        }

                        foreach (Connects.Profiles.Service.DataContracts.PublicationPhraseDetail pubPhraseDetail in pubMatchDetail.PublicationPhraseDetailList)
                        {

                            //PublicationPhraseDetail pubPhraseDetailStripped = new PublicationPhraseDetail();
                            //pubPhraseDetailStripped.PublicationPhrase = pubPhraseDetail.PublicationPhrase;

                            //PublicationMatchDetail pmd = pubMatch.Find(delegate(PublicationMatchDetail t) { return t.SearchPhrase == pubMatchDetail.SearchPhrase; });

                            //// Handle the structure
                            //if (!publicationPhraseDistinct.Contains(pubPhraseDetail.PublicationPhrase))
                            //{
                            //    if (pmd.PublicationPhraseDetailList == null)
                            //        pmd.PublicationPhraseDetailList = new PublicationPhraseDetailList();

                            //    pmd.PublicationPhraseDetailList.Add(pubPhraseDetailStripped);

                            //    publicationPhraseDistinct.Add(pubPhraseDetail.PublicationPhrase);
                            //}

                            //// Get the Phrase Measurements
                            //PublicationPhraseDetail ppd = pmd.PublicationPhraseDetailList.Find(delegate(PublicationPhraseDetail t) { return t.PublicationPhrase == pubPhraseDetail.PublicationPhrase; });
                            //ppd.PhraseMeasurements = pubPhraseDetail.PhraseMeasurements;

                            //if (ppd.PublicationList == null)
                            //    ppd.PublicationList = new PublicationList();
                            //ppd.PublicationList.Add(pub);
                            Connects.Profiles.Service.DataContracts.PublicationMatchDetail pmd = pubMatch.Find(delegate(Connects.Profiles.Service.DataContracts.PublicationMatchDetail t) { return t.SearchPhrase == pubMatchDetail.SearchPhrase; });

                            if (pmd.PublicationPhraseDetailList == null)
                                pmd.PublicationPhraseDetailList = new Connects.Profiles.Service.DataContracts.PublicationPhraseDetailList();

                            pubPhraseDetail.Publication = pub;
                            pmd.PublicationPhraseDetailList.Add(pubPhraseDetail);
                        }

                    }

                }

            }

            // IEnumerable<PublicationMatchDetail> noduplicates = pubMatch.Distinct();

            return pubMatch;
        }