示例#1
0
        protected void cmdRevert_Click(object sender, EventArgs e)
        {
            if (CommunitySecurity.IsOutsider())
            {
                throw new SecurityException();
            }

            int ver;

            if (int.TryParse((sender as LinkButton).CommandName, out ver))
            {
                var page = Wiki.GetPage(PageNameUtil.Decode(WikiPage), ver);
                if (page != null)
                {
                    page.Date    = TenantUtil.DateTimeNow();
                    page.UserID  = SecurityContext.CurrentAccount.ID;
                    page.Version = Wiki.GetPageMaxVersion(page.PageName) + 1;

                    Wiki.SavePage(page);
                    Wiki.UpdateCategoriesByPageContent(page);

                    BindHistoryList();
                }
            }
        }
示例#2
0
        public string GetBookmarkRaiting(Bookmark b, UserBookmark ub, string divID, string singleBookmarkDivID)
        {
            if (CommunitySecurity.IsOutsider())
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            using (StringWriter sw = new StringWriter(sb))
            {
                using (HtmlTextWriter textWriter = new HtmlTextWriter(sw))
                {
                    using (var c = LoadControl(BookmarkUserControlPath.BookmarkRaitingUserControlPath) as BookmarkRaitingUserControl)
                    {
                        c.Bookmark            = b;
                        c.UserBookmark        = ub;
                        c.DivId               = divID;
                        c.SingleBookmarkDivID = singleBookmarkDivID;
                        c.RenderControl(textWriter);
                    }
                }
            }
            return(sb.ToString());
        }
示例#3
0
        public bool IsUserVote(string userId)
        {
            if (CommunitySecurity.IsOutsider())
            {
                return(true);
            }

            return(Answers.Exists(a => a.UserId == userId));
        }
示例#4
0
        public string GetBookmarkRaiting(Bookmark b)
        {
            if (CommunitySecurity.IsOutsider())
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            using (StringWriter sw = new StringWriter(sb))
            {
                using (HtmlTextWriter textWriter = new HtmlTextWriter(sw))
                {
                    using (var c = LoadControl(BookmarkUserControlPath.BookmarkRaitingUserControlPath) as BookmarkRaitingUserControl)
                    {
                        c.SimpleModeRaiting = ServiceHelper.GetUserBookmarksCount(b);
                        c.SimpleMode        = true;
                        c.Bookmark          = b;
                        c.RenderControl(textWriter);
                    }
                }
            }
            return(sb.ToString());
        }