Ejemplo n.º 1
0
        private void UploadPendingData(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            // This method loads any pending interactions with ORCID.
            List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonMessage> personMessagesWaitingForApproval = GetPersonMessagesWaitingForApproval(person);

            if (personMessagesWaitingForApproval.Count > 0)
            {
                foreach (Utilities.ProfilesRNSDLL.BO.ORCID.PersonMessage personMessage in personMessagesWaitingForApproval)
                {
                    Utilities.ProfilesRNSDLL.BO.ORCID.REFPermission refPermission = REFPermissionBLL.Get(personMessage.PermissionID);
                    Utilities.ProfilesRNSDLL.BO.ORCID.PersonToken   personToken   = PersonTokenBLL.GetByPersonIDAndPermissionID(person.PersonID, personMessage.PermissionID);
                    if (!personToken.Exists || personToken.IsExpired)
                    {
                        // Go to ORCID and get a Token for this action.
                        Response.Redirect(Utilities.ProfilesRNSDLL.BLL.ORCID.OAuth.GetUserPermissionURL(refPermission.PermissionScope, "Default.aspx"), true);
                        return;
                    }

                    switch ((Utilities.ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions)personMessage.PermissionID)
                    {
                    case Utilities.ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions.orcid_profile_read_limited:
                    case Utilities.ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions.orcid_bio_read_limited:
                    case Utilities.ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions.orcid_works_read_limited:
                        ORCIDBLL.ReadORCIDProfile(person, personMessage, refPermission, LoggedInInternalUsername);
                        break;

                    default:
                        ORCIDBLL.SendORCIDXMLMessage(person, personToken.AccessToken, personMessage, refPermission);
                        break;
                    }
                }
            }
            LoadUserMessages(person);
        }
        private void LoadPublications(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            int defaultid = 0;
            List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonWork> pubs = person.Works;

            if (pubs.Count > 0)
            {
                divPublications.Visible = true;
            }
            else
            {
                divPublications.Visible = false;
            }

            if (pubs.Count > 0)
            {
                publicationsVisibility = pubs[0].DecisionID;
                this.PublicationMessageWhenORCIDExists.Visible = !GetPerson().ORCIDIsNull;
                rptPublications.DataSource = pubs;
                rptPublications.DataBind();
                defaultid = pubs[0].DecisionID;
            }

            if (defaultid > 0)
            {
                defaultid -= 1;
            }

            selPrivacy.Items[defaultid].Selected = true;
        }
Ejemplo n.º 3
0
 public Utilities.ProfilesRNSDLL.BO.ORCID.Person GetPersonWithPageData(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
 {
     GetBioFromThePage(person);
     GetWorksFromThePage(person);
     GetAffiliationsFromThePage(person);
     return(person);
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Utilities.ProfilesRNSDLL.BO.ORCID.Person person = GetPerson();
                    if (!HasError(person))
                    {
                        Dictionary <string, object> items = Utilities.ProfilesRNSDLL.BLL.ORCID.OAuth.GetUserAccessTokenItems(OAuthCode, "ProcessRead-LimitedAuthCode.aspx", person.InternalUsername);
                        string orcid = items["orcid"].ToString();

                        if (!person.Exists)
                        {
                            throw new Utilities.ProfilesRNSDLL.DevelopmentBase.BO.ExceptionSafeToDisplay("This ORCID has not been recorded in the " +
                                                                                                         Profiles.ORCID.Utilities.config.OrganizationName + " ORCID database.");
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(OAuthCode))
                            {
                                new Utilities.ProfilesRNSDLL.BLL.ORCID.PersonToken().UpdateUserToken(items, person, person.InternalUsername);
                            }
                            Response.Redirect(person.ORCIDUrl, false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Ejemplo n.º 5
0
 protected void DrawProfilesModule()
 {
     Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = GetPersonWithDBData(Convert.ToInt32(Request.QueryString["subject"]));
     LoadURLs(orcidPerson);
     LoadBIO(orcidPerson);
     LoadAffiliations(orcidPerson);
     LoadPublications(orcidPerson);
 }
Ejemplo n.º 6
0
        private void LoadUserMessages(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonMessage> messages = (from m in PersonMessageBLL.GetByPersonID(person.PersonID) where m.UserMessageIsNull == false orderby m.PostDate descending select m).ToList();

            divMessages.Visible    = messages.Count > 0;
            rptMessages.DataSource = messages;
            rptMessages.DataBind();
        }
Ejemplo n.º 7
0
 private void LoadURLs(Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson)
 {
     this.divWebsites.Visible = (orcidPerson.URLs.Count > 0);
     if (orcidPerson.URLs.Count > 0)
     {
         rptPersonURLs.DataSource = orcidPerson.URLs;
         rptPersonURLs.DataBind();
     }
 }
Ejemplo n.º 8
0
        private void ProcessError(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonMessage> personMessages = GetPersonMessagesWaitingForApproval(person);

            if (personMessages.Count > 0)
            {
                PersonMessageBLL.ProcessORCID_ResponseError(personMessages[0], ORCID_ResponseError, ORCID_ResponseErrorDescription);
            }
        }
Ejemplo n.º 9
0
 private void ProcessORCIDResponse(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
 {
     if (HasORCID_OAuthCode)
     {
         PersonTokenBLL.UpdateUserToken(OAuthCode, person, "Default.aspx", LoggedInInternalUsername);
     }
     else if (HasORCID_ResponseError)
     {
         ProcessError(person);
     }
 }
Ejemplo n.º 10
0
 private void LoadAffiliations(Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson)
 {
     //List<Utilities.ProfilesRNSDLL.BO.ORCID.PersonAffiliation> affiliations = Affiliations;
     divAffiliations.Visible = orcidPerson.Affiliations.Count > 0;
     if (orcidPerson.Affiliations.Count > 0)
     {
         this.AffiliationsMessageWhenORCIDExists.Visible = !orcidPerson.ORCIDIsNull;
         rptPersonAffiliations.DataSource = orcidPerson.Affiliations;
         rptPersonAffiliations.DataBind();
     }
 }
Ejemplo n.º 11
0
        private void GetWorksFromThePage(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            if (divPublications.Visible)
            {
                int          counter   = 0;
                const string WORK_TYPE = "journal-article";

                foreach (RepeaterItem ri in rptPublications.Items)
                {
                    counter += 1;
                    switch (ri.ItemType)
                    {
                    case ListItemType.Item:
                    case ListItemType.AlternatingItem:
                        // Get the controls for this item.
                        DropDownList ddlPubVis       = (DropDownList)ri.FindControl("ddlPubVis");
                        Label        lblCitation     = (Label)ri.FindControl("lblCitation");
                        Label        lblPubDate      = (Label)ri.FindControl("lblPubDate");
                        Label        lblPubID        = (Label)ri.FindControl("lblPubID");
                        Label        lblPMID         = (Label)ri.FindControl("lblPMID");
                        Label        lblDOI          = (Label)ri.FindControl("lblDOI");
                        Label        lblArticleTitle = (Label)ri.FindControl("lblArticleTitle");

                        // Pubdate is required.
                        if (!Utilities.ProfilesRNSDLL.DevelopmentBase.Helpers.Date.IsDate(lblPubDate.Text))
                        {
                            continue;
                        }
                        Utilities.ProfilesRNSDLL.BO.ORCID.PersonWork work = new Utilities.ProfilesRNSDLL.BO.ORCID.PersonWork();
                        work.DecisionID   = int.Parse(ddlPubVis.SelectedValue.ToString());
                        work.WorkCitation = lblCitation.Text;
                        work.PubDate      = DateTime.Parse(lblPubDate.Text);
                        work.WorkType     = WORK_TYPE;
                        work.PersonID     = person.PersonID;
                        work.PubID        = lblPubID.Text;
                        work.WorkTitle    = lblArticleTitle.Text;

                        // Add the identifiers
                        if (!lblPMID.Text.Trim().Equals(string.Empty))
                        {
                            Utilities.ProfilesRNSDLL.BLL.ORCID.PersonWork.AddIdentifier(work, Utilities.ProfilesRNSDLL.BO.ORCID.REFWorkExternalType.REFWorkExternalTypes.pmid, lblPMID.Text);
                        }
                        if (!lblDOI.Text.Equals(Utilities.ProfilesRNSDLL.BLL.ORCID.DOI.DOI_NOT_FOUND_MESSAGE))
                        {
                            Utilities.ProfilesRNSDLL.BLL.ORCID.PersonWork.AddIdentifier(work, Utilities.ProfilesRNSDLL.BO.ORCID.REFWorkExternalType.REFWorkExternalTypes.doi, lblDOI.Text);
                        }
                        person.Works.Add(work);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private void LoadPublications(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonWork> pubs = person.Works;

            divPublications.Visible = pubs.Count > 0;
            if (pubs.Count > 0)
            {
                publicationsVisibility = pubs[0].DecisionID;
                this.PublicationMessageWhenORCIDExists.Visible = !GetPerson().ORCIDIsNull;
                rptPublications.DataSource = pubs;
                rptPublications.DataBind();
            }
        }
Ejemplo n.º 13
0
        private void LoadBIO(Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPersonWithData)
        {
            if (!orcidPersonWithData.BiographyIsNull)
            {
                this.txtResearchExpertiseAndProfessionalInterests.Text = orcidPersonWithData.Biography;
                if (!orcidPersonWithData.BiographyDecisionIDIsNull)
                {
                    Utilities.ProfilesRNSDLL.DevelopmentBase.UICommon.SetValue(orcidPersonWithData.BiographyDecisionID.ToString(), false, this.ddlResearchExpertiseAndProfessionalInterestsVis);
                }
            }

            // Get what has been saved before
            Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = GetPerson();
            divResearchExpertiseAndProfessionalInterests.Visible = this.txtResearchExpertiseAndProfessionalInterests.Text.Length > 0 &&
                                                                   (orcidPerson.BiographyIsNull || orcidPerson.Biography != this.txtResearchExpertiseAndProfessionalInterests.Text);
        }
Ejemplo n.º 14
0
 private void GetAffiliationsFromThePage(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
 {
     if (divAffiliations.Visible)
     {
         int counter = 0;
         foreach (RepeaterItem ri in rptPersonAffiliations.Items)
         {
             switch (ri.ItemType)
             {
             case ListItemType.Item:
             case ListItemType.AlternatingItem:
                 counter += 1;
                 person.Affiliations.Add(GetAffiliationFromThePage(ri));
                 break;
             }
         }
     }
 }
        private bool HasError(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            string queryStringError            = Utilities.ProfilesRNSDLL.DevelopmentBase.Helpers.QueryString.GetQueryString("error");
            string queryStringErrorDescription = Utilities.ProfilesRNSDLL.DevelopmentBase.Helpers.QueryString.GetQueryString("error_description");
            bool   haserror = !queryStringError.Equals(string.Empty);

            if (haserror)
            {
                if (queryStringError == "access_denied")
                {
                    Response.Redirect(person.ORCIDUrl, false);
                }
                else
                {
                    throw new Utilities.ProfilesRNSDLL.DevelopmentBase.BO.ExceptionSafeToDisplay(queryStringError);
                }
            }
            return(haserror);
        }
Ejemplo n.º 16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Utilities.ProfilesRNSDLL.BO.ORCID.Person person = GetPerson();
     if (!IsPostBack)
     {
         //check to make sure BUID is associated your ORCID
         if (person.HasValidORCID)
         {
             if (HasResponseFromORCID)
             {
                 ProcessORCIDResponse(person);
             }
             UploadPendingData(person);
         }
         else
         {
             // Before uploading any data you must first associate your ORCID with your BUID
             Response.Redirect("~/ORCID/ProvideORCID.aspx", true);
         }
     }
 }
Ejemplo n.º 17
0
        protected void btnNewORCID_Click(object sender, EventArgs e)
        {
            try
            {
                long subjectID       = Convert.ToInt32(Request.QueryString["subject"]);
                int  profilePersonID = new Profiles.Edit.Utilities.DataIO().GetPersonID(subjectID);
                Utilities.ProfilesRNSDLL.BLL.ORCID.Person personBLL = new Utilities.ProfilesRNSDLL.BLL.ORCID.Person();
                Utilities.ProfilesRNSDLL.BO.ORCID.Person  bo        = personBLL.GetByPersonID(profilePersonID);
                if (chkUploadInfoNow.Checked)
                {
                    bo = UploadInfoToORCID1.GetPersonWithPageData(bo);
                }

                GetPageControlValues(bo);

                if (Profiles.ORCID.Utilities.config.RequireAcknowledgement)
                {
                    bo.AgreementAcknowledged = true;
                }
                if (new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().CreateNewORCID(bo, LoggedInInternalUsername, Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.REFPersonStatusType.REFPersonStatusTypes.User_Push_Failed))
                {
                    Edit.Utilities.DataIO data = new Edit.Utilities.DataIO();
                    data.AddLiteral(subjectID, data.GetStoreNode("http://vivoweb.org/ontology/core#orcidId"), data.GetStoreNode(bo.ORCID), this.PropertyListXML);

                    bool isProxy = Profiles.ORCID.Utilities.DataIO.getNodeIdFromInternalUserName(LoggedInInternalUsername) != subjectID;
                    Response.Redirect("~/ORCID/CreationConfirmation.aspx?UserORCID=" + bo.ORCID + "&Proxy=" + isProxy, false);
                    return;
                }
                else
                {
                    this.lblErrorsCreate.Text = bo.Error + bo.AllErrors + "<br /><br />";
                    GetErrorsAndMessages(bo);
                }
            }
            catch (Exception ex)
            {
                lblErrorsCreate.Text = ex.Message;
                LogException(ex);
            }
        }
Ejemplo n.º 18
0
        private void GetBioFromThePage(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            if (divResearchExpertiseAndProfessionalInterests.Visible)
            {
                person.BiographyDecisionID = int.Parse(ddlResearchExpertiseAndProfessionalInterestsVis.SelectedValue);
                if (person.BiographyDecisionID == (int)Utilities.ProfilesRNSDLL.BO.ORCID.REFDecision.REFDecisions.Public)
                {
                    person.Biography = this.txtResearchExpertiseAndProfessionalInterests.Text;
                }
                person.PushBiographyToORCID = true;
            }
            if (divWebsites.Visible)
            {
                if (rptPersonURLs.Items.Count > 0)
                {
                    Label        lblWebPageTitle = null;
                    HyperLink    hlURL           = null;
                    DropDownList ddlPushType     = null;

                    foreach (RepeaterItem ri in rptPersonURLs.Items)
                    {
                        switch (ri.ItemType)
                        {
                        case ListItemType.Item:
                        case ListItemType.AlternatingItem:
                            lblWebPageTitle = (Label)ri.FindControl("lblWebPageTitle");
                            hlURL           = (HyperLink)ri.FindControl("hlURL");
                            ddlPushType     = (DropDownList)ri.FindControl("ddlPushType");
                            Utilities.ProfilesRNSDLL.BO.ORCID.PersonURL personURL = new Utilities.ProfilesRNSDLL.BLL.ORCID.PersonURL().GetByPersonIDAndURL(person.PersonID, hlURL.Text);
                            personURL.URLName    = lblWebPageTitle.Text;
                            personURL.URL        = hlURL.Text;
                            personURL.PersonID   = person.PersonID;
                            personURL.DecisionID = int.Parse(ddlPushType.SelectedValue);
                            person.URLs.Add(personURL);
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 19
0
 public Utilities.ProfilesRNSDLL.BO.ORCID.Person GetPerson()
 {
     Utilities.ProfilesRNSDLL.BLL.ORCID.Person personBLL = new Utilities.ProfilesRNSDLL.BLL.ORCID.Person();
     Utilities.ProfilesRNSDLL.BO.ORCID.Person  person    = personBLL.GetByInternalUsername(LoggedInInternalUsername);
     return(person);
 }
Ejemplo n.º 20
0
        private List <Utilities.ProfilesRNSDLL.BO.ORCID.PersonMessage> GetPersonMessagesWaitingForApproval(Utilities.ProfilesRNSDLL.BO.ORCID.Person person)
        {
            int waitingForApproval = (int)Utilities.ProfilesRNSDLL.BO.ORCID.REFRecordStatus.REFRecordStatuss.Waiting_for_ORCID_User_for_approval;

            return((from pm in PersonMessageBLL.GetByPersonIDAndRecordStatusID(person.PersonID, waitingForApproval) orderby pm.PersonMessageID select pm).ToList());
        }