本文整理汇总了C#中Forum类的典型用法代码示例。如果您正苦于以下问题:C# Forum类的具体用法?C# Forum怎么用?C# Forum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Forum类属于命名空间,在下文中一共展示了Forum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateForumsList
public void updateForumsList(Forum[] forums)
{
clearList();
for (int i = 0; i < forums.Length; i++)
createNewLine(forums[i].forumName);
}
示例2: Page_Load
//页面加载
protected void Page_Load(object sender, EventArgs e)
{
try
{
id = Int32.Parse(Request.QueryString["id"]).ToString();
}
catch
{
Response.Redirect("../Default.aspx");
return;
}
index = Int32.Parse(floor.Value);
if (Request.QueryString["id"] != null)
{
RepeaterDataBind();
SubjectInfo si = new Forum().GetSubjectById(Convert.ToInt32(Request.QueryString["id"]));
lbTitle.Text = "主题:" + si.StrTheme;
UserControl_ThemeOfMsg theme = this.ThemeOfMsg1;
theme.Subject = si;
}
//第一次加载
if (!IsPostBack)
{
//胡媛媛添加,使游客无法发表留言,2010-6-22
if (Session["UserName"] == null)
{
submitMsg.Enabled = false;
}
//胡媛媛添加,使游客无法发表留言,2010-6-22
}
}
示例3: ForumUpdate_WithoutUid_ThrowsError
public void ForumUpdate_WithoutUid_ThrowsError()
{
var commentForum = new Forum { Id = "" };
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var site = mocks.DynamicMock<ISite>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
//readerCreator.Stub(x => x.CreateDnaDataReader("getmoderationclasslist")).Return(reader);
mocks.ReplayAll();
var context = new Context(null, readerCreator, cacheManager, null);
try
{
context.UpdateForum(commentForum, site, null);
throw new Exception("Error not thrown within code");
}
catch (ApiException ex)
{
Assert.AreEqual("Forum uid is empty, null or exceeds 255 characters.", ex.Message);
Assert.AreEqual(ErrorType.InvalidForumUid, ex.type);
}
readerCreator.AssertWasNotCalled(x => x.CreateDnaDataReader("commentforumcreate"));
}
示例4: AdminDialog
public AdminDialog(int forumId, string adderUsrName, string adderPswd, Forum.RegPolicy policy)
{
InitializeComponent();
this.forumId = forumId;
this.pswd = adderPswd;
this.usrName = adderUsrName;
initAddRemoveTab();
initModeratorPermissionsTab();
initMessagesTab();
initCommentsTab();
initRepliersTab();
//show confirm option only if this is the forum policy
if (policy == Forum.RegPolicy.ADMIN_CONFIRMATION)
{
initConfirmUsersTab();
}
else
{
for (int i = 0; i < tabControl1.TabPages.Count; i++)
{
if (tabControl1.TabPages[i].Name.Equals("tabConfirm", StringComparison.OrdinalIgnoreCase))
{
tabControl1.TabPages.RemoveAt(i);
break;
}
}
}
}
示例5: GetAccessFlag
public AccessFlag GetAccessFlag(User user, Forum forum) {
// TODO:
return AccessFlag.Create | AccessFlag.Delete | AccessFlag.Moderator |
AccessFlag.Poll | AccessFlag.Priority | AccessFlag.Priority |
AccessFlag.Read | AccessFlag.Reply | AccessFlag.Update |
AccessFlag.Upload | AccessFlag.Vote;
}
示例6: Save_Click
protected void Save_Click(Object sender, EventArgs e)
{
if (IsValid)
{
Forum _frm = new Forum(this.ConnectionString);
if (ViewState["forumId"] != null)
{
_frm.LitePopulate(ViewState["forumId"], false);
}
_frm.Title = txt_Title.Text;
_frm.Description = txt_Desc.Text;
_frm.Active = ch_Active.Checked;
if (_frm.Save())
{
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('Record has been updated successfully.');self.location = 'Forums.aspx';", true);
}
else
{
lbl_Error.Text = "An unexpected error has occurred. Please try again.";
lbl_Error.Visible = true;
}
}
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
HtmlGenericControl _nc = (HtmlGenericControl)Master.FindControl("navForum");
_nc.Attributes.Add("class", "active");
String _forumId = Request.QueryString["forumId"];
if (!String.IsNullOrEmpty(_forumId))
{
ViewState.Add("forumId", _forumId);
Forum _frm = new Forum(this.ConnectionString);
_frm.LitePopulate(ViewState["forumId"], false);
txt_Desc.Text = _frm.Description;
txt_Title.Text = _frm.Title;
ch_Active.Checked = _frm.Active;
lbl_Header.Text = String.Format("{0}", _frm.Title);
}
else
{
lbl_Header.Text = "Add Forum";
}
}
}
示例8: ChangeTopicForum
public void ChangeTopicForum(int topicid, int forumid)
{
ForumInfo newforum = new Forum().GetById(forumid);
string updateSql = "UPDATE " + Config.ForumTablePrefix + "TOPICS SET [email protected], [email protected] WHERE [email protected]; ";
if (newforum.Status == (int)Enumerators.PostStatus.Closed) //forum locked so lock all posts
{
updateSql = updateSql + "UPDATE " + Config.ForumTablePrefix + "TOPICS SET T_STATUS=0 WHERE [email protected]; ";
updateSql = updateSql + "UPDATE " + Config.ForumTablePrefix + "REPLY SET R_STATUS=0 WHERE [email protected]; ";
}
else if (newforum.ModerationLevel == (int) Enumerators.Moderation.UnModerated)
{
//change status of posts if coming from moderated forum
updateSql = updateSql + "UPDATE " + Config.ForumTablePrefix + "TOPICS SET T_STATUS=1 WHERE [email protected] AND T_STATUS > 1; ";
updateSql = updateSql + "UPDATE " + Config.ForumTablePrefix + "REPLY SET R_STATUS=1 WHERE [email protected] AND R_STATUS > 1; ";
}
updateSql = updateSql + "UPDATE " + Config.ForumTablePrefix + "REPLY SET [email protected], [email protected] WHERE [email protected]; ";
List<SqlParameter> parms = new List<SqlParameter>
{
new SqlParameter("@TopicId", SqlDbType.Int) {Value = topicid},
new SqlParameter("@ForumId", SqlDbType.Int) {Value = forumid},
new SqlParameter("@CatId", SqlDbType.Int) {Value = newforum.CatId}
};
SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, updateSql, parms.ToArray());
}
示例9: About
public ActionResult About()
{
var f = new Forum();
f.Name = "Hi";
_forumRepo.Add(f);
return View();
}
示例10: SetAvailableShortName
public void SetAvailableShortName(Forum forum)
{
if (forum == null || forum.ShortName == null)
{
throw new ArgumentNullException("Forum.ShortName");
}
forum.ShortName = _dataAccess.GetAvailableShortName(forum.ShortName);
}
示例11: GetModeratorLinks
protected string GetModeratorLinks(Forum forum, string linkStyle, string separator)
{
if (forum.Moderators == null || forum.Moderators.Count < 1)
return "-";
else
{
return GetModeratorLinks(forum.Moderators, linkStyle, separator);
}
}
示例12: BindData
protected void BindData()
{
Forum _for = new Forum(this.ConnectionString);
gv_Forum.DataSource = _for.GetForums(true);
gv_Forum.DataBind();
gv_ForumNotActive.DataSource = _for.GetForums(false);
gv_ForumNotActive.DataBind();
}
示例13: HasPermission
protected bool HasPermission(Forum forum)
{
ManageForumPermissionSetNode managePermission = PostBOV5.Instance.GetForumPermissonSet(forum);
bool has = managePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.DeleteAnyThreads);
if (IsRecycleBin && has == false)
has = managePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.ApproveThreads);
return has;
}
示例14: Create
public Forum Create(string name)
{
using (var context = _contextManager.GetContext())
{
var forum = new Forum(name);
context.Add(forum);
context.SaveChanges();
return forum;
}
}
示例15: GetATopic
public static Topic GetATopic(Forum forum)
{
var topicService = TestHelper.Resolve<ITopicsService>();
List<Topic> topicList = topicService.GetByForum(forum.Id, 0, 1, null);
if (topicList.Count == 0)
{
Assert.Inconclusive("There is no topic in the db to perform this test.");
}
Topic topic = topicService.Get(topicList[0].Id);
return topic;
}