Example #1
0
        /// <summary>
        /// Gets the by encrypted ID.
        /// </summary>
        /// <param name="encryptedID">The encrypted ID.</param>
        /// <returns></returns>
        public Person GetByEncryptedID(string encryptedID)
        {
            string identifier = Rock.Security.Encryption.DecryptString(encryptedID);

            string[] idParts = identifier.Split('|');
            if (idParts.Length == 2)
            {
                Guid personGuid = new Guid(idParts[0]);
                int  personId   = Int32.Parse(idParts[1]);

                Person person = Queryable().
                                Where(p => p.Guid == personGuid && p.Id == personId).FirstOrDefault();

                if (person != null)
                {
                    return(person);
                }

                // Check to see if the record was merged
                PersonMergedService personMergedService = new PersonMergedService();
                PersonMerged        personMerged        = personMergedService.Queryable().
                                                          Where(p => p.Guid == personGuid && p.Id == personId).FirstOrDefault();

                if (personMerged != null)
                {
                    return(Get(personMerged.Id, true));
                }
            }

            return(null);
        }
 /// <summary>
 /// Returns a <see cref="Rock.Model.Person"/> by their Guid.
 /// </summary>
 /// <param name="guid">A <see cref="System.Guid"/> representing the <see cref="Rock.Model.Person">Person's</see> Guid identifier.</param>
 /// <param name="followMerges">A <see cref="System.Boolean"/> flag indicating that the provided Guid should be checked against the <see cref="Rock.Model.PersonMerged"/> list.
 /// When <c>true</c> the <see cref="Rock.Model.PersonMerged"/> log will be checked for the Guid, otherwise <c>false</c>.</param>
 /// <returns>The <see cref="Rock.Model.Person"/> associated with the provided Guid, otherwise null.</returns>
 public Person Get(Guid guid, bool followMerges)
 {
     if (followMerges)
     {
         guid = new PersonMergedService().Current(guid);
     }
     return(Get(guid));
 }
        /// <summary>
        /// Returns a <see cref="Rock.Model.Person"/> by their encrypted key value.
        /// </summary>
        /// <param name="encryptedKey">A <see cref="System.String"/> containing an encrypted key value.</param>
        /// <param name="followMergeTrail">A <see cref="System.Boolean"/> flag indicating that the provided Guid should be checked against the <see cref="Rock.Model.PersonMerged"/> list.
        /// When <c>true</c> the <see cref="Rock.Model.PersonMerged"/> log will be checked for the Guid, otherwise <c>false</c>.</param>
        /// <returns>
        /// The <see cref="Rock.Model.Person"/> associated with the provided Key, otherwise null.
        /// </returns>
        public Person GetByEncryptedKey(string encryptedKey, bool followMergeTrail)
        {
            if (followMergeTrail)
            {
                encryptedKey = new PersonMergedService().Current(encryptedKey);
            }

            return(GetByEncryptedKey(encryptedKey));
        }
Example #4
0
        /// <summary>
        /// Gets Person by Id
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="followTrail">if set to <c>true</c> follow the merge trail.</param>
        /// <returns>
        /// Person object.
        /// </returns>
        public Person Get(int id, bool followTrail)
        {
            if (followTrail)
            {
                id = new PersonMergedService().Current(id);
            }

            return(Get(id));
        }
Example #5
0
        /// <summary>
        /// Returns a <see cref="Rock.Model.Person"/> by their encrypted key value.
        /// </summary>
        /// <param name="encryptedKey">A <see cref="System.String"/> containing an encrypted key value.</param>
        /// <param name="followMergeTrail">A <see cref="System.Boolean"/> flag indicating that the provided Guid should be checked against the <see cref="Rock.Model.PersonMerged"/> list.
        /// When <c>true</c> the <see cref="Rock.Model.PersonMerged"/> log will be checked for the Guid, otherwise <c>false</c>.</param>
        /// <returns>
        /// The <see cref="Rock.Model.Person"/> associated with the provided Key, otherwise null.
        /// </returns>
        public Person GetByEncryptedKey( string encryptedKey, bool followMergeTrail )
        {
            if ( followMergeTrail )
                encryptedKey = new PersonMergedService().Current( encryptedKey );

            return GetByEncryptedKey( encryptedKey );
        }
Example #6
0
 /// <summary>
 /// Returns a <see cref="Rock.Model.Person"/> by their Guid.
 /// </summary>
 /// <param name="guid">A <see cref="System.Guid"/> representing the <see cref="Rock.Model.Person">Person's</see> Guid identifier.</param>
 /// <param name="followMerges">A <see cref="System.Boolean"/> flag indicating that the provided Guid should be checked against the <see cref="Rock.Model.PersonMerged"/> list.
 /// When <c>true</c> the <see cref="Rock.Model.PersonMerged"/> log will be checked for the Guid, otherwise <c>false</c>.</param>
 /// <returns>The <see cref="Rock.Model.Person"/> associated with the provided Guid, otherwise null.</returns>
 public Person Get( Guid guid, bool followMerges )
 {
     if ( followMerges )
     {
         guid = new PersonMergedService().Current( guid );
     }
     return Get( guid );
 }