protected void Page_Load(object sender, EventArgs e) { List <Post> githubPosts = GithubPosts.gitPosts("bendmyers"); foreach (Post post in githubPosts) { debugr.Controls.Add(post.control); } }
protected void Page_Load(object sender, EventArgs e) { //Check to see if the user has logged in, if not disable ability to post a car if (Session["Username"] == null) { Response.Redirect("Login.aspx"); } if (Int32.Parse(Session["UserId"].ToString()) % 2 != 0) { Session["Username"] = Session["TempUsername"]; Session["UserId"] = Session["TempUserId"]; } List <List <Post> > ALLTHEPOSTS = new List <List <Post> >(); // place to put all our lists List <Post> userPosts = getPosts(); // get user posts from database ALLTHEPOSTS.Add(userPosts); // add the user psot list to the listy list List <User> users = allUsers(); // get all the users - we will then fetch each of their git feeds. //if (users.Count <=0 ) { //Post error = new Post(GithubPosts.errorPost("woops. no github users"), DateTime.UtcNow); //userPosts.Add(error); //} foreach (User user in users) { if (user.gitname != null && user.gitname != "NULL" && user.gitname != "") { List <Post> githubPosts = GithubPosts.gitPosts(user.gitname); // if they have a github name, get their feed as a seperate list ALLTHEPOSTS.Add(githubPosts); //if (githubPosts.Count <=0 ) //{ //Post error = new Post(GithubPosts.errorPost("woops. no events for this user"), DateTime.UtcNow); // we couldn't get git info... soooooo //githubPosts.Add(error); //} } } // finally, flatten all the lists into one list, and sort it. List <Post> posts = flatten(ALLTHEPOSTS); posts.Sort(); posts.Reverse(); // then add them to the page! foreach (Post post in posts) { NewsFeedPanel.Controls.Add(post.control); } }
protected void Page_Load(object sender, EventArgs e) { //Check to see if the user has logged in, if not disable ability to post a car if (Session["Username"] == null) { Response.Redirect("Login.aspx"); } if (Int32.Parse(Session["UserId"].ToString()) % 2 != 0) { Session["Username"] = Session["TempUsername"]; Session["UserId"] = Session["TempUserId"]; } int tempAdmin = Int32.Parse(Request.QueryString["admin"]); //Check to see if the user is a group admin if (tempAdmin != 1) { // hides the post button on the navbar Page.ClientScript.RegisterStartupScript(this.GetType(), "notgroupadmin", "$('#PostModalToggler').hide()", true); } int tempUserID = Int32.Parse(Request.QueryString["userid"]); makeProfilePanel(tempUserID); List <List <Post> > ALLTHEPOSTS = new List <List <Post> >(); // place to put all our lists List <Post> userPosts = getPosts(); // get user posts from database ALLTHEPOSTS.Add(userPosts); // add the user psot list to the listy list //List<User> users = allUsers(); // get all the users - we will then fetch each of their git feeds. //if (users.Count <= 0) //{ // Post error = new Post(GithubPosts.errorPost("woops. no github users"), DateTime.UtcNow); // userPosts.Add(error); //} //foreach (User user in users) //{ User user = getUser(Int32.Parse(Request.QueryString["userid"])); if (user.gitname != null && user.gitname != "NULL" && user.gitname != "") { List <Post> githubPosts = GithubPosts.gitPosts(user.gitname); // if they have a github name, get their feed as a seperate list ALLTHEPOSTS.Add(githubPosts); //if (githubPosts.Count <= 0) //{ //Post error = new Post(GithubPosts.errorPost("woops. no events for this user"), DateTime.UtcNow); // we couldn't get git info... soooooo //githubPosts.Add(error); //} } // finally, flatten all the lists into one list, and sort it. List <Post> posts = flatten(ALLTHEPOSTS); posts.Sort(); posts.Reverse(); // then add them to the page! foreach (Post post in posts) { UserPostPanel.Controls.Add(post.control); } }