Esempio n. 1
0
    private void BindGrdSameDepartment()
    {
        Connects.Profiles.Service.DataContracts.PersonList thisPerson = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(_profileId);
        Connects.Profiles.Service.DataContracts.PersonList pl         = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetDepartmentPeopleFromPersonId(_profileId, _personCount);

        grdSameDepartment.DataSource = pl.Person;
        grdSameDepartment.DataBind();

        _rowCount = Convert.ToInt32(pl.TotalCount);

        if (Convert.ToInt32(thisPerson.TotalCount) > 0)
        {
            if (thisPerson.Person[0].AffiliationList != null)
            {
                if (thisPerson.Person[0].AffiliationList.Affiliation.Count > 0)
                {
                    foreach (Connects.Profiles.Service.DataContracts.AffiliationPerson aff in thisPerson.Person[0].AffiliationList.Affiliation)
                    {
                        if (aff.Primary)
                        {
                            _dept = aff.DepartmentName;
                            _inst = aff.InstitutionName;
                        }
                    }
                }
            }
        }

        if (!grdSameDepartment.Rows.Count.Equals(0))
        {
            HasData = true;
        }
    }
        public int GetProfileSearchTotalRowCount(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount)
        {
            string qId = pq.QueryDefinition.QueryID;
            int primeCount = 0;
            int returnedCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(qId, primeCount);
            totalCount = returnedCount;

            queryID = qId;

            return returnedCount;
        }
        public int GetProfileSearchTotalRowCount(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount)
        {
            string qId           = pq.QueryDefinition.QueryID;
            int    primeCount    = 0;
            int    returnedCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(qId, primeCount);

            totalCount = returnedCount;

            queryID = qId;

            return(returnedCount);
        }
Esempio n. 4
0
    public void LoadProfile()
    {
        Connects.Profiles.Service.DataContracts.PersonList thisPerson = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(_personId);
        dlistProfileInfo.DataSource = thisPerson.Person;
        dlistProfileInfo.DataBind();

        rptrTitles.DataSource = _userBL.GetPersonAffiliations(_personId);
        rptrTitles.DataBind();

        // Hide the section if no "Other Positions"
        if (rptrTitles.Items.Count == 0)
        {
            rptrTitles.Visible = false;
        }
    }
        public List <Person> ProfileSearchPersonBinding(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount, int startRowIndex, int maximumRows)
        {
            bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));

            // Modify the search for the start row and max rows
            //((Connects.Profiles.Service.DataContracts.Profiles)pq).OutputOptions.StartRecord = startRowIndex.ToString();

            PersonList personList = new ProfileServiceAdapter().ProfileSearch(pq, isSecure);

            queryID = personList.QueryID;

            totalCount = Convert.ToInt32(personList.TotalCount);
            //complete = personList.Complete;

            int fooCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(queryID, totalCount);

            return(personList.Person);
        }
    private string GetJSONProfiles(int personId, bool showPublications, bool mobile)
    {
        Dictionary<string, Object> personData = new Dictionary<string, Object>();
        List<Dictionary<string, Object>> personDataList = new List<Dictionary<string, object>>();
        Dictionary<string, Object> profileData = new Dictionary<string, Object>();

        if (!new Connects.Profiles.Service.ServiceImplementation.DataIO().GetIsActive(personId))
        {
            // this will cause a safe {} to be returned
            throw new Exception("Person does not have an active profile");
        }

        // get person data
        try
        {
            PersonList personProfileList = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(personId);
            if (personProfileList.Person.Count == 1)
            {
                Person person = personProfileList.Person[0];

                personData.Add("Name", person.Name.FullName);
                personData.Add("ProfilesURL", person.ProfileURL.Text);
                /*personData.Add("SampleHTML", "<a href=\"" + ConfigUtil.GetConfigItem("URLBase") + "ProfileDetails.aspx?Person=" + personId +
                    "\" title=\"Go to UCSF Profiles, powered by CTSI\" rel=\"me\">View " + person.Name.FirstName + " " +
                    (person.Name.MiddleName != null && person.Name.MiddleName.Length > 0 ? person.Name.MiddleName + " " : "") + person.Name.LastName + "'s research profile</a>"); */

                if (person.EmailImageUrl != null && person.EmailImageUrl.Visible)
                {
                    personData.Add("Email", person.EmailImageUrl.Text);
                }

                personData.Add("Address", person.Address);
                List<String> titles = new List<string>();
                foreach (AffiliationPerson aff in person.AffiliationList.Affiliation)
                {
                    if (aff.Primary)
                    {
                        personData.Add("Department", aff.DepartmentName);
                        personData.Add("School", aff.InstitutionName);
                    }
                    titles.Add(aff.JobTitle);
                }
                personData.Add("Titles", titles);

                if (person.Narrative != null)
                {
                    personData.Add("Narrative", person.Narrative.Text);
                }

                personData.Add("PhotoURL", person.PhotoUrl.Text);

                if (showPublications && person.PublicationList != null)
                {
                    List<Object> pubList = new List<object>();
                    foreach (Publication pub in person.PublicationList)
                    {
                        Dictionary<string, Object> pubData = new Dictionary<string, Object>();
                        pubData.Add("PublicationID", pub.PublicationID);
                        pubData.Add("PublicationTitle", pub.PublicationReference.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<").Replace("&#37;", "%"));
                        //pubData.Add("PublicationAbstract", pub.PublicationDetails);

                        List<Object> pubSourceList = new List<object>();
                        foreach (PublicationSource pubSource in pub.PublicationSourceList)
                        {
                            Dictionary<string, Object> pubSourceData = new Dictionary<string, Object>();
                            pubSourceData.Add("PublicationSourceName", pubSource.Name);
                            pubSourceData.Add("PublicationSourceURL", (mobile ? pubSource.URL.Replace("/pubmed", "/m/pubmed") : pubSource.URL) );
                            pubSourceData.Add("PublicationAddedBy", new Profiles.CustomAPI.Utilities.DataIO().GetPublicationInclusionSource(personId, pubSource.ID));
                            pubSourceList.Add(pubSourceData);
                        }
                        pubData.Add("PublicationSource", pubSourceList);
                        pubList.Add(pubData);
                    }
                    personData.Add("Publications", pubList);
                }
                else
                {
                    personData.Add("PublicationCount", person.PublicationList == null ? 0 : person.PublicationList.Count());
                }

                // Co-authors
                List<int> coAuthors = new List<int>();
                if (person.PassiveNetworks.CoAuthorList != null && person.PassiveNetworks.CoAuthorList.CoAuthor != null)
                {
                    foreach (CoAuthor ca in person.PassiveNetworks.CoAuthorList.CoAuthor)
                    {
                        coAuthors.Add(Int32.Parse(ca.PersonID));
                    }
                }
                if (coAuthors.Count > 0)
                {
                    personData.Add("CoAuthors", coAuthors);
                }

                // Similiar People
                List<int> similarPeople = new List<int>();
                if (person.PassiveNetworks.SimilarPersonList != null && person.PassiveNetworks.SimilarPersonList.SimilarPerson != null)
                {
                    foreach (SimilarPerson sp in person.PassiveNetworks.SimilarPersonList.SimilarPerson)
                    {
                        similarPeople.Add(Int32.Parse(sp.PersonID));
                    }
                }
                if (similarPeople.Count > 0)
                {
                    personData.Add("SimilarPeople", similarPeople);
                }

                // Keywords
                List<string> keywords = new List<string>();
                //foreach (DataRow row in _userBL.GetUserMESHkeywords(personId, "True", ref Count).Rows)
                if (person.PassiveNetworks.KeywordList != null && person.PassiveNetworks.KeywordList.Keyword != null)
                {
                    foreach (Keyword2 kw in person.PassiveNetworks.KeywordList.Keyword)
                    {
                        keywords.Add(kw.Text);
                    }
                }
                if (keywords.Count > 0)
                {
                    personData.Add("Keywords", keywords);
                }

                // add person
                personDataList.Add(personData);
                profileData.Add("Profiles", personDataList);
            }

        }
        catch (Exception ex)
        {
            // do nothing
        }
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        return serializer.Serialize(profileData);
    }
Esempio n. 7
0
    private string GetXMLProfiles(int personId)
    {
        PersonList personProfileList = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(personId);

        return(XmlUtilities.SerializeObject(personProfileList));
    }
 private string GetXMLProfiles(int personId)
 {
     PersonList personProfileList = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(personId);
     return XmlUtilities.SerializeObject(personProfileList);
 }
        public List<Person> ProfileSearchPersonBinding(Connects.Profiles.Service.DataContracts.Profiles pq, out string queryID, out int totalCount, int startRowIndex, int maximumRows)
        {
            bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));

            // Modify the search for the start row and max rows
            //((Connects.Profiles.Service.DataContracts.Profiles)pq).OutputOptions.StartRecord = startRowIndex.ToString();

            PersonList personList = new ProfileServiceAdapter().ProfileSearch(pq, isSecure);
            queryID = personList.QueryID;

            totalCount = Convert.ToInt32(personList.TotalCount);
            //complete = personList.Complete;

            int fooCount = new ProfileServiceAdapter().GetProfileSearchTotalRowCount(queryID, totalCount);

            return personList.Person;
        }
Esempio n. 10
0
    private string GetJSONProfiles(int personId, bool showPublications, bool mobile)
    {
        Dictionary <string, Object>         personData     = new Dictionary <string, Object>();
        List <Dictionary <string, Object> > personDataList = new List <Dictionary <string, object> >();
        Dictionary <string, Object>         profileData    = new Dictionary <string, Object>();

        if (!new DataIO().GetIsActive(personId))
        {
            // this will cause a safe {} to be returned
            throw new Exception("Person does not have an active profile");
        }

        // get person data
        try
        {
            PersonList personProfileList = new Connects.Profiles.Service.ServiceImplementation.ProfileServiceAdapter().GetPersonFromPersonId(personId);
            if (personProfileList.Person.Count == 1)
            {
                Person person = personProfileList.Person[0];

                personData.Add("Name", person.Name.FullName);
                personData.Add("ProfilesURL", person.ProfileURL.Text);

                /*personData.Add("SampleHTML", "<a href=\"" + ConfigUtil.GetConfigItem("URLBase") + "ProfileDetails.aspx?Person=" + personId +
                 *  "\" title=\"Go to UCSF Profiles, powered by CTSI\" rel=\"me\">View " + person.Name.FirstName + " " +
                 *  (person.Name.MiddleName != null && person.Name.MiddleName.Length > 0 ? person.Name.MiddleName + " " : "") + person.Name.LastName + "'s research profile</a>"); */

                if (person.EmailImageUrl != null && person.EmailImageUrl.Visible)
                {
                    personData.Add("Email", person.EmailImageUrl.Text);
                }

                personData.Add("Address", person.Address);
                List <String> titles = new List <string>();
                foreach (AffiliationPerson aff in person.AffiliationList.Affiliation)
                {
                    if (aff.Primary)
                    {
                        personData.Add("Department", aff.DepartmentName);
                        personData.Add("School", aff.InstitutionName);
                    }
                    titles.Add(aff.JobTitle);
                }
                personData.Add("Titles", titles);

                if (person.Narrative != null)
                {
                    personData.Add("Narrative", person.Narrative.Text);
                }

                personData.Add("PhotoURL", person.PhotoUrl.Text);

                if (showPublications && person.PublicationList != null)
                {
                    List <Object> pubList = new List <object>();
                    foreach (Publication pub in person.PublicationList)
                    {
                        Dictionary <string, Object> pubData = new Dictionary <string, Object>();
                        pubData.Add("PublicationID", pub.PublicationID);
                        if (pub.PublicationReference != null)
                        {
                            pubData.Add("PublicationTitle", pub.PublicationReference.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<").Replace("&#37;", "%"));
                        }
                        //pubData.Add("PublicationAbstract", pub.PublicationDetails);

                        List <Object> pubSourceList = new List <object>();
                        foreach (PublicationSource pubSource in pub.PublicationSourceList)
                        {
                            Dictionary <string, Object> pubSourceData = new Dictionary <string, Object>();
                            pubSourceData.Add("PublicationSourceName", pubSource.Name);
                            pubSourceData.Add("PublicationSourceURL", (mobile ? pubSource.URL.Replace("/pubmed", "/m/pubmed") : pubSource.URL));
                            pubSourceData.Add("PublicationAddedBy", new Profiles.CustomAPI.Utilities.DataIO().GetPublicationInclusionSource(personId, pubSource.ID));
                            pubSourceList.Add(pubSourceData);
                        }
                        pubData.Add("PublicationSource", pubSourceList);
                        pubList.Add(pubData);
                    }
                    personData.Add("Publications", pubList);
                }
                else
                {
                    personData.Add("PublicationCount", person.PublicationList == null ? 0 : person.PublicationList.Count());
                }

                // Co-authors
                List <int> coAuthors = new List <int>();
                if (person.PassiveNetworks.CoAuthorList != null && person.PassiveNetworks.CoAuthorList.CoAuthor != null)
                {
                    foreach (CoAuthor ca in person.PassiveNetworks.CoAuthorList.CoAuthor)
                    {
                        coAuthors.Add(Int32.Parse(ca.PersonID));
                    }
                }
                if (coAuthors.Count > 0)
                {
                    personData.Add("CoAuthors", coAuthors);
                }

                // Similiar People
                List <int> similarPeople = new List <int>();
                if (person.PassiveNetworks.SimilarPersonList != null && person.PassiveNetworks.SimilarPersonList.SimilarPerson != null)
                {
                    foreach (SimilarPerson sp in person.PassiveNetworks.SimilarPersonList.SimilarPerson)
                    {
                        similarPeople.Add(Int32.Parse(sp.PersonID));
                    }
                }
                if (similarPeople.Count > 0)
                {
                    personData.Add("SimilarPeople", similarPeople);
                }

                // Keywords
                List <string> keywords = new List <string>();
                //foreach (DataRow row in _userBL.GetUserMESHkeywords(personId, "True", ref Count).Rows)
                if (person.PassiveNetworks.KeywordList != null && person.PassiveNetworks.KeywordList.Keyword != null)
                {
                    foreach (Keyword2 kw in person.PassiveNetworks.KeywordList.Keyword)
                    {
                        keywords.Add(kw.Text);
                    }
                }
                if (keywords.Count > 0)
                {
                    personData.Add("Keywords", keywords);
                }

                // add person
                personDataList.Add(personData);
                profileData.Add("Profiles", personDataList);
            }
        }
        catch (Exception ex)
        {
            // do nothing
        }
        JavaScriptSerializer serializer = new JavaScriptSerializer();

        return(serializer.Serialize(profileData));
    }