protected void btnSend_Click(object sender, EventArgs e)
    {

        Member ForgetfulMember = Member.GetMemberByEmail(txtEmail.Text);

        // if the address is not available then the user is valid
        if (ForgetfulMember!= null)
        {
            ForgottenPassword forgottenPassword = new ForgottenPassword();
            forgottenPassword.EmailAddress = txtEmail.Text;
            forgottenPassword.IPAddress = HttpContext.Current.Request.UserHostAddress;
            forgottenPassword.DTCreated = DateTime.Now;
            forgottenPassword.MemberID = ForgetfulMember.MemberID;
            forgottenPassword.Save();

            PasswordSent = true;
        }
        else
        {
            // that email address does not exist
            libMessage.Text = "<p class='error_alert'>Sorry, we do not have an account with that email</p>";

        }

    }
示例#2
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of ForgottenPasswords
        /// </summary>
        public static List<ForgottenPassword> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<ForgottenPassword> arr = new List<ForgottenPassword>();

            ForgottenPassword obj;

            while (dr.Read())
            {
                obj = new ForgottenPassword();
                if (list.IsColumnPresent("ForgottenPasswordID")) { obj._forgottenPasswordID = (int)dr["ForgottenPasswordID"]; }
                if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("EmailAddress")) { obj._emailAddress = (string)dr["EmailAddress"]; }
                if (list.IsColumnPresent("IPAddress")) { obj._iPAddress = (string)dr["IPAddress"]; }
                if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }