예제 #1
0
    /// <summary>
    /// Initialize all of the internal objects inside of the query definition
    /// </summary>
    /// <returns>A new instance of type QueryDefinition</returns>
    public static Profiles GetNewProfilesDefinition()
    {
        QueryDefinition qd       = new QueryDefinition();
        Profiles        profiles = new Profiles();

        Name name = new Name();

        name.FirstName = new FirstName();
        name.LastName  = new LastName();
        qd.Name        = name;


        OutputOptions oo = new OutputOptions();

        oo.SortType    = OutputOptionsSortType.QueryRelevance;
        oo.StartRecord = "0";

        Affiliation     affiliation = new Affiliation();
        AffiliationList affList     = new AffiliationList();

        //affiliations.AffiliationList = affList;
        affList.Affiliation = new List <Affiliation>();
        affList.Affiliation.Add(affiliation);


        FacultyRankList ftList = new FacultyRankList();

        ftList.FacultyRank = new List <string>();

        KeywordString kws = new KeywordString();
        Keywords      kw  = new Keywords();

        kw.KeywordString = new KeywordString();
        kw.KeywordString = kws;

        profiles.QueryDefinition = qd;
        profiles.QueryDefinition.AffiliationList = affList;
        profiles.QueryDefinition.Keywords        = kw;
        profiles.QueryDefinition.Name            = name;

        profiles.OutputOptions = oo;

        //its hard wired for 2 in this version.
        profiles.Version = 2;

        return(profiles);
    }
예제 #2
0
        public PersonList GetDepartmentPeopleFromPersonId(int personId, int count)
        {
            //thisPerson is the current profile being viewed by a user or process.
            PersonList thisPerson;
            PersonList returnPeople;

            thisPerson = GetPersonFromPersonId(personId);

            QueryDefinition qd = new QueryDefinition();

            Connects.Profiles.Service.DataContracts.Profiles profiles = new Connects.Profiles.Service.DataContracts.Profiles();

            if (Convert.ToInt32(thisPerson.TotalCount) > 0)
            {
                if (thisPerson.Person[0].AffiliationList != null)
                {
                    if (thisPerson.Person[0].AffiliationList.Affiliation.Count > 0)
                    {
                        Affiliation     affiliation = new Affiliation();
                        AffiliationList affList     = new AffiliationList();
                        affiliation.DepartmentName  = new AffiliationDepartmentName();
                        affiliation.InstitutionName = new AffiliationInstitutionName();

                        foreach (AffiliationPerson aff in thisPerson.Person[0].AffiliationList.Affiliation)
                        {
                            if (aff.Primary)
                            {
                                affiliation.DepartmentName.Text  = aff.DepartmentName;
                                affiliation.InstitutionName.Text = aff.InstitutionName;
                            }
                        }
                        affList.Affiliation = new List <Affiliation>();
                        affList.Affiliation.Add(affiliation);

                        qd.AffiliationList = affList;

                        profiles.QueryDefinition = qd;

                        OutputOptions oo = new OutputOptions();
                        oo.SortType    = OutputOptionsSortType.QueryRelevance;
                        oo.StartRecord = "0";
                        oo.MaxRecords  = count.ToString();

                        profiles.OutputOptions = oo;


                        bool isSecure = System.Convert.ToBoolean(ConfigUtil.GetConfigItem("IsSecure"));
                        profiles.Version = 2;
                        returnPeople     = ProfileSearch(profiles, isSecure);

                        //Filter out the current profile you are viewing.
                        if (Convert.ToInt32(thisPerson.ThisCount) > 0)
                        {
                            returnPeople.Person.RemoveAll(x => x.PersonID == thisPerson.Person[0].PersonID);
                        }

                        return(returnPeople);
                    }
                }
            }

            return(thisPerson);
        }