public void GoToForum(string ForumPageName) { BoardForum forum = _forumRepository.GetForumByPageName(ForumPageName); BoardCategory category = _categoryRepository.GetCategoryByCategoryID(forum.CategoryID); _redirector.GoToForumsForumView(forum.PageName, category.PageName); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi(ICaptchaSolver captchaSolver = null) { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Board = new BoardCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); Execute = new ExecuteCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; _captchaSolver = captchaSolver; }
public void GoToForum() { BoardForum forum = _boardForumRepository.GetForumByGroupID(_webContext.GroupID); BoardCategory category = _boardCategoryRepository.GetCategoryByCategoryID(forum.CategoryID); _redirector.GoToForumsForumView(forum.PageName, category.PageName); }
public void LoadForum(BoardForum forum, List <BoardPost> threads, BoardCategory category, Group group) { uc.forum = forum; uc.category = category; uc.Threads = threads; uc.group = group; pnlForum.Controls.Add(uc); }
public async Task <BoardCategory> AddBoardCategoryAsync(BoardCategory category) { var entity = await _Context.BoardCategories.AddAsync(category); await _Context.SaveChangesAsync(); return(entity.Entity); }
public void DeleteCategory(BoardCategory category) { using (SPKTDataContext dc = _conn.GetContext()) { dc.BoardCategories.Attach(category, true); dc.BoardCategories.DeleteOnSubmit(category); dc.SubmitChanges(); } }
public void SaveNewBoard(BoardCategory category) { category.CreateDate = DateTime.Now; category.LastPostDate = DateTime.Now; category.PostCount = 0; category.ThreadCount = 0; category.LastPostByAccountID = 0; category.LastPostByUsername = null; _categoryRepository.SaveCategory(category); }
public static BoardCategoryModel ToBoardCategoryModel(this BoardCategory category) { return(new BoardCategoryModel() { BoardCategoryId = category.BoardCategoryId, BoardId = category.BoardId, Name = category.Name, Description = category.Description }); }
public BoardCategory GetCategoryByCategoryID(Int32 CategoryID) { BoardCategory result; using (SPKTDataContext dc = _conn.GetContext()) { BoardCategory bc = dc.BoardCategories.Where(c => c.CategoryID == CategoryID).FirstOrDefault(); result = bc; } return(result); }
protected void Button1_Click(object sender, EventArgs e) { BoardCategory cate = new BoardCategory(); BoardCategoryRepository re = new BoardCategoryRepository(); cate = re.GetCategoryByCategoryID(1); cate.Name = "Truwowng"; BoardCategoryRepository re2 = new BoardCategoryRepository(); re2.SaveCategory(cate); }
public Int64 SavePost(BoardPost boardPost) { using (SPKTDataContext dc = _conn.GetContext()) { if (boardPost.PostID > 0) { dc.BoardPosts.Attach(boardPost, true); } else { //get the parent containers when a new post is created // to update their post counts BoardCategory bc = (from c in dc.BoardCategories join f in dc.BoardForums on c.CategoryID equals f.CategoryID where f.ForumID == boardPost.ForumID select c).FirstOrDefault(); BoardForum bf = (from f in dc.BoardForums where f.ForumID == boardPost.ForumID select f).FirstOrDefault(); //update the thread count if (boardPost.IsThread) { bc.ThreadCount = bc.ThreadCount + 1; bf.ThreadCount = bf.ThreadCount + 1; } //update the post count else { bc.PostCount = bc.PostCount + 1; bf.PostCount = bf.PostCount + 1; //update post count on thread BoardPost bThread = null; if (boardPost.ThreadID != 0) { bThread = (from p in dc.BoardPosts where p.PostID == boardPost.ThreadID select p).FirstOrDefault(); } if (bThread != null) { bThread.ReplyCount = bThread.ReplyCount + 1; } } dc.BoardPosts.InsertOnSubmit(boardPost); } dc.SubmitChanges(); } return(boardPost.PostID); }
public void AddNewBoardThreadAlert(BoardCategory category, BoardForum forum, BoardPost post) { Init(); alert.AlertTypeID = (int)AlertType.AlertTypes.NewBoardThread; alertMessage = "<div class=\"AlertHeader\">" + GetProfileImage(_userSession.CurrentUser.AccountID) + GetProfileUrl(_userSession.CurrentUser.UserName) + " has just added a new thread on the board: <b>" + post.Name + "</b></div>"; alertMessage += "<div class=\"AlertRow\"><a href=\"" + _webContext.RootUrl + "forums/" + category.PageName + "/" + forum.PageName + "/" + post.PageName + ".aspx" + "\">" + _webContext.RootUrl + "forums/" + category.PageName + "/" + forum.PageName + "/" + post.PageName + ".aspx</a></div>"; alert.Message = alertMessage; SaveAlert(alert); SendAlertToFriends(alert); }
public void AddNewBoardPostAlert(BoardCategory category, BoardForum forum, BoardPost post, BoardPost thread, Group group) { Init(); alert.AlertTypeID = (int)AlertType.AlertTypes.NewBoardPost; alertMessage = "<div class=\"AlertHeader\">" + GetProfileImage(_userSession.CurrentUser.AccountID) + GetProfileUrl(_userSession.CurrentUser.UserName) + " has just added a new post: <b>" + post.Name + "</b></div>"; /*alertMessage += "<div class=\"AlertRow\"><a href=\"" + _webContext.RootUrl + "forums/" + category.PageName + * "/" + forum.PageName + "/" + thread.PageName + ".aspx" + "\">" + _webContext.RootUrl + * "forums/" + category.PageName + "/" + forum.PageName + "/" + thread.PageName + * ".aspx</a></div>";*/ alertMessage += "<div class=\"AlertRow\"><a href=\"" + _webContext.RootUrl + "Groups/ViewGroupForumPost" + ".aspx?PostID=" + post.PostID + "&GroupID=" + group.GroupID + "</a></div>"; alert.Message = alertMessage; SaveAlert(alert); SendAlertToGroup(alert, group); }
public Int32 SaveCategory(BoardCategory category) { category.UpdateDate = DateTime.Now; using (SPKTDataContext dc = _conn.GetContext()) { if (category.CategoryID > 0) { dc.BoardCategories.Attach(category, true); } else { dc.BoardCategories.InsertOnSubmit(category); } dc.SubmitChanges(); } return(category.CategoryID); }
public void LoadData() { Group group = _groupRepository.GetGroupByID(_webContext.GroupID); List <Account> accounts = _groupService.GetAllMemberByGroupID(group.GroupID); _view.LoadData(group, accounts); if (_webContext.CurrentUser != null) { _view.ShowRequestMembership(true); } else { _view.ShowRequestMembership(false); } //is this public or private data? if (group.IsPublic) { _view.ShowPrivate(true); _view.ShowPublic(true); } else if (ViewerIsMember()) { _view.ShowPrivate(true); _view.ShowPublic(true); } else { _view.ShowPrivate(false); _view.ShowPublic(true); } BoardForum forum = _boardForumRepository.GetForumByGroupID(group.GroupID); BoardCategory category = _boardCategoryRepository.GetCategoryByPageName("Group Forum"); List <BoardPost> threads = _boardPostRepository.GetThreadsByForumID(forum.ForumID); //_view.LoadForum(forum,threads,category); _view.LoadDataPost(_boardPostRepository.GetPostByID(_webContext.PostID), _boardPostRepository.GetPostsByThreadID(_webContext.PostID), forum, group); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi(ICaptchaSolver captchaSolver = null) { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Board = new BoardCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); Execute = new ExecuteCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; _captchaSolver = captchaSolver; }
public void Save(BoardPost post) { //is new thread if (_webContext.LoggedIn) { post.ReplyByAccountID = _webContext.AccountID; post.ReplyByUsername = _webContext.CurrentUser.UserName; if (_webContext.PostID > 0) { BoardPost postToReplyToo = _postRepository.GetPostByID(_webContext.PostID); if (postToReplyToo.IsThread) { post.ThreadID = postToReplyToo.PostID; } else { //if post.ThreadID = postToReplyToo.ThreadID thì ở thread show tất cả bình luận. post.ThreadID = postToReplyToo.PostID; } post.ForumID = postToReplyToo.ForumID; } else if (_webContext.ForumID > 0) { post.ForumID = _webContext.ForumID; post.IsThread = _webContext.IsThread; if (!_postRepository.CheckPostPageNameIsUnique(post.PageName)) { _view.SetErrorMessage("The page name you are trying to use is already in use!"); return; } } post.CreateDate = DateTime.Now; post.UpdateDate = DateTime.Now; post.AccountID = _webContext.CurrentUser.AccountID; post.Username = _webContext.CurrentUser.UserName; post.ReplyCount = 0; post.ViewCount = 0; if (post.PageName != null) { post.PageName = post.PageName.Replace(" ", "-"); } else { post.PageName = post.Name; post.PageName = post.PageName.Replace(" ", "-"); } post.PostID = _postRepository.SavePost(post); BoardForum forum = _forumRepository.GetForumByID(post.ForumID); forum.LastPostByAccountID = post.AccountID; forum.LastPostByUsername = post.Username; _forumRepository.SaveForum(forum); BoardCategory category = _categoryRepository.GetCategoryByCategoryID(forum.CategoryID); category.LastPostByAccountID = post.AccountID; category.LastPostByUsername = post.Username; _categoryRepository.SaveCategory(category); BoardPost thread; if (post.IsThread) { thread = _postRepository.GetPostByID(post.PostID); } else { thread = _postRepository.GetPostByID((long)post.ThreadID); } //is this forum part of a group? Group group = _groupRepository.GetGroupByForumID(forum.ForumID); //add an alert to the filter if (post.IsThread) { //is this a group forum? if (group != null) { _alertService.AddNewBoardThreadAlert(category, forum, thread, group); } else { _alertService.AddNewBoardThreadAlert(category, forum, thread); } } else { //is this a group forum? if (group != null) { _alertService.AddNewBoardPostAlert(category, forum, post, thread, group); } else { _alertService.AddNewBoardPostAlert(category, forum, post, thread); } } //_redirector.GoToForumsViewPost(forum.PageName, category.PageName, thread.PageName); if (_webContext.IsThread == false) { _redirector.Redirect("~/Groups/ViewGroupForumPost.aspx?PostID=" + _webContext.PostID + "&GroupID=" + _webContext.GroupID); } else { _redirector.Redirect("~/Groups/ViewGroup.aspx?GroupID=" + _webContext.GroupID); } } else { _redirector.GoToAccountLoginPage(); } }
public void AddNewBoardPostAlert(BoardCategory category, BoardForum forum, BoardPost post, BoardPost thread, Group group) { throw new NotImplementedException(); }
public void AddNewBoardThreadAlert(BoardCategory category, BoardForum forum, BoardPost post) { throw new NotImplementedException(); }
public AddCategoryPresenter() { _categoryService = new BoardService(); boardCategory = new BoardCategory(); }
/// <summary> /// 카테고리 데이터를 이용하여 생성 /// </summary> /// <param name="dataBoardCategory"></param> public BoardCategoryModel(BoardCategory dataBoardCategory) { this.idBoardCategory = dataBoardCategory.idBoardCategory; this.Title = dataBoardCategory.Title; }