本文整理汇总了C#中Forum.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Forum.Save方法的具体用法?C# Forum.Save怎么用?C# Forum.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
}
示例2: Updade_Click
protected void Updade_Click(object sender, EventArgs e)
{
Forum _st = null;
foreach (GridViewRow I in gv_Forum.Rows)
{
Label _id = (Label)I.FindControl("lbl_Id");
if (_id != null)
{
TextBox _sort = (TextBox)I.FindControl("txt_Sort");
if (Regex.IsMatch(_sort.Text, @"\d+", RegexOptions.IgnoreCase))
{
_st = new Forum(this.ConnectionString);
_st.LitePopulate(_id.Text, false);
_st.Sort = Convert.ToInt32(_sort.Text);
_st.Save();
}
}
}
BindData();
}
示例3: ShowSpecificArticle
private static bool ShowSpecificArticle(string contentId)
{
// Loading actual Article...
Article a = Article.FindArticle(contentId);
if (a == null)
return false;
Node node = new Node();
// Showing bookmarks module
if (Users.LoggedInUserName != null)
{
ActiveEvents.Instance.RaiseLoadControl(
"ArticlePublisherModules.Favorites",
"dynMid");
node["AddToExistingCollection"].Value = true;
}
// Showing search
ActiveEvents.Instance.RaiseLoadControl(
"ArticlePublisherModules.SearchArticles",
"dynMid",
node);
// Incrementing view count
a.ViewCount += 1;
a.Save();
// Setting title of page
((System.Web.UI.Page)HttpContext.Current.CurrentHandler).Title = a.Header;
node = new Node();
node["AddToExistingCollection"].Value = true;
node["ModuleSettings"]["Header"].Value = a.Header;
node["ModuleSettings"]["Body"].Value = a.Body;
node["ModuleSettings"]["Date"].Value = a.Published;
node["ModuleSettings"]["Ingress"].Value = a.Ingress;
node["ModuleSettings"]["ArticleID"].Value = a.ID;
node["ModuleSettings"]["ViewCount"].Value = a.ViewCount;
node["ModuleSettings"]["Author"].Value = a.Author == null ? "unknown" : a.Author.Username;
node["ModuleSettings"]["MainImage"].Value = ApplicationRoot.Root + a.MainImage;
if (!string.IsNullOrEmpty(Users.LoggedInUserName))
{
Bookmark bookmark = Bookmark.SelectFirst(
Criteria.Eq("User.Username", Users.LoggedInUserName),
Criteria.Eq("Article.URL", a.URL));
node["ModuleSettings"]["Bookmarked"].Value = bookmark != null;
}
else
{
node["ModuleSettings"]["Bookmarked"].Value = false;
}
node["ModuleSettings"]["BookmarkedBy"].Value =
Bookmark.CountWhere(
Criteria.Eq("Article.URL", a.URL));
if (!string.IsNullOrEmpty(Users.LoggedInUserName))
{
User user = User.SelectFirst(Criteria.Eq("Username", Users.LoggedInUserName));
node["ModuleSettings"]["ShowFollow"].Value = !string.IsNullOrEmpty(user.Email);
}
else
{
node["ModuleSettings"]["ShowFollow"].Value = false;
}
node["ModuleSettings"]["IsFollowing"].Value = a.Followers.Exists(
delegate(User idxUser)
{
return idxUser.Username == Users.LoggedInUserName;
});
ActiveEvents.Instance.RaiseLoadControl(
"ArticlePublisherModules.ViewArticle",
"dynMid",
node);
// Then loading tags
node = new Node();
int idxNo = 0;
foreach (Tag idx in a.Tags)
{
node["ModuleSettings"]["Tags"]["Tag" + idxNo]["Name"].Value = idx.Name;
node["ModuleSettings"]["Tags"]["Tag" + idxNo]["URL"].Value = "tags/" +
HttpContext.Current.Server.UrlEncode(idx.Name) + ConfigurationManager.AppSettings["DefaultPageExtension"];
idxNo += 1;
}
node["AddToExistingCollection"].Value = true;
node["ModuleSettings"]["CenterAlign"].Value = true;
ActiveEvents.Instance.RaiseLoadControl(
"ArticlePublisherModules.ShowTags",
"dynMid",
node);
// Then loading Forum
if (Settings.Instance.Get<bool>("UseForumsForArticles", true))
{
node = new Node();
Forum forum = Forum.SelectFirst(Criteria.Eq("Name", a.URL));
if (forum == null)
{
// Making sure we're creating a forum if none already exists for this article...
forum = new Forum();
//.........这里部分代码省略.........