Example #1
0
        private void Page_Load()
        {
            // check if username exists in the query string
            username            = Request.QueryString["username"];
            sueetieUser         = SueetieUsers.GetUser(username);
            lblDisplayName.Text = sueetieUser.DisplayName;

            SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());

            if (username == null || username == "")
            {
                Response.Redirect("users.aspx");
            }

            // get membership user account based on username sent in query string
            _user            = Membership.GetUser(username, false);
            lastActivitydate = _user.LastActivityDate;

            UserUpdateMessage.Text = "";

            if (_user.IsLockedOut)
            {
                ActionMessage.Visible = true;
                ActionMessage.Text    = "User is locked out.  Use the \"Unlock User\" button to unlock";
            }
            else
            {
                string bannedIntro   = "This user's IP mask (" + SueetieIPHelper.GetIPMask(sueetieUser.IP) + ") is recorded as banned. Click 'Lift Ban on this User' to permit the user to login or create a new account.";
                string unbannedIntro = "User is not banned. Click 'Ban User' to record user's IP mask as banned to thwart attempts to create new site accounts.";
                if (!Page.IsPostBack)
                {
                    if (sueetieUser.IsBanned)
                    {
                        trBan.Visible       = false;
                        lblBannedIntro.Text = bannedIntro;
                    }
                    else
                    {
                        trUnBan.Visible     = false;
                        lblBannedIntro.Text = unbannedIntro;
                    }


                    SueetieUserProfile profile = SueetieUsers.GetSueetieUserProfile(sueetieUser.UserID);

                    txtDisplayName.Text   = profile.DisplayName;
                    chkNewsletter.Checked = profile.Newsletter;
                }

                _user.LastActivityDate = lastActivitydate;
                Membership.UpdateUser(_user);
                _user = Membership.GetUser(username, false);
            }
        }