当前位置: 首页>>代码示例>>C#>>正文


C# Forum.Save方法代码示例

本文整理汇总了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;
            }
        }
    }
开发者ID:noximus,项目名称:TopOfTheRock,代码行数:26,代码来源:EditForum.aspx.cs

示例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();
    }
开发者ID:noximus,项目名称:TopOfTheRock,代码行数:22,代码来源:Forums.aspx.cs

示例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();
//.........这里部分代码省略.........
开发者ID:greaterwinner,项目名称:ra-brix,代码行数:101,代码来源:ArticlePublisherController.cs


注:本文中的Forum.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。