/// <summary>
 /// Copies the membership user collection to a one-dimension array.
 /// </summary>
 /// <param name="array">
 /// A one-dimension array of type Security.MembershipUser that is 
 /// the destination of the elements copied from the Security.MembershipUserCollection.
 /// The array must have zero-based indexing.
 /// </param>
 /// <param name="index">The zero-based index in the array at which coppying begins.</param>
 public void CopyTo(MembershipUser[] array, int index)
 {
 }
 /// <summary>
 /// Adds the specified membership user to the collection
 /// </summary>
 /// <param name="user">a Security.MembershipUser object to add to the collection.</param>
 /// <exception>
 /// System.NotSupportedException:
 ///     The collection is read-only.
 ///     
 /// System.ArgumentNullException:
 ///     The Security.MembershipUser.UserName of the user is null.
 ///     
 /// System.ArgumentException:
 ///     A Security.MembershipUser object with the same Security.MembershipUser.UserName
 ///     value as user already exists in the collection.
 /// </exception>
 public void Add(MembershipUser user)
 {
 }
예제 #3
0
        /// <summary>
        /// Set MyBase to values of [data]
        /// </summary>
        /// <param name="data">as membership user</param>
        /// <returns></returns>
        private bool SetBase(MembershipUser data)
        {
            try
            {
                _uid = data.UID;
                _appid = data.APPID;
                _pswd = data.Password;
                _pswdformat = data.PasswordFormat;
                _pswdsalt = data.PasswordSalt;
                _email = data.Email;
                _pswdQuestion = data.PasswordQuestion;
                _pswdAnswer = data.PasswordAnswer;
                _isApproved = data.Approved;
                _isLockedOut = data.LockedOut;
                _createdDate = data.DateCreated;
                _lastLoginDate = data.DateLastLogin;
                _lastPswdChangeDate = data.DateLastPasswordChange;
                _lastLockoutDate = data.DateLastLockedOut;
                _failedPswdAttemptCount = data.FailedPasswordAttemptCount;
                _failedPswdAttemptWindowStart = data.FailedPasswordAttemptWindowStart;
                _failedPswdAnswerAttemptCount = data.FailedPasswordAnswerAttemptCount;
                _failedPswdAnswerAttemptWindowStart = data.FailedPasswordAttemptWindowStart;
                _comment = string.Empty;

                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        /// <summary>
        /// Return Serialized String version of [data] Object
        /// </summary>
        /// <param name="data">as User</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private static string XMLSerializeToString(MembershipUser data)
        {
            try
            {
                XmlSerializer xmlSer = new XmlSerializer(typeof(MembershipUser));
                MemoryStream ms = new MemoryStream();
                StreamReader strReader = default(StreamReader);
                string output = null;

                xmlSer.Serialize(ms, data);
                ms.Position = 0;
                strReader = new StreamReader(ms);
                output = strReader.ReadToEnd();
                return output;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
예제 #5
0
        /// <summary>
        /// Set MyBase to values of [dr]
        /// </summary>
        /// <param name="pconstring">as data source connection string</param>
        /// <param name="dr">as data.datarow</param>
        /// <returns></returns>
        internal Boolean SetBase(string pconstring, System.Data.DataRow dr)
        {
            try
            {
                if (dr["UID"] != System.DBNull.Value) {_uid = new Guid(dr["UID"].ToString());}
                if (dr["APPID"] != System.DBNull.Value) { _appid = new Guid(dr["APPID"].ToString()); }
                if (dr["UserName"] != System.DBNull.Value) { _username = (String)dr["UserName"]; }
                if (dr["UserIsAnonymous"] != System.DBNull.Value) { _isAnonymous  =  Convert.ToBoolean(dr["UserIsAnonymous"]); }
                if (dr["UserLastActivityDate"] != System.DBNull.Value) { _lastActivityDate = (DateTime)dr["UserLastActivityDate"]; }
                if (dr["UserTimestamp"] != System.DBNull.Value) { _timestamp = (DateTime)dr["UserTimestamp"]; }

                _demographics = new UserDemographics(dr);
                //load membership information for the current application
                _membership = new MembershipUser(pconstring, _uid, _appid);
                //load role for user
                _role = Role.getUserRoleForApplication(pconstring, _uid, _appid);

                return true;
            }
            catch (Exception ex)
            {
                _LastError = ex;
                throw ex;
            }
        }