コード例 #1
0
        /// <summary>
        /// Retrieves a MembershipUser object from the criteria given
        /// </summary>
        /// <param name="providerUserKey">User to be found based on UserKey</param>
        /// <param name="userIsOnline">Is the User currently online</param>
        /// <returns>Username as string</returns>
        public override string GetUserNameByEmail(string email)
        {
            if (email == null)
            {
                ExceptionReporter.ThrowArgumentNull("MEMBERSHIP", "EMAILNULL");
            }

            DataTable Users = DB.GetUserNameByEmail(this.ApplicationName, email);

            if (this.RequiresUniqueEmail && Users.Rows.Count > 1)
            {
                ExceptionReporter.ThrowProvider("MEMBERSHIP", "TOOMANYUSERNAMERETURNS");
            }

            if (Users.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(Users.Rows [0] ["Username"].ToString());
            }
        }