Beispiel #1
0
        private void BindData()
        {
            Customer toCustomer = null;
            var      replyToPM  = ForumManager.GetPrivateMessageById(this.ReplyToMessageId);

            if (replyToPM != null)
            {
                if (replyToPM.ToUserId == NopContext.Current.User.CustomerId || replyToPM.FromUserId == NopContext.Current.User.CustomerId)
                {
                    toCustomer      = replyToPM.FromUser;
                    txtSubject.Text = string.Format("Re: {0}", replyToPM.Subject);
                }
                else
                {
                    Response.Redirect(CommonHelper.GetStoreLocation() + "privatemessages.aspx");
                }
            }
            else
            {
                toCustomer = CustomerManager.GetCustomerById(this.ToCustomerId);
            }

            if (toCustomer == null || toCustomer.IsGuest)
            {
                Response.Redirect(CommonHelper.GetStoreLocation() + "privatemessages.aspx");
            }

            lblSendTo.Text = Server.HtmlEncode(CustomerManager.FormatUserName(toCustomer));
        }
Beispiel #2
0
        protected void btnWatchTopic_Click(object sender, EventArgs e)
        {
            var forumTopic = ForumManager.GetTopicById(this.TopicId);

            if (forumTopic == null)
            {
                return;
            }

            if (!ForumManager.IsUserAllowedToSubscribe(NopContext.Current.User))
            {
                string loginURL = SEOHelper.GetLoginPageUrl(true);
                Response.Redirect(loginURL);
            }

            var forumSubscription = ForumManager.GetAllSubscriptions(NopContext.Current.User.CustomerId,
                                                                     0, forumTopic.ForumTopicId, 1, 0).FirstOrDefault();

            if (forumSubscription == null)
            {
                forumSubscription = ForumManager.InsertSubscription(Guid.NewGuid(),
                                                                    NopContext.Current.User.CustomerId, 0, forumTopic.ForumTopicId, DateTime.Now);
            }
            else
            {
                ForumManager.DeleteSubscription(forumSubscription.ForumSubscriptionId);
            }

            CommonHelper.ReloadCurrentPage();
        }
        public static string AttachmentsList(Post post, Guid settingsID)
        {
            var           forumManager = ForumManager.GetForumManager(settingsID);
            StringBuilder sb           = new StringBuilder();

            if (post.Attachments.Count <= 0)
            {
                return("");
            }

            sb.Append("<div class=\"tintLight cornerAll borderBase forum_attachmentsBox\">");
            sb.Append("<div class='headerPanel'>" + Resources.ForumUCResource.AttachFiles + "</div>");
            foreach (Attachment attachment in post.Attachments)
            {
                sb.Append("<div id=\"forum_attach_" + attachment.ID + "\" class=\"borderBase  forum_attachItem clearFix\">");
                sb.Append("<table cellspacing='0' cellpadding='0' style='width:100%;'><tr>");
                sb.Append("<td style=\"width:350px;\">");
                sb.Append("<a target=\"_blank\" href=\"" + forumManager.GetAttachmentWebPath(attachment) + "\">" + HttpUtility.HtmlEncode(attachment.Name) + "</a>");
                sb.Append("</td>");

                if (forumManager.ValidateAccessSecurityAction(ForumAction.AttachmentDelete, post))
                {
                    sb.Append("<td style=\"width:100px;\">");
                    sb.Append("<a class=\"linkDescribe" + (SetupInfo.WorkMode == WorkMode.Promo ? " promoAction" : "") + "\" href=\"javascript:ForumManager.DeleteAttachment('" + attachment.ID + "','" + post.ID + "');\">" + Resources.ForumUCResource.DeleteButton + "</a>");
                    sb.Append("</td>");
                }
                sb.Append("<td style=\"text-align:right;\"><span class=\"textMediumDescribe\">" + ((float)attachment.Size / 1024f).ToString("####0.##") + " KB</span></td>");
                sb.Append("</tr></table>");
                sb.Append("</div>");
            }
            sb.Append("</div>");
            return(sb.ToString());
        }
Beispiel #4
0
        public static List <ForumPost> GetUserLatestPosts(int StartIndex, int PageSize, out int totalRecords)
        {
            if (PageSize <= 0)
            {
                PageSize = 10;
            }
            if (PageSize == int.MaxValue)
            {
                PageSize = int.MaxValue - 1;
            }

            int PageIndex = StartIndex / PageSize;

            totalRecords = 0;
            //it's used on profile.aspx page, so we're using UserId query string parameter
            int userId = CommonHelper.QueryStringInt("UserId");
            var user   = CustomerManager.GetCustomerById(userId);

            if (user == null)
            {
                return(new List <ForumPost>());
            }

            var result = ForumManager.GetAllPosts(0,
                                                  user.CustomerId, string.Empty, false, PageSize, PageIndex, out totalRecords);

            return(result);
        }
Beispiel #5
0
        public AjaxResponse DoApprovedPost(int idPost, Guid settingsID)
        {
            _forumManager = Community.Forum.ForumManager.Settings.ForumManager;
            var resp = new AjaxResponse {
                rs2 = idPost.ToString()
            };

            var post = ForumDataProvider.GetPostByID(TenantProvider.CurrentTenantID, idPost);

            if (post == null)
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return(resp);
            }

            if (!_forumManager.ValidateAccessSecurityAction(ForumAction.ApprovePost, post))
            {
                resp.rs1 = "0";
                resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied;
                return(resp);
            }

            try
            {
                ForumDataProvider.ApprovePost(TenantProvider.CurrentTenantID, post.ID);
                resp.rs1 = "1";
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs3 = HttpUtility.HtmlEncode(e.Message);
            }
            return(resp);
        }
Beispiel #6
0
        private void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                int?supportQueueID         = null;
                int selectedSupportQueueID = Convert.ToInt32(cbxSupportQueues.SelectedItem.Value);
                if (selectedSupportQueueID > 0)
                {
                    supportQueueID = selectedSupportQueueID;
                }

                string newThreadWelcomeText       = null;
                string newThreadWelcomeTextAsHTML = null;
                if (tbxNewThreadWelcomeText.Text.Trim().Length > 0)
                {
                    // has specified welcome text, convert to HTML
                    newThreadWelcomeText = tbxNewThreadWelcomeText.Text.Trim();
                    string parserLog, textAsXML;
                    bool   errorsOccured;
                    newThreadWelcomeTextAsHTML = TextParser.TransformUBBMessageStringToHTML(newThreadWelcomeText, ApplicationAdapter.GetParserData(),
                                                                                            out parserLog, out errorsOccured, out textAsXML);
                }

                // store the data as a new forum.
                int forumID = ForumManager.CreateNewForum(HnDGeneralUtils.TryConvertToInt(cbxSections.SelectedItem.Value), tbxForumName.Value,
                                                          tbxForumDescription.Text, chkHasRSSFeed.Checked, supportQueueID, HnDGeneralUtils.TryConvertToInt(cbxThreadListInterval.SelectedValue),
                                                          HnDGeneralUtils.TryConvertToShort(tbxOrderNo.Text), HnDGeneralUtils.TryConvertToInt(tbxMaxAttachmentSize.Text),
                                                          HnDGeneralUtils.TryConvertToShort(tbxMaxNoOfAttachmentsPerMessage.Text), newThreadWelcomeText, newThreadWelcomeTextAsHTML);

                // done for now, redirect to self
                Response.Redirect("AddForum.aspx", true);
            }
        }
Beispiel #7
0
        public static PrivateMessageCollection GetCurrentUserSentPrivateMessages(int StartIndex, int PageSize, out int totalRecords)
        {
            PrivateMessageCollection result = new PrivateMessageCollection();

            if (PageSize <= 0)
            {
                PageSize = 10;
            }
            if (PageSize == int.MaxValue)
            {
                PageSize = int.MaxValue - 1;
            }

            int PageIndex = StartIndex / PageSize;

            totalRecords = 0;

            if (NopContext.Current.User == null)
            {
                return(result);
            }

            result = ForumManager.GetAllPrivateMessages(NopContext.Current.User.CustomerId, 0, null, false, null,
                                                        string.Empty, PageSize, PageIndex, out totalRecords);
            return(result);
        }
Beispiel #8
0
        public static List <PrivateMessage> GetCurrentUserInboxPrivateMessages(int StartIndex, int PageSize, out int totalRecords)
        {
            if (PageSize <= 0)
            {
                PageSize = 10;
            }
            if (PageSize == int.MaxValue)
            {
                PageSize = int.MaxValue - 1;
            }

            int PageIndex = StartIndex / PageSize;

            totalRecords = 0;

            if (NopContext.Current.User == null)
            {
                return(new List <PrivateMessage>());
            }

            var result = ForumManager.GetAllPrivateMessages(0, NopContext.Current.User.CustomerId, null, null, false,
                                                            string.Empty, PageSize, PageIndex, out totalRecords);

            return(result);
        }
Beispiel #9
0
        public void BindData()
        {
            string prefix = "--";

            ddlForums.Items.Clear();
            //insert root item if required
            if (!String.IsNullOrEmpty(this.RootItemText))
            {
                var itemRoot = new ListItem(this.RootItemText, "0");
                this.ddlForums.Items.Add(itemRoot);
            }
            var forumGroups = ForumManager.GetAllForumGroups();

            foreach (var forumGroup in forumGroups)
            {
                var forumGroupItem = new ListItem(forumGroup.Name, "0");
                this.ddlForums.Items.Add(forumGroupItem);

                var forums = forumGroup.Forums;
                foreach (var forum in forums)
                {
                    var forumItem = new ListItem(prefix + forum.Name, forum.ForumId.ToString());
                    this.ddlForums.Items.Add(forumItem);
                    if (forum.ForumId == this.selectedForumId)
                    {
                        forumItem.Selected = true;
                    }
                }
            }

            this.ddlForums.DataBind();
        }
Beispiel #10
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int forumPostId = 0;

            int.TryParse(lblForumPostId.Text, out forumPostId);
            var forumPost = ForumManager.GetPostById(forumPostId);

            if (forumPost != null)
            {
                var forumTopic = forumPost.Topic;
                if (!ForumManager.IsUserAllowedToDeletePost(NopContext.Current.User, forumPost))
                {
                    string loginURL = SEOHelper.GetLoginPageUrl(true);
                    Response.Redirect(loginURL);
                }

                ForumManager.DeletePost(forumPost.ForumPostId);

                string url = string.Empty;
                //get topic one more time because it can be deleted
                forumTopic = ForumManager.GetTopicById(forumPost.TopicId);
                if (forumTopic != null)
                {
                    url = SEOHelper.GetForumTopicUrl(forumTopic.ForumTopicId);
                }
                else
                {
                    url = SEOHelper.GetForumMainUrl();
                }
                Response.Redirect(url);
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int forumPostID = 0;

            int.TryParse(lblForumPostID.Text, out forumPostID);
            ForumPost forumPost = ForumManager.GetPostByID(forumPostID);

            if (forumPost != null)
            {
                ForumTopic forumTopic = forumPost.Topic;
                if (!ForumManager.IsUserAllowedToDeletePost(NopContext.Current.User, forumPost))
                {
                    string loginURL = CommonHelper.GetLoginPageURL(true);
                    Response.Redirect(loginURL);
                }

                ForumManager.DeletePost(forumPost.ForumPostID);

                string url = string.Empty;
                if (forumTopic != null)
                {
                    url = SEOHelper.GetForumTopicURL(forumTopic.ForumTopicID);
                }
                else
                {
                    url = SEOHelper.GetForumMainURL();
                }
                Response.Redirect(url);
            }
        }
Beispiel #12
0
        protected void btnWatchForum_Click(object sender, EventArgs e)
        {
            Forum forum = ForumManager.GetForumByID(this.ForumID);

            if (forum == null)
            {
                return;
            }

            if (!ForumManager.IsUserAllowedToSubscribe(NopContext.Current.User))
            {
                string loginURL = CommonHelper.GetLoginPageURL(true);
                Response.Redirect(loginURL);
            }

            ForumSubscription forumSubscription = ForumManager.GetAllSubscriptions(NopContext.Current.User.CustomerID,
                                                                                   forum.ForumID, 0, 1, 0).FirstOrDefault();

            if (forumSubscription == null)
            {
                forumSubscription = ForumManager.InsertSubscription(Guid.NewGuid(),
                                                                    NopContext.Current.User.CustomerID, forum.ForumID, 0, DateTime.Now);
            }
            else
            {
                ForumManager.DeleteSubscription(forumSubscription.ForumSubscriptionID);
            }

            CommonHelper.ReloadCurrentPage();
        }
        public void BindData()
        {
            string prefix = "--";

            ddlForums.Items.Clear();
            var forumGroups = ForumManager.GetAllForumGroups();

            foreach (var forumGroup in forumGroups)
            {
                var forumGroupItem = new ListItem(forumGroup.Name, "0");
                this.ddlForums.Items.Add(forumGroupItem);

                var forums = forumGroup.Forums;
                foreach (var forum in forums)
                {
                    var forumItem = new ListItem(prefix + forum.Name, forum.ForumId.ToString());
                    this.ddlForums.Items.Add(forumItem);
                    if (forum.ForumId == this.selectedForumId)
                    {
                        forumItem.Selected = true;
                    }
                }
            }

            this.ddlForums.DataBind();
        }
Beispiel #14
0
        protected string GetUnreadPrivateMessages()
        {
            string result = string.Empty;

            if (ForumManager.AllowPrivateMessages &&
                NopContext.Current.User != null && !NopContext.Current.User.IsGuest)
            {
                int totalRecords    = 0;
                var privateMessages = ForumManager.GetAllPrivateMessages(0,
                                                                         NopContext.Current.User.CustomerId, false, null, false, string.Empty, 1, 0, out totalRecords);

                if (totalRecords > 0)
                {
                    result = string.Format(GetLocaleResourceString("PrivateMessages.TotalUnread"), totalRecords);

                    //notifications here
                    if (SettingManager.GetSettingValueBoolean("Common.ShowAlertForPM") &&
                        !NopContext.Current.User.NotifiedAboutNewPrivateMessages)
                    {
                        this.DisplayAlertMessage(string.Format(GetLocaleResourceString("PrivateMessages.YouHaveUnreadPM", totalRecords)));
                        NopContext.Current.User.NotifiedAboutNewPrivateMessages = true;
                    }
                }
            }
            return(result);
        }
        protected void btnDeleteSelected_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    foreach (GridViewRow row in gvForumSubscriptions.Rows)
                    {
                        var cbSelect = row.FindControl("cbSelect") as CheckBox;
                        var hfForumSubscriptionId = row.FindControl("hfForumSubscriptionId") as HiddenField;
                        if (cbSelect != null && cbSelect.Checked && hfForumSubscriptionId != null)
                        {
                            int forumSubscriptionId        = int.Parse(hfForumSubscriptionId.Value);
                            ForumSubscription subscription = ForumManager.GetSubscriptionById(forumSubscriptionId);

                            if (subscription != null && subscription.UserId == NopContext.Current.User.CustomerId)
                            {
                                ForumManager.DeleteSubscription(forumSubscriptionId);
                            }
                        }
                    }
                    gvForumSubscriptions.PageIndex = 0;
                    BindData();
                }
                catch (Exception exc)
                {
                    LogManager.InsertLog(LogTypeEnum.CustomerError, exc.Message, exc);
                }
            }
        }
Beispiel #16
0
        private void BindData()
        {
            PrivateMessage pm = ForumManager.GetPrivateMessageByID(this.PrivateMessageID);

            if (pm != null)
            {
                if (pm.ToUserID != NopContext.Current.User.CustomerID && pm.FromUserID != NopContext.Current.User.CustomerID)
                {
                    Response.Redirect(CommonHelper.GetStoreLocation() + "PrivateMessages.aspx");
                }

                if (!pm.IsRead && pm.ToUserID == NopContext.Current.User.CustomerID)
                {
                    pm = ForumManager.UpdatePrivateMessage(pm.PrivateMessageID, pm.FromUserID, pm.ToUserID,
                                                           pm.Subject, pm.Text, true, pm.IsDeletedByAuthor, pm.IsDeletedByRecipient, pm.CreatedOn);
                }
            }
            else
            {
                Response.Redirect(CommonHelper.GetStoreLocation() + "PrivateMessages.aspx");
            }

            lblFrom.Text    = Server.HtmlEncode(CustomerManager.FormatUserName(pm.FromUser));
            lblTo.Text      = Server.HtmlEncode(CustomerManager.FormatUserName(pm.ToUser));
            lblSubject.Text = Server.HtmlEncode(pm.Subject);
            lblMessage.Text = ForumManager.FormatPrivateMessageText(pm.Text);
        }
Beispiel #17
0
        protected void gvLP_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ForumPost forumPost = (ForumPost)e.Row.DataItem;

                HyperLink hlTopic = e.Row.FindControl("hlTopic") as HyperLink;
                if (hlTopic != null)
                {
                    ForumTopic forumTopic = forumPost.Topic;
                    if (forumTopic != null)
                    {
                        hlTopic.Text        = Server.HtmlEncode(forumTopic.Subject);
                        hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId);
                    }
                }

                Label lblPosted = e.Row.FindControl("lblPosted") as Label;
                if (lblPosted != null)
                {
                    lblPosted.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn, DateTimeKind.Utc).ToString("f");
                }

                Label lblPost = e.Row.FindControl("lblPost") as Label;
                if (lblPost != null)
                {
                    lblPost.Text = ForumManager.FormatPostText(forumPost.Text);
                }
            }
        }
Beispiel #18
0
        public Form1()
        {
            InitializeComponent();
            SubWindow.BackColor      = Color.FromArgb(54, 26, 29);
            panel1.BackColor         = Color.FromArgb(204, 153, 51);
            ContentButton.BackColor  = Color.FromArgb(193, 89, 38);
            SocialButton.BackColor   = Color.FromArgb(193, 89, 38);
            ForumButton.BackColor    = Color.FromArgb(193, 89, 38);
            SettingsButton.BackColor = Color.FromArgb(193, 89, 38);
            ContentButton.ForeColor  = Color.LightGray;
            SocialButton.ForeColor   = Color.LightGray;
            ForumButton.ForeColor    = Color.LightGray;
            SettingsButton.ForeColor = Color.LightGray;
            SettingsButton.FlatAppearance.BorderColor = Color.LightGray;
            ContentButton.FlatAppearance.BorderColor  = Color.LightGray;
            SocialButton.FlatAppearance.BorderColor   = Color.LightGray;
            ForumButton.FlatAppearance.BorderColor    = Color.LightGray;
            ForumManager cm = new ForumManager();

            cm.GetData();
            settingsF  = new SubForms.SettingsForm(sm);
            content    = new SubForms.SBWikiContentForm(sm.Settings, Notifications);
            forum      = new SubForms.SBWikiForumForm(sm.Settings, Notifications);
            social     = new SubForms.SBWikiSocialForm(sm.Settings, Notifications);
            activeform = content;
            SwitchSubform(content);
        }
Beispiel #19
0
        protected void rptrLatestPosts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var forumPost = e.Item.DataItem as ForumPost;

                var hlTopic = e.Item.FindControl("hlTopic") as HyperLink;
                if (hlTopic != null)
                {
                    ForumTopic forumTopic = forumPost.Topic;
                    if (forumTopic != null)
                    {
                        hlTopic.Text        = Server.HtmlEncode(forumTopic.Subject);
                        hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId);
                    }
                }

                var lblPosted = e.Item.FindControl("lblPosted") as Label;
                if (lblPosted != null)
                {
                    lblPosted.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn).ToString("f");
                }

                var lblPost = e.Item.FindControl("lblPost") as Label;
                if (lblPost != null)
                {
                    lblPost.Text = ForumManager.FormatPostText(forumPost.Text);
                }
            }
        }
Beispiel #20
0
        private void BindData()
        {
            var forumGroups = ForumManager.GetAllForumGroups();

            rptrForumGroups.DataSource = forumGroups;
            rptrForumGroups.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _settings = ForumManager.GetSettings(SettingsID);

            _categoryRepeater.DataSource     = Categories;
            _categoryRepeater.ItemDataBound += new RepeaterItemEventHandler(CategoryRepeater_ItemDataBound);
            _categoryRepeater.DataBind();
        }
Beispiel #22
0
 public ForumsPage()
 {
     this.InitializeComponent();
     Forum  = ForumManager.GetForums();
     Forum2 = ForumManager.GetForums2();
     Forum3 = ForumManager.GetForums3();
     Forum4 = ForumManager.GetForums4();
 }
        public override FileUploadHandler.FileUploadResult ProcessUpload(HttpContext context)
        {
            var result = new FileUploadResult()
            {
                Success = false
            };

            try
            {
                if (ProgressFileUploader.HasFilesToUpload(context))
                {
                    var settingsID = new Guid(context.Request["SettingsID"]);
                    var settings   = ForumManager.GetSettings(settingsID);
                    var thread     = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, Convert.ToInt32(context.Request["ThreadID"]));
                    if (thread == null)
                    {
                        return(result);
                    }

                    var forumManager       = settings.ForumManager;
                    var offsetPhysicalPath = string.Empty;
                    forumManager.GetAttachmentVirtualDirPath(thread, settingsID, new Guid(context.Request["UserID"]), out offsetPhysicalPath);

                    var file = new ProgressFileUploader.FileToUpload(context);

                    var newFileName  = GetFileName(file.FileName);
                    var origFileName = newFileName;

                    var i     = 1;
                    var store = forumManager.GetStore();
                    while (store.IsFile(offsetPhysicalPath + "\\" + newFileName))
                    {
                        var ind = origFileName.LastIndexOf(".");
                        newFileName = ind != -1 ? origFileName.Insert(ind, "_" + i.ToString()) : origFileName + "_" + i.ToString();
                        i++;
                    }

                    result.FileName = newFileName;
                    result.FileURL  = store.Save(offsetPhysicalPath + "\\" + newFileName, file.InputStream).ToString();
                    result.Data     = new
                    {
                        OffsetPhysicalPath = offsetPhysicalPath + "\\" + newFileName,
                        FileName           = newFileName,
                        Size        = file.ContentLength,
                        ContentType = file.FileContentType,
                        SettingsID  = settingsID
                    };
                    result.Success = true;
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }

            return(result);
        }
Beispiel #24
0
        protected void BindData()
        {
            try
            {
                string keywords = txtSearchTerm.Text.Trim();

                if (!String.IsNullOrEmpty(keywords))
                {
                    //can be removed
                    if (String.IsNullOrEmpty(keywords))
                    {
                        throw new NopException(LocalizationManager.GetLocaleResourceString("Forum.SearchTermCouldNotBeEmpty"));
                    }

                    int searchTermMinimumLength = SettingManager.GetSettingValueInteger("Search.ForumSearchTermMinimumLength", 3);
                    if (keywords.Length < searchTermMinimumLength)
                    {
                        throw new NopException(string.Format(LocalizationManager.GetLocaleResourceString("Forum.SearchTermMinimumLengthIsNCharacters"), searchTermMinimumLength));
                    }

                    int totalRecords = 0;
                    int pageSize     = 10;
                    if (ForumManager.SearchResultsPageSize > 0)
                    {
                        pageSize = ForumManager.SearchResultsPageSize;
                    }

                    var forumTopics = ForumManager.GetAllTopics(0, 0, keywords, true,
                                                                pageSize, this.CurrentPageIndex, out totalRecords);
                    if (forumTopics.Count > 0)
                    {
                        this.searchPager1.PageSize     = pageSize;
                        this.searchPager1.TotalRecords = totalRecords;
                        this.searchPager1.PageIndex    = this.CurrentPageIndex;

                        this.searchPager2.PageSize     = pageSize;
                        this.searchPager2.TotalRecords = totalRecords;
                        this.searchPager2.PageIndex    = this.CurrentPageIndex;

                        rptrSearchResults.DataSource = forumTopics;
                        rptrSearchResults.DataBind();
                    }

                    rptrSearchResults.Visible = (forumTopics.Count > 0);
                    lblNoResults.Visible      = !(rptrSearchResults.Visible);
                }
                else
                {
                    rptrSearchResults.Visible = false;
                }
            }
            catch (Exception exc)
            {
                rptrSearchResults.Visible = false;
                lblError.Text             = Server.HtmlEncode(exc.Message);
            }
        }
Beispiel #25
0
        void BindData()
        {
            ForumGroupCollection forumGroups = ForumManager.GetAllForumGroups();

            btnAddNewForum.Visible = forumGroups.Count > 0;

            rptrForumGroups.DataSource = forumGroups;
            rptrForumGroups.DataBind();
        }
Beispiel #26
0
 public TopicsController(
     UserManager <ApplicationUser> userManager,
     ForumManager forumManager,
     ILogger <TopicsController> logger)
 {
     this.userManager  = userManager;
     this.forumManager = forumManager;
     this.logger       = logger;
 }
        public async Task GetForumCategoriesAsync_Test()
        {
            var          WebClient    = Setup.SetupWebClient().Result;
            ForumManager forumManager = new ForumManager(WebClient);
            var          forumCatList = await forumManager.GetForumCategoriesAsync();

            Assert.NotNull(forumCatList);
            Assert.True(forumCatList.Any());
        }
Beispiel #28
0
 public ForumSiteManager(ProjectRepository projectRepository, MetadataRepository metadataRepository, ForumManager forumManager,
                         ForumSiteUrlHelper forumSiteUrlHelper, IOptions <ForumOption> forumOptions, IMapper mapper)
 {
     m_projectRepository  = projectRepository;
     m_metadataRepository = metadataRepository;
     m_forumManager       = forumManager;
     m_forumSiteUrlHelper = forumSiteUrlHelper;
     m_mapper             = mapper;
     m_forumOptions       = forumOptions.Value;
 }
Beispiel #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Forum forum = ForumManager.GetForumById(this.ForumId);

            if (forum != null)
            {
                string title = forum.Name;
                SEOHelper.RenderTitle(this, title, true);
            }
        }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumTopic forumTopic = ForumManager.GetTopicById(this.TopicId);

            if (forumTopic != null)
            {
                string title = forumTopic.Subject;
                SEOHelper.RenderTitle(this, title, true);
            }
        }