Exemplo n.º 1
0
        protected void btnRemoveAccount_Click(object sender, EventArgs e)
        {
            bool auth = Convert.ToBoolean(Session["auth"]);

            if (!auth)
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                // find the user
                long   id   = Convert.ToInt64(Session["uid"]);
                S_User user = UserManager.GetUserById(id);

                // remove favorits
                FavoritManager.DeleteFavoritsByUserId(user.id);

                // remove competitionplayers
                CompetitionManager.DeleteCompetitionPlayer(user.id);

                // remove user
                UserManager.Delete(user.id);

                Response.Redirect("~/Logout.aspx");
            }
        }