コード例 #1
0
        /// <summary>
        /// 根据身份验证类型枚举获取已通过froms验证的同身份用户对象
        /// </summary>
        private object GetMemberByAuthenticationTypeAndTicket(AuthenticationType type, Dictionary <string, string> ticketDictionary)
        {
            Guid identityGuid;

            if (ticketDictionary.ContainsKey(type.ToString()) &&
                Guid.TryParse(ticketDictionary[type.ToString()], out identityGuid))
            {
                switch (type)
                {
                case AuthenticationType.Guest:
                    _cacheGuest = _guestService.GetGuestByGuid(identityGuid);
                    break;

                case AuthenticationType.Admin:
                    _cacheAdmin = _adminService.GetAdminByGuid(identityGuid);
                    break;

                case AuthenticationType.Customer:
                    _cacheCustomer = _customerService.GetCustomerByGuid(identityGuid);
                    break;

                default:
                    throw new ArgumentException(string.Format("Unsupported Authentication Type {0}", type));
                }
                return(GetCacheMemberByAuthenticationType(type));
            }
            return(null);
        }