protected void Page_Load(object sender, System.EventArgs e) { configAgent = ((IStateProcessor)Parent).ConfigAgent; m_NewThreadLnk.Visible = configAgent.IsThreadCreationAllowed(); ArticleManager mgr = new ArticleManager(configAgent); ForumData data = mgr.ThreadRootData; data.Forum.DefaultView.Sort = "Id DESC"; m_ForumTable.DataSource = data.Forum.DefaultView; m_ForumTable.DataBind(); }
protected void Page_Load(object sender, System.EventArgs e) { configAgent = ((IStateProcessor)Parent).ConfigAgent; ArticleManager mgr = new ArticleManager(configAgent); m_Data = mgr.SearchResults; m_SearchResultsTable.DataSource = m_Data; m_SearchResultsTable.DataBind(); string szHits = Portal.API.Language.GetText(Portal.API.Module.GetModuleControl(this), "Hits"); m_StateLbl.Text = m_Data.Rows.Count + " " + szHits; }
protected void m_SubmitBtn_Click(object sender, System.EventArgs e) { // Wurde kein Titel eingegeben, darf der Beitrag nicht gespeichert werden. if (m_TitleTB.Text.Length == 0) { return; } // Das Erfassen von Artikeln wird durch den ArticleManager erledigt. ArticleManager mgr = new ArticleManager(configAgent); if (configAgent.IsThreadMessage()) { if (configAgent.Module.Page.User.Identity.IsAuthenticated) { mgr.AddThreadArticle(configAgent.ThreadFile, configAgent.ParentMessage, m_UserIdTB.Text, m_TitleTB.Text, m_TextTB.Text); } else { mgr.AddThreadArticle(configAgent.ThreadFile, configAgent.ParentMessage, m_NameTB.Text, m_EmailTB.Text, m_TitleTB.Text, m_TextTB.Text); } } else { if (configAgent.Module.Page.User.Identity.IsAuthenticated) { mgr.AddForumArticle(configAgent.ThreadFile, m_UserIdTB.Text, m_TitleTB.Text, m_TextTB.Text); } else { mgr.AddForumArticle(configAgent.ThreadFile, m_NameTB.Text, m_EmailTB.Text, m_TitleTB.Text, m_TextTB.Text); } } ((IStateProcessor)Parent).SetEvent(StateEvents.ShowThread); }
protected void m_SearchTB_TextChanged(object sender, System.EventArgs e) { if (m_SearchTB.Text.Trim().Length == 0) { return; } ArticleManager mgr = new ArticleManager(configAgent); mgr.ResetSearch(); configAgent.SearchText = HttpUtility.HtmlEncode(m_SearchTB.Text); ((IStateProcessor)Parent).SetEvent(StateEvents.SearchText); }
private void m_SearchResultsTable_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "ShowThread") { ArticleManager mgr = new ArticleManager(configAgent); mgr.ResetSearch(); string szCmdArg = (string)e.CommandArgument; string threadFile = szCmdArg.Substring(0, szCmdArg.IndexOf(":")); int nId = int.Parse(szCmdArg.Substring(szCmdArg.IndexOf(":") + 1)); configAgent.ThreadFile = threadFile; configAgent.ArticleToShow = nId; ((IStateProcessor)Parent).SetEvent(StateEvents.ShowThread); } }
private void Bind() { // Einlesen der Threaddaten. ArticleManager mgr = new ArticleManager(configAgent); ThreadData data = mgr.GetThreadData(configAgent.ThreadFile); data.Thread.DefaultView.Sort = "DateTime DESC"; // Ermitteln der Row, welche den Root-Node enthält. ThreadData.ThreadRow root = null; foreach (ThreadData.ThreadRow r in data.Thread.Rows) { if (r.Id == 0) { root = r; break; } } //ThreadData.ThreadRow root = data.Thread.FindById(0); // Initialisieren des Datensets. m_Data = new DataTable(); m_Data.Columns.Add("Title", typeof(string)); m_Data.Columns.Add("Text", typeof(string)); m_Data.Columns.Add("Author", typeof(string)); m_Data.Columns.Add("Email", typeof(string)); m_Data.Columns.Add("UserId", typeof(string)); m_Data.Columns.Add("Depth", typeof(int)); m_Data.Columns.Add("Id", typeof(int)); m_Data.Columns.Add("Parent", typeof(int)); m_Data.Columns.Add("DateTime", typeof(DateTime)); // Zusammenstellen eines neuen Datensets. if (null != root) { AddThreadMessage(root, 0); m_ThreadTable.DataSource = m_Data; m_ThreadTable.DataBind(); } }
private void m_ThreadTable_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "Answer") { configAgent.ParentMessage = int.Parse(e.CommandArgument.ToString()); ((IStateProcessor)Parent).SetEvent(StateEvents.NewArticle); } else if (e.CommandName == "Delete") { ArticleManager mgr = new ArticleManager(configAgent); int nArticleId = int.Parse(e.CommandArgument.ToString()); mgr.DeleteArticle(nArticleId); if (nArticleId == 0) { ((IStateProcessor)Parent).SetEvent(StateEvents.CancelToForumView); } else { Bind(); } } }
protected void m_SubmitBtn_Click(object sender, System.EventArgs e) { // Wurde kein Titel eingegeben, darf der Beitrag nicht gespeichert werden. if (m_TitleTB.Text.Length == 0) return; // Das Erfassen von Artikeln wird durch den ArticleManager erledigt. ArticleManager mgr = new ArticleManager(configAgent); if (configAgent.IsThreadMessage()) { if (configAgent.Module.Page.User.Identity.IsAuthenticated) { mgr.AddThreadArticle(configAgent.ThreadFile, configAgent.ParentMessage, m_UserIdTB.Text, m_TitleTB.Text, m_TextTB.Text); } else { mgr.AddThreadArticle(configAgent.ThreadFile, configAgent.ParentMessage, m_NameTB.Text, m_EmailTB.Text, m_TitleTB.Text, m_TextTB.Text); } } else { if (configAgent.Module.Page.User.Identity.IsAuthenticated) { mgr.AddForumArticle(configAgent.ThreadFile, m_UserIdTB.Text, m_TitleTB.Text, m_TextTB.Text); } else { mgr.AddForumArticle(configAgent.ThreadFile, m_NameTB.Text, m_EmailTB.Text, m_TitleTB.Text, m_TextTB.Text); } } ((IStateProcessor)Parent).SetEvent(StateEvents.ShowThread); }
protected void m_SearchTB_TextChanged(object sender, System.EventArgs e) { if (m_SearchTB.Text.Trim().Length == 0) return; ArticleManager mgr = new ArticleManager(configAgent); mgr.ResetSearch(); configAgent.SearchText = HttpUtility.HtmlEncode(m_SearchTB.Text); ((IStateProcessor)Parent).SetEvent(StateEvents.SearchText); }
private void m_SearchResultsTable_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "ShowThread") { ArticleManager mgr = new ArticleManager(configAgent); mgr.ResetSearch(); string szCmdArg = (string)e.CommandArgument; string threadFile = szCmdArg.Substring(0, szCmdArg.IndexOf(":")); int nId = int.Parse(szCmdArg.Substring(szCmdArg.IndexOf(":")+1)); configAgent.ThreadFile = threadFile; configAgent.ArticleToShow = nId; ((IStateProcessor)Parent).SetEvent(StateEvents.ShowThread); } }
protected void m_CancelBtn_Click(object sender, System.EventArgs e) { ArticleManager mgr = new ArticleManager(configAgent); mgr.ResetSearch(); ((IStateProcessor)Parent).SetEvent(StateEvents.CancelToForumView); }