コード例 #1
0
ファイル: PersonURL.cs プロジェクト: rmatam/ProfilesRNS_ORCID
        public new List <BO.ORCID.PersonURL> GetForORCIDUpdate(BO.ORCID.Person orcidPerson, long subjectID)
        {
            List <ProfilesRNSDLL.BO.ORCID.PersonURL> webSites = new List <ProfilesRNSDLL.BO.ORCID.PersonURL>();

            try
            {
                ProfilesRNSDLL.BO.ORNG.AppData appData = new ProfilesRNSDLL.BLL.ORNG.AppData().GetWebsites(subjectID);
                //value = [{"link_name":"Clinical and Translational Science Institute Leadership","link_url":"http://ctsi.bu.edu/index.php/about-us/leadership/"}, {"link_name":"My Google","link_url":"www.google.com"}]

                string webSitesJSON = appData.value;

                while (webSitesJSON.ToLower().Contains("\"link_name\""))
                {
                    BO.ORCID.PersonURL website = new BO.ORCID.PersonURL();
                    if (webSitesJSON.ToLower().IndexOf("\"link_name\"") < webSitesJSON.ToLower().IndexOf("\"link_url\""))
                    {
                        website.URLName = GetFieldValueFromJsonString(ref webSitesJSON, "link_name");
                        website.URL     = GetFieldValueFromJsonString(ref webSitesJSON, "link_url");
                    }
                    else
                    {
                        website.URL     = GetFieldValueFromJsonString(ref webSitesJSON, "link_url");
                        website.URLName = GetFieldValueFromJsonString(ref webSitesJSON, "link_name");
                    }
                    // Default to Public
                    website.DecisionID = (int)BO.ORCID.REFDecision.REFDecisions.Public;
                    webSites.Add(website);
                }
            }
            catch //(Exception ex)
            {
                // unable to get links from the Open Social.
                return(new List <ProfilesRNSDLL.BO.ORCID.PersonURL>());
            }

            // Get the list of processed affiliations
            List <ProfilesRNSDLL.BO.ORCID.PersonURL> processedWebsites = GetSuccessfullyProcessedURLs(orcidPerson.PersonID);

            // Get the affiliations that have not been processed
            return((from w in webSites where !processedWebsites.Any(pw => pw.URL == w.URL) select w).ToList());
        }
コード例 #2
0
        public new List<BO.ORCID.PersonURL> GetForORCIDUpdate(BO.ORCID.Person orcidPerson, long subjectID)
        {
            List<ProfilesRNSDLL.BO.ORCID.PersonURL> webSites = new List<ProfilesRNSDLL.BO.ORCID.PersonURL>();
            try
            {
                ProfilesRNSDLL.BO.ORNG.AppData appData = new ProfilesRNSDLL.BLL.ORNG.AppData().GetWebsites(subjectID);
                //value = [{"link_name":"Clinical and Translational Science Institute Leadership","link_url":"http://ctsi.bu.edu/index.php/about-us/leadership/"}, {"link_name":"My Google","link_url":"www.google.com"}]

                string webSitesJSON = appData.value;

                while (webSitesJSON.ToLower().Contains("\"link_name\""))
                {
                    BO.ORCID.PersonURL website = new BO.ORCID.PersonURL();
                    if (webSitesJSON.ToLower().IndexOf("\"link_name\"") < webSitesJSON.ToLower().IndexOf("\"link_url\""))
                    {
                        website.URLName = GetFieldValueFromJsonString(ref webSitesJSON, "link_name");
                        website.URL = GetFieldValueFromJsonString(ref webSitesJSON, "link_url");
                    }
                    else
                    {
                        website.URL = GetFieldValueFromJsonString(ref webSitesJSON, "link_url");
                        website.URLName = GetFieldValueFromJsonString(ref webSitesJSON, "link_name");
                    }
                    // Default to Public
                    website.DecisionID = (int)BO.ORCID.REFDecision.REFDecisions.Public;
                    webSites.Add(website);
                }
            }
            catch //(Exception ex)
            {
                // unable to get links from the Open Social.
                return new List<ProfilesRNSDLL.BO.ORCID.PersonURL>();
            }

            // Get the list of processed affiliations
            List<ProfilesRNSDLL.BO.ORCID.PersonURL> processedWebsites = GetSuccessfullyProcessedURLs(orcidPerson.PersonID);

            // Get the affiliations that have not been processed
            return (from w in webSites where !processedWebsites.Any(pw => pw.URL == w.URL) select w).ToList();
        }