public ProfilesRNSDLL.BO.ORCID.Person GetPersonWithDBData(int profilePersonID, string sessionID) { BLL.Profile.Data.Person profilePersonBLL = new BLL.Profile.Data.Person(); BO.Profile.Data.Person profilePerson = profilePersonBLL.Get(profilePersonID); string internalUsername = profilePerson.InternalUsername; long profileSubjectID = profilePersonBLL.GetNodeId(internalUsername); ProfilesRNSDLL.BO.ORCID.Person orcidPerson = GetByInternalUsername(internalUsername); ProfilesRNSDLL.BO.ORCID.Narrative narrative = new ProfilesRNSDLL.BLL.RDF.Triple().GetNarrative(profileSubjectID); if (!string.IsNullOrEmpty(narrative.Overview) && !narrative.Overview.Trim().Equals(string.Empty)) { orcidPerson.Biography = narrative.Overview; if (!narrative.Decision.DecisionIDIsNull) { orcidPerson.BiographyDecisionID = narrative.Decision.DecisionID; } else { orcidPerson.BiographyDecisionID = (int)BO.ORCID.REFDecision.REFDecisions.Public; } } orcidPerson.Affiliations = new ProfilesRNSDLL.BLL.ORCID.PersonAffiliation().GetForORCIDUpdate(orcidPerson, profileSubjectID, profilePersonID); orcidPerson.URLs = new ProfilesRNSDLL.BLL.ORCID.PersonURL().GetForORCIDUpdate(orcidPerson, profileSubjectID); orcidPerson.Works = new ProfilesRNSDLL.BLL.ORCID.PersonWork().GetForORCIDUpdate(orcidPerson, profileSubjectID, sessionID); if (BO.ORCID.Config.UseMailinatorEmailAddressForTestingOnStagingEnvironment) { orcidPerson.EmailAddress = System.Text.RegularExpressions.Regex.Split(profilePerson.EmailAddr, "@")[0] + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("hhmmss") + "@mailinator.com"; } else { orcidPerson.EmailAddress = profilePerson.EmailAddr; } return(orcidPerson); }
public List <BO.ORCID.PersonWork> GetForORCIDUpdate(ProfilesRNSDLL.BO.ORCID.Person orcidPerson, long subject, string sessionID) { const string WORK_TYPE = "journal-article"; List <BO.ORCID.PersonWork> pubs = new List <BO.ORCID.PersonWork>(); ProfilesRNSDLL.BO.ORCID.REFDecision visibilityForPublications = GetPublicationVisibility(subject); foreach (System.Data.DataRow dr in base.GetPublications(subject, sessionID).Table.Rows) { BO.ORCID.PersonWork pub = new BO.ORCID.PersonWork(); if (!dr.IsNull("prns_informationResourceReference")) { pub.WorkCitation = dr["prns_informationResourceReference"].ToString(); } if (!dr.IsNull("prns_publicationDate")) { pub.PubDate = DateTime.Parse(dr["prns_publicationDate"].ToString()); } if (!dr.IsNull("EntityID")) { pub.PubID = dr["EntityID"].ToString(); } if (!dr.IsNull("bibo_pmid") && dr["bibo_pmid"].ToString().Trim().Equals(string.Empty)) { pub.PMID = int.Parse(dr["bibo_pmid"].ToString()); pub.DOI = ProfilesRNSDLL.BLL.ORCID.DOI.Get(pub.PMID.ToString()); AddIdentifier(pub, ProfilesRNSDLL.BO.ORCID.REFWorkExternalType.REFWorkExternalTypes.pmid, pub.PMID.ToString()); } else { pub.DOI = GetDOI(pub, "http://dx.doi.org/"); } if (pub.DOI != ProfilesRNSDLL.BLL.ORCID.DOI.DOI_NOT_FOUND_MESSAGE) { AddIdentifier(pub, ProfilesRNSDLL.BO.ORCID.REFWorkExternalType.REFWorkExternalTypes.doi, pub.DOI); } if (!dr.IsNull("URL")) { pub.URL = dr["URL"].ToString(); } if (!dr.IsNull("rdfs_label")) { pub.WorkTitle = dr["rdfs_label"].ToString(); } if (visibilityForPublications.Exists) { pub.DecisionID = visibilityForPublications.DecisionID; } pub.WorkType = WORK_TYPE; pubs.Add(pub); } // Get the list of processed pubs List <ProfilesRNSDLL.BO.ORCID.PersonWork> processedWorks = GetSuccessfullyProcessedWorks(orcidPerson.PersonID); // Get the pubmed pubs that haven't been processed. return((from p in pubs where !processedWorks.Any(pa => pa.PubID == p.PubID) select p).ToList()); }
public new ProfilesRNSDLL.BO.ORCID.Person GetByInternalUsername(string internalUsername) { ProfilesRNSDLL.BO.ORCID.Person person = base.GetByInternalUsername(internalUsername); // if no record for the person already exists in the database, we need to set the required fields. if (!person.Exists) { ProfilesRNSDLL.BO.Profile.Data.Person profilePerson = new BLL.Profile.Data.Person().GetByInternalUsername(internalUsername); person.InternalUsername = internalUsername; if (!profilePerson.FirstNameIsNull) { person.FirstName = profilePerson.FirstName; } if (!profilePerson.LastNameIsNull) { person.LastName = profilePerson.LastName; } if (!profilePerson.EmailAddrIsNull) { person.EmailAddress = profilePerson.EmailAddr; } person.CreateUnlessOptOut = false; person.PersonStatusTypeID = (int)ProfilesRNSDLL.BO.ORCID.REFPersonStatusType.REFPersonStatusTypes.Unknown; Add(person); person.Exists = true; } return(person); }
public List <ProfilesRNSDLL.BO.ORCID.PersonAffiliation> GetForORCIDUpdate(ProfilesRNSDLL.BO.ORCID.Person orcidPerson, long subject, int profileDataPersonID) { List <ProfilesRNSDLL.BO.ORCID.PersonAffiliation> affiliations = GetAffiliations(profileDataPersonID); // Get the list of processed affiliations List <ProfilesRNSDLL.BO.ORCID.PersonAffiliation> processedAffiliations = GetSuccessfullyProcessedAffiliations(orcidPerson.PersonID); // Get the affiliations that have not been processed return((from p in affiliations where !processedAffiliations.Any(pa => pa.AffiliationTypeID == p.AffiliationTypeID && pa.ProfilesID == p.ProfilesID) select p).ToList()); }