Exemple #1
0
        protected void Delete_Account(object sender, EventArgs e)
        {
            List <int> list_announcement_id = ListAnnouncements_User();
            List <int> list_events_id       = ListEventsFromAnnouncement_User();
            List <int> list_invitations_id  = ListInvitations_User();

            db = new SQLDatabase();
            db.Connect();

            db.Delete_Users_Assigned_Announcement_id_user(id);
            for (int i = 0; i < list_announcement_id.Count; i++)
            {
                db.Delete_Users_Assigned_Announcement(list_announcement_id.ElementAt(i));
            }

            for (int i = 0; i < list_events_id.Count; i++)
            {
                db.Delete_Users_Joined_Event(list_events_id.ElementAt(i));
            }

            db.Delete_Users_Joined_Event_id_user(id);
            for (int i = 0; i < list_events_id.Count; i++)
            {
                db.Delete_Users_Joined_Event(list_events_id.ElementAt(i));
            }

            for (int i = 0; i < list_invitations_id.Count; i++)
            {
                db.DeleteInvitation_id(list_invitations_id.ElementAt(i));
            }

            for (int i = 0; i < list_events_id.Count; i++)
            {
                db.DeleteEvent(list_events_id.ElementAt(i));
            }

            for (int i = 0; i < list_announcement_id.Count; i++)
            {
                db.DeleteAnnouncement(list_announcement_id.ElementAt(i));
            }

            db.DeleteUser(id);
            Session.RemoveAll();
            Response.Redirect("Home.aspx");
            db.Disconnect();
        }