public AddPost() { InitializeComponent(); try { progressIndicator = SystemTray.ProgressIndicator; progressIndicator = new ProgressIndicator(); SystemTray.SetProgressIndicator(this, progressIndicator); progressIndicator.IsIndeterminate = true; progressIndicator.Text = "Pulling Categories..."; forumModel = (ForumModel)(App.Current as App).SecondPageObject; Groups.ItemsSource = forumModel.Groups; currentGroup = forumModel.Groups.Where(x => x.GroupId == forumModel.GroupId).FirstOrDefault(); if (currentGroup != null) { ForumGroupName.Text = currentGroup.GroupName; //groupName.Text = currentGroup.GroupName; Groups.SelectedItem = currentGroup; Categories.ItemsSource = currentGroup.Categories; } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
public JsonResult Posts(string mid, string uid, string t, string gid, string cid, int p, int c) { ForumModel model = new ForumModel(); try { var mem = MemberCache.GetMemberDisplay(new Guid(mid)); if (new Guid(uid) == mem.UserId) { long gId = 0; if (!String.IsNullOrEmpty(gid)) gId = Convert.ToInt64(gid); Guid forumId = MemberCache.GetForumIdForMemberLeague(new Guid(mid)); var topics = Forum.GetForumTopics(new Guid(mid), forumId, (ForumOwnerTypeEnum)Enum.Parse(typeof(ForumOwnerTypeEnum), t), gId, c, p, false); model.ForumId = forumId; model.GroupId = gId; for (int i = 0; i < topics.GroupTopics.Count; i++) { ForumGroupModel group = new ForumGroupModel(); group.GroupId = topics.GroupTopics[i].GroupId; group.GroupName = topics.GroupTopics[i].GroupName; group.Categories = topics.Categories; for (int j = 0; j < topics.GroupTopics[i].Topics.Count; j++) { ForumTopicModel topic = new ForumTopicModel(); if (topics.GroupTopics[i].Topics[j].Category != null) { topic.Category = topics.GroupTopics[i].Topics[j].Category.CategoryName; topic.CategoryId = topics.GroupTopics[i].Topics[j].Category.CategoryId; } if (topics.GroupTopics[i].Topics[j].LastPostByMember != null) { topic.LastPostById = topics.GroupTopics[i].Topics[j].LastPostByMember.MemberId; topic.LastPostByName = topics.GroupTopics[i].Topics[j].LastPostByMember.DerbyName; } topic.PostCount = topics.GroupTopics[i].Topics[j].Replies; if (topics.GroupTopics[i].Topics[j].CreatedByMember != null) { topic.StartedById = topics.GroupTopics[i].Topics[j].CreatedByMember.MemberId; topic.StartedByName = topics.GroupTopics[i].Topics[j].CreatedByMember.DerbyName; } topic.StartedRelativeTime = topics.GroupTopics[i].Topics[j].CreatedHuman; topic.TopicId = topics.GroupTopics[i].Topics[j].TopicId; topic.ForumId = forumId; topic.HasRead = topics.GroupTopics[i].Topics[j].IsRead; topic.IsLocked = topics.GroupTopics[i].Topics[j].IsLocked; topic.IsManagerOfTopic = topics.GroupTopics[i].Topics[j].IsManagerOfTopic; topic.IsPinned = topics.GroupTopics[i].Topics[j].IsPinned; topic.IsWatching = topics.GroupTopics[i].Topics[j].IsWatching; topic.TopicName = topics.GroupTopics[i].Topics[j].TopicTitle; topic.ViewCount = topics.GroupTopics[i].Topics[j].ViewCount; topic.LastPostRelativeTime = topics.GroupTopics[i].Topics[j].LastModifiedHuman; group.Topics.Add(topic); } group.UnreadTopicsCount = group.Topics.Where(x => x.HasRead == false).Count(); model.Groups.Add(group); } if (!String.IsNullOrEmpty(cid)) model.CategoryId = Convert.ToInt64(cid); } } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return Json(model, JsonRequestBehavior.AllowGet); }