Ejemplo n.º 1
0
    /// <summary>
    /// Retrieves groups from the database associated with the current user in session.
    /// </summary>
    private void retrieveGroups()
    {
        if (null != _currentUser)
        {
            List<GroupDAO> ownedGroups = new List<GroupDAO>();
            List<GroupDAO> moderatedGroups = new List<GroupDAO>();
            List<GroupDAO> userIsInGroups = new List<GroupDAO>();

            try
            {
                IDBController controller = new SqlController();
                ownedGroups = controller.GetGroupsUserIsOwnerOf(_currentUser.UserID);
                moderatedGroups = controller.GetGroupsUserIsModeratorOf(_currentUser.UserID);
                userIsInGroups = controller.GetGroupsUserIsMemberOf(_currentUser.UserID);
            }
            catch (SqlException)
            {
                groupsUserOwns.Text = "<li>An error occurred gathering group information. Please try again later.</li>";
                return;
            }

            printGroupsToPage(ownedGroups, groupsUserOwns, @"<li>You do not own any groups. Press ""Create Group"" to make a new one!</li>");
            printGroupsToPage(moderatedGroups, groupsUserModerates, "<li>You are not the moderator of any groups.</li>");
            printGroupsToPage(userIsInGroups, groupsUserIsIn, "<li>You are not a user of any groups.</li>");
        }
    }