Esempio n. 1
0
        public BoardPost ViewPost(int?postId)
        {
            var results = (from brd in context.BoardPosts
                           where brd.PostId == postId
                           select new
            {
                brd.Board_id,
                brd.PostId,
                brd.PostSubject,
                brd.PostContent,
                brd.Status,
                brd.CreateDt,
                brd.CreateId,
                brd.UpdateDt,
                brd.UpdateId
            }).FirstOrDefault();


            var viweModel = new BoardPost
            {
                Board_id    = results.Board_id,
                PostId      = results.PostId,
                PostSubject = results.PostSubject,
                PostContent = results.PostContent,
                Status      = results.Status,
                CreateDt    = results.CreateDt,
                CreateId    = results.CreateId,
                UpdateDt    = results.UpdateDt,
                UpdateId    = results.UpdateId
            };

            return(viweModel);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bpData"></param>
        /// <param name="uiData"></param>
        /// <param name="uiData_Forwarding"></param>
        /// <param name="typeBoardItem"></param>
        public void Reset(BoardPost bpData
                          , UserInfo uiData
                          , UserInfo uiData_Forwarding
                          , BoardItemType typeBoardItem)
        {
            this.idBoardPost       = bpData.idBoardPost;
            this.idBoard           = bpData.idBoard;
            this.idBoardCategory   = bpData.idBoardCategory;
            this.Title             = bpData.Title;
            this.idUser            = bpData.idUser;
            this.idUser_Forwarding = bpData.idUser_Forwarding;
            this.ViewCount         = bpData.ViewCount;
            this.ViewCountNone     = bpData.ViewCountNone;
            this.ReplyCount        = bpData.ReplyCount;
            this.ThumbnailUrl      = bpData.ThumbnailUrl;
            this.PostState         = bpData.PostState;
            this.WriteDate         = bpData.WriteDate;
            this.EditDate          = bpData.EditDate;

            this.UserName = uiData.ViewName;
            if (null != uiData_Forwarding)
            {
                this.UserName_Forwarding = uiData_Forwarding.ViewName;
            }

            this.ItemType = typeBoardItem;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="bpData"></param>
        /// <param name="uiData"></param>
        /// <param name="uiData_Forwarding"></param>
        /// <param name="bcData"></param>
        public void Reset(BoardPost bpData
                          , UserInfo uiData
                          , UserInfo uiData_Forwarding
                          , BoardContent bcData)
        {
            this.idBoardPost       = bpData.idBoardPost;
            this.idBoard           = bpData.idBoard;
            this.idBoardCategory   = bpData.idBoardCategory;
            this.Title             = bpData.Title;
            this.idUser            = bpData.idUser;
            this.idUser_Forwarding = bpData.idUser_Forwarding;
            this.ViewCount         = bpData.ViewCount;
            this.ViewCountNone     = bpData.ViewCountNone;
            this.WriteDate         = bpData.WriteDate;
            this.EditDate          = bpData.EditDate;


            this.UserName = uiData.ViewName;
            if (null != uiData_Forwarding)
            {
                this.UserName_Forwarding = uiData_Forwarding.ViewName;
            }



            this.Content = bcData.Content;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="bpData"></param>
 /// <param name="uiData"></param>
 /// <param name="typeBoardItem"></param>
 public BoardPostListModel(BoardPost bpData
                           , UserInfo uiData
                           , BoardItemType typeBoardItem)
 {
     this.Reset(bpData
                , uiData
                , typeBoardItem);
 }
Esempio n. 5
0
 public void LoadDataPost(BoardPost boardPost, List <BoardPost> list, BoardForum forum, Group group)
 {
     ViewPostUC.Thread = boardPost;
     ViewPostUC.Posts  = list;
     ViewPostUC.forum  = forum;
     ViewPostUC.group  = group;
     pnlForum.Controls.Add(ViewPostUC);
 }
Esempio n. 6
0
        // GET: BoardPosts/Create
        public IActionResult BoardCreate(int id)
        {
            BoardPost post = new BoardPost
            {
                ClubId = id
            };

            return(View(post));
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bpData"></param>
        /// <param name="uiData"></param>
        /// <param name="bcData"></param>
        public BoardPostViewResultModel(BoardPost bpData
                                        , UserInfo uiData
                                        , BoardContent bcData)
        {
            this.ReplyList  = false;
            this.ReplyWrite = false;

            this.Reset(bpData, uiData, bcData);
        }
Esempio n. 8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BoardPost post = new BoardPost();

            post.Name = txtName.Text;
            //post.PageName = txtPageName.Text;
            // post.Post = txtPost.Text;
            post.Post = Editor1.Content;

            _presenter.Save(post);
        }
Esempio n. 9
0
        public BoardPost GetPostByPageName(string PageName)
        {
            BoardPost result = null;

            using (SPKTDataContext dc = _conn.GetContext())
            {
                BoardPost post = dc.BoardPosts.Where(p => p.PageName == PageName).FirstOrDefault();
                result = post;
            }
            return(result);
        }
Esempio n. 10
0
        public ActionResult <ApiResultBaseModel> TestPostAdd(
            [FromForm] int nBoardId)
        {
            ApiResultReady rrResult = new ApiResultReady(this);

            DateTime dtNow  = DateTime.Now;
            int      nCount = 0;

            //유저 정보 추출
            ClaimModel cm = new ClaimModel(((ClaimsIdentity)User.Identity).Claims);
            //이 유저가 해당 관리 등급이 있는지 확인한다.
            ManagementClassCheckType typePC
                = GlobalStatic.MgtA.MgtClassCheck(cm.id_int
                                                  , ManagementClassType.Admin);


            if (typePC == ManagementClassCheckType.Ok)
            {
                using (SpaNetCoreFoundationContext db1 = new SpaNetCoreFoundationContext())
                {
                    for (int i = 0; i < 300; ++i)
                    {
                        ++nCount;

                        //포스트
                        BoardPost newBP = new BoardPost();
                        newBP.idBoard   = nBoardId;
                        newBP.idUser    = cm.id_int;
                        newBP.Title     = string.Format("테스트용 데이터 {0} - {1} ", nCount, dtNow);
                        newBP.WriteDate = dtNow;

                        db1.BoardPost.Add(newBP);
                        db1.SaveChanges();


                        //컨탠츠
                        BoardContent newBC = new BoardContent();
                        newBC.idBoard     = newBP.idBoard;
                        newBC.idBoardPost = newBP.idBoardPost;
                        newBC.Content     = string.Format("테스트용 내용 {0} - {1} ", nCount, dtNow);

                        db1.BoardContent.Add(newBC);
                        db1.SaveChanges();
                    }
                }//end using db1
            }
            else
            {
                //에러
                rrResult.InfoCode = ApiResultType.PermissionCheckError.ToString();
            }

            return(rrResult.ToResult());
        }
Esempio n. 11
0
        public BoardPost GetPostByID(Int64 PostID)
        {
            BoardPost result = null;

            using (SPKTDataContext dc = _conn.GetContext())
            {
                BoardPost post = dc.BoardPosts.Where(p => p.PostID == PostID).FirstOrDefault();
                result = post;
            }
            return(result);
        }
Esempio n. 12
0
        public void OnPost(string content)
        {
            var newPost = new BoardPost {
                userId   = (int)HttpContext.Session.GetInt32("userId"),
                content  = content,
                postedOn = DateTime.Now
            };

            db.BoardPosts.Add(newPost);
            db.SaveChanges();
            OnGet();
        }
Esempio n. 13
0
        public ActionResult GetAjaxPlaintext(JsonDecryptionModel jdm)
        {
            JsonResult json = new JsonResult();

            int    id;
            bool   succeeded = int.TryParse(jdm.Id, out id);
            string password  = jdm.Password; // replace

            string ciphertxt;                // replace
            string plaintext = "";           // output
            string algo;

            byte[] salt;
            byte[] iv;

            try
            {
                using (DataModel dm = new Data.DataModel())
                {
                    BoardPost bp = dm.BoardPosts.Where(x => x.Id == id).FirstOrDefault();
                    ciphertxt = bp.Content;
                    algo      = bp.EncryptionAlgorithm;
                    salt      = bp.Salt;
                    iv        = bp.IV;
                }

                Crypto Crypto = new Crypto();
                Crypto.Salt = salt;
                Crypto.IV   = iv;

                switch (algo.ToLower())
                {
                case ("aes128"):
                    plaintext = (string)Crypto.Crypt(CryptType.Decrypt, CryptAlgo.AES128, ciphertxt, password);
                    break;

                case ("aes192"):
                    plaintext = (string)Crypto.Crypt(CryptType.Decrypt, CryptAlgo.AES192, ciphertxt, password);
                    break;

                case ("aes256"):
                    plaintext = (string)Crypto.Crypt(CryptType.Decrypt, CryptAlgo.AES256, ciphertxt, password);
                    break;

                default:
                    throw new Exception("Something went very wrong.");
                }
            }

            catch (Exception ex) { Console.WriteLine(ex.Message); }

            return(Json(new { success = true, ptxt = plaintext }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        public void SavePost(BoardPost postInfo, string[] PostAttachs)
        {
            if (string.IsNullOrEmpty(postInfo.PostId.ToString()) || postInfo.PostId == 0)
            {
                postInfo.Status   = "0001";
                postInfo.UpdateDt = DateTime.Now;
                postInfo.CreateDt = DateTime.Now;
                postInfo.CreateId = System.Web.HttpContext.Current.User.Identity.GetUserId();
                postInfo.UpdateId = System.Web.HttpContext.Current.User.Identity.GetUserId();

                context.BoardPosts.Add(postInfo);
                context.SaveChanges();
            }
            else
            {
                var updateRow = (from bpost in context.BoardPosts
                                 where bpost.PostId == postInfo.Board_id
                                 select bpost).Single();

                updateRow.PostSubject = postInfo.PostSubject;
                updateRow.PostContent = postInfo.PostContent;
                updateRow.UpdateDt    = DateTime.Now;
                updateRow.UpdateId    = System.Web.HttpContext.Current.User.Identity.GetUserId();

                var deletRow = (from bAttach in context.BoardAttachs
                                where bAttach.PostId == postInfo.PostId
                                select bAttach).FirstOrDefault();

                context.BoardAttachs.Remove(deletRow);
            }

            //foreach (var item in postInfo.PostAttach)

            if (postInfo.PostAttach != null)
            {
                for (int i = 0; i < postInfo.PostAttach.Length; i++)
                {
                    var boardAttach = new BoardAttach();
                    boardAttach.PostId = postInfo.PostId;
                    //boardAttach.FileId = postInfo.PostAttach[i];

                    JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                    dynamic dobj = jsonSerializer.Deserialize <dynamic>(postInfo.PostAttach[i]);

                    //string obj = JsonConvert.DeserializeObject<string>(postInfo.PostAttach[i].ToString());
                    boardAttach.FileId = dobj[0].ToString();

                    context.BoardAttachs.Add(boardAttach);
                    context.SaveChanges();
                }
            }
        }
Esempio n. 16
0
 public void DeletePost(BoardPost boardPost)
 {
     using (SPKTDataContext dc = _conn.GetContext())
     {
         dc.BoardPosts.Attach(boardPost, true);
         //if this is a thread then we need to delete all of it's children
         if (boardPost.IsThread)
         {
             dc.BoardPosts.DeleteAllOnSubmit(dc.BoardPosts.Where(bp => bp.ThreadID == boardPost.PostID));
         }
         dc.BoardPosts.DeleteOnSubmit(boardPost);
         dc.SubmitChanges();
     }
 }
Esempio n. 17
0
        public async Task <IActionResult> BoardCreate([Bind("PostId,Title,Director,PostTime,Message,ClubId")] BoardPost boardPost)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                boardPost.Director = user.FullName;
                boardPost.PostTime = DateTime.Now;
                _context.Add(boardPost);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(BoardIndex), new { id = boardPost.ClubId }));
            }
            return(View(boardPost));
        }
Esempio n. 18
0
        public async Task <IActionResult> CreateThread(SubmitViewModel vm, IFormFile file)
        {
            await googleRecaptchaHelper.VerifyRecaptcha(Request, ModelState);

            if (!ModelState.IsValid)
            {
                return(Submit());
            }

            var post = new BoardPost
            {
                Text       = vm.Text.Trim(),
                DatePosted = DateTime.Now
            };

            if (string.IsNullOrEmpty(vm.ImageUrl) == false)
            {
                try
                {
                    post.Image = await writer.DownloadImageFromUrl(vm.ImageUrl);
                }
                catch
                {
                    logger.LogError("An error occured while trying to download image from " + vm.ImageUrl);
                    ModelState.AddModelError("ImageUrl", "Došlo je do greške. Provjerite ispravnost poveznice.");
                    return(Submit());
                }
            }
            else if (IsImageFileValid(file))
            {
                post.Image = await writer.UploadImage(file);
            }

            var thread = new BoardThread
            {
                PostCount  = 0,
                ImageCount = file == null ? 0 : 1,
                IsLocked   = false,
                Posts      = new List <BoardPost> {
                    post
                }
            };

            boardRepo.AddThread(thread);
            RemoveLastThread();

            return(RedirectToAction("Thread", "Board", new { thread.Id }));
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
        public void LoadData(BoardPost Thread, List <BoardPost> Posts)
        {
            linkUsername.Text        = Thread.Username;
            linkUsername.NavigateUrl = "../" + Thread.Username;
            lblUpdateDate.Text       = Thread.UpdateDate.ToShortDateString();
            lblCreateDate.Text       = Thread.CreateDate.ToShortDateString();
            lblSubject.Text          = Thread.Name;
            //lblDescription.Text = Thread.Post.Filter();
            lblSubject.Text     = Thread.Name;
            lblDescription.Text = Thread.Post;

            imgProfile.ImageUrl   = "/Image/ProfileAvatar.aspx?AccountID=" + Thread.AccountID.ToString();
            linkReply.Text        = "Reply";
            linkReply.NavigateUrl = "/Forums/Post.aspx?PostID=" + Thread.PostID.ToString();

            repPosts.DataSource = Posts;
            repPosts.DataBind();
        }
Esempio n. 22
0
        public bool CheckPostPageNameIsUnique(string PageName)
        {
            bool result;

            using (SPKTDataContext dc = _conn.GetContext())
            {
                BoardPost bp = dc.BoardPosts.Where(p => p.PageName == PageName).FirstOrDefault();
                if (bp != null)
                {
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
Esempio n. 23
0
        public void AddPostToThread(BoardPost boardPost, long threadId)
        {
            boardPost.DatePosted = DateTime.Now;

            BoardThread thread = context.BoardThreads
                                 .Include(x => x.Posts)
                                 .FirstOrDefault(x => x.Id == threadId);

            if (!string.IsNullOrEmpty(boardPost.Image))
            {
                thread.ImageCount++;
            }

            thread.PostCount++;
            thread?.Posts.Add(boardPost);

            context.SaveChanges();
        }
Esempio n. 24
0
        public void LoadData(BoardPost Thread, List <BoardPost> Posts, BoardForum forum, Group group)
        {
            linkUsername.Text        = Thread.Username;
            linkUsername.NavigateUrl = "../" + Thread.Username;
            lblUpdateDate.Text       = Thread.UpdateDate.ToShortDateString();
            lblCreateDate.Text       = Thread.CreateDate.ToShortDateString();
            lblSubject.Text          = Thread.Name;
            //lblDescription.Text = Thread.Post.Filter();
            lblSubject.Text     = Thread.Name;
            lblDescription.Text = Thread.Post;

            imgProfile.ImageUrl = "/Image/ProfileAvatar.aspx?AccountID=" + Thread.AccountID.ToString();
            linkReply.Text      = "Bình Luận";
            //linkReply.NavigateUrl = "/Forums/Post.aspx?PostID=" + Thread.PostID.ToString();

            linkReply.NavigateUrl = "/Groups/PostGroupforum.aspx?PostID=" + Thread.PostID.ToString() + "&IsThread=" + false + "&ForumID=" + forum.ForumID + "&GroupID=" + group.GroupID;
            repPosts.DataSource   = Posts;
            repPosts.DataBind();
        }
Esempio n. 25
0
        public ActionResult SavePost(BoardPost postInfo, string[] PostAttachs)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    dbPost.SavePost(postInfo, PostAttachs);

                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }

                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                var error = ex.Message.ToString();
                return(Json(new { success = false, SaveError = error }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 26
0
        public List <BoardPost> GetPostsByThreadID(Int64 ThreadID)
        {
            List <BoardPost> result;

            using (SPKTDataContext dc = _conn.GetContext())
            {
                //increment the view count for this thread
                BoardPost thread = dc.BoardPosts.Where(p => p.PostID == ThreadID).FirstOrDefault();
                if (thread != null)
                {
                    thread.ViewCount += 1;
                }
                dc.SubmitChanges();

                IEnumerable <BoardPost> posts = dc.BoardPosts.Where(p => p.ThreadID == ThreadID && !p.IsThread).OrderBy(p => p.CreateDate);
                result = posts.ToList();
            }
            return(result);
        }
Esempio n. 27
0
        public BoardPost PostDetails(int?id)
        {
            var results = (from brd in context.BoardPosts
                           where brd.PostId == id
                           select new
            {
                brd.Board_id,
                brd.PostId,
                brd.PostSubject,
                brd.PostContent,
                brd.CreateDt,
                brd.CreateId,
                brd.UpdateDt,
                brd.UpdateId
            }).FirstOrDefault();


            if (results != null)
            {
                var viweModel = new BoardPost
                {
                    Board_id     = results.Board_id,
                    PostId       = results.PostId,
                    PostSubject  = results.PostSubject,
                    PostContent  = results.PostContent,
                    CreateDt     = results.CreateDt,
                    CreateId     = results.CreateId,
                    UpdateDt     = results.UpdateDt,
                    UpdateId     = results.UpdateId,
                    LikeCount    = (from postlike in context.BoardLikes where postlike.PostId == results.PostId && postlike.IsLike == 1 select postlike).Count(),
                    DisLikeCount = (from postlike in context.BoardLikes where postlike.PostId == results.PostId && postlike.IsLike == 0 select postlike).Count(),
                };

                return(viweModel);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="bpData"></param>
        /// <param name="uiData"></param>
        /// <param name="bcData"></param>
        public void Reset(BoardPost bpData
                          , UserInfo uiData
                          , BoardContent bcData)
        {
            this.idBoardPost     = bpData.idBoardPost;
            this.idBoard         = bpData.idBoard;
            this.idBoardCategory = bpData.idBoardCategory;
            this.Title           = bpData.Title;
            this.idUser          = bpData.idUser;
            this.ViewCount       = bpData.ViewCount;

            this.PostState = bpData.PostState;
            this.WriteDate = bpData.WriteDate;
            this.EditDate  = bpData.EditDate;


            this.UserName = uiData.ViewName;


            this.Content = bcData.Content;


            this.FileInfoList = new List <FileInfoModel>();
        }
Esempio n. 29
0
        public async Task <IActionResult> BoardEdit(int id, [Bind("PostId,Title,Message")] BoardPost boardPost)
        {
            if (id != boardPost.PostId)
            {
                return(NotFound());
            }

            var _boardPost = await _context.BoardPost.FirstOrDefaultAsync(m => m.PostId == id);

            if (ModelState.IsValid)
            {
                try
                {
                    var user = await _userManager.GetUserAsync(User);

                    _boardPost.Title      = boardPost.Title;
                    _boardPost.Message    = boardPost.Message;
                    _boardPost.EditedTime = DateTime.Now;
                    _context.Update(_boardPost);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoardPostExists(boardPost.PostId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(BoardIndex), new { id = _boardPost.ClubId }));
            }
            return(RedirectToAction(nameof(BoardEdit), new { id = _boardPost.ClubId }));
        }
Esempio n. 30
0
 public void AddNewBoardPostAlert(BoardCategory category, BoardForum forum, BoardPost post, BoardPost thread, Group group)
 {
     throw new NotImplementedException();
 }
Esempio n. 31
0
 public void AddNewBoardThreadAlert(BoardCategory category, BoardForum forum, BoardPost post)
 {
     throw new NotImplementedException();
 }
Esempio n. 32
0
        void Application_PostResolveRequestCache(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;
            HttpContext     context     = application.Context;

            string[] extensionsToExclude = { ".axd", ".jpg", ".gif", ".png", ".xml", ".config", ".css", ".js", ".htm", ".html" };
            foreach (string s in extensionsToExclude)
            {
                if (application.Request.PhysicalPath.ToLower().Contains(s))
                {
                    return;
                }
            }

            if (!System.IO.File.Exists(application.Request.PhysicalPath))
            {
                if (application.Request.PhysicalPath.ToLower().Contains("blogs"))
                {
                    string[] arr          = application.Request.PhysicalPath.ToLower().Split('\\');
                    string   blogPageName = arr[arr.Length - 1];
                    string   blogUserName = arr[arr.Length - 2];
                    blogPageName = blogPageName.Replace(".aspx", "");

                    if (blogPageName.ToLower() != "profileimage" && blogUserName.ToLower() != "profileavatar")
                    {
                        if (blogPageName == "default")
                        {
                            return;
                        }

                        Account accountBlog = _accountRepository.GetAccountByUsername(blogUserName);

                        if (accountBlog == null)
                        {
                            return;
                        }

                        Blog blog = _blogRepository.GetBlogByPageName(blogPageName, accountBlog.AccountID);

                        context.RewritePath("~/blogs/ViewPost.aspx?BlogID=" + blog.BlogID.ToString());
                    }
                    else
                    {
                        return;
                    }
                }

                else if (application.Request.PhysicalPath.ToLower().Contains("groups") && _webContext.GroupID == 0)
                {
                    string[] arr           = application.Request.PhysicalPath.ToLower().Split('\\');
                    string   groupPageName = arr[arr.Length - 1];
                    groupPageName = groupPageName.Replace(".aspx", "");
                    Group group = _groupRepository.GetGroupByPageName(groupPageName);
                    context.RewritePath("/groups/viewgroup.aspx?GroupID=" + group.GroupID.ToString());
                }
                else if (application.Request.PhysicalPath.ToLower().Contains("mygroups") && application.Request.PhysicalPath.ToLower().Contains("groups"))
                {
                    context.RewritePath("/groups/mygroups.aspx");
                }

                else if (application.Request.PhysicalPath.ToLower().Contains("forums"))
                {
                    string[] arr              = application.Request.PhysicalPath.ToLower().Split('\\');
                    int      forumsPosition   = 0;
                    int      itemsAfterForums = 0;
                    string   categoryPageName = "";
                    string   forumPageName    = "";
                    string   postPageName     = "";

                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i].ToLower() == "forums")
                        {
                            forumsPosition = i;
                            break;
                        }
                    }

                    itemsAfterForums = (arr.Length - 1) - forumsPosition;

                    if (itemsAfterForums == 2)
                    {
                        categoryPageName = arr[arr.Length - 2];
                        forumPageName    = arr[arr.Length - 1];
                        forumPageName    = forumPageName.Replace(".aspx", "");
                        BoardForum forum = _forumRepository.GetForumByPageName(forumPageName);
                        context.RewritePath("/forums/ViewForum.aspx?ForumID=" + forum.ForumID.ToString() +
                                            "&CategoryPageName=" + categoryPageName + "&ForumPageName=" + forumPageName, true);
                    }
                    else if (itemsAfterForums == 3)
                    {
                        categoryPageName = arr[arr.Length - 3];
                        forumPageName    = arr[arr.Length - 2];
                        postPageName     = arr[arr.Length - 1];
                        postPageName     = postPageName.Replace(".aspx", "");
                        BoardPost post = _postRepository.GetPostByPageName(postPageName);
                        context.RewritePath("/forums/ViewPost.aspx?PostID=" + post.PostID.ToString(), true);
                    }
                }
                else
                {
                    HttpResponse Response = context.Response;
                    HttpRequest  Request  = context.Request;
                    String       Username = Request.Path.Replace("/", "");
                    //
                    Account account = _accountRepository.GetAccountByUsername(Username);
                    _redirector = new Redirector();
                    if (account != null)
                    {
                        _redirector.Redirect("~/Profiles/UserProfile2.aspx?AccountID=" + account.AccountID.ToString());
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }