Пример #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
                PersonTrailService personTrailService = new PersonTrailService();
                PersonTrail        personTrail        = personTrailService.Queryable().
                                                        Where(p => p.Guid == personGuid && p.Id == personId).FirstOrDefault();

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

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Get's the current person id
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public int Current(int id)
        {
            PersonTrail personTrail = Get(id);

            while (personTrail != null)
            {
                id          = personTrail.CurrentId;
                personTrail = Get(id);
            }
            return(id);
        }
Пример #3
0
        /// <summary>
        /// Get's the current person Guid
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <returns></returns>
        public string Current(string publicKey)
        {
            PersonTrail personTrail = GetByEncryptedKey(publicKey);

            while (personTrail != null)
            {
                publicKey   = personTrail.CurrentPublicKey;
                personTrail = GetByEncryptedKey(publicKey);
            }
            return(publicKey);
        }