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


C# DataLayer.GetBlogBy_BlogID方法代码示例

本文整理汇总了C#中DataLayer.GetBlogBy_BlogID方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.GetBlogBy_BlogID方法的具体用法?C# DataLayer.GetBlogBy_BlogID怎么用?C# DataLayer.GetBlogBy_BlogID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLayer的用法示例。


在下文中一共展示了DataLayer.GetBlogBy_BlogID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnAddComment_Click

    protected void btnAddComment_Click(object sender, EventArgs e)
    {
        if ((User.Identity.IsAuthenticated) || (tbxCode.Text == Session["CaptchaImageText"].ToString()))
        {
            int iBlogID = Convert.ToInt32(Request.QueryString["bid"]);
            DataLayer dl = new DataLayer();
            DataTable dtBlog = dl.GetBlogBy_BlogID(iBlogID);
            string sName = "";
            if (User.Identity.IsAuthenticated)
            {
                dl.AddComment(User.Identity.Name, DateTime.Now, tbxAddComment.Text, "Blog", cbxThumbsUp.Checked, iBlogID, "");
                sName = dl.GetFullMemberNameBy_Email(User.Identity.Name);
            }
            else
            {
                dl.AddComment("ANON|" + tbxAnonymousName.Text + "|" + tbxAnonymousWebsite.Text, DateTime.Now, tbxAddComment.Text, "Blog", false, iBlogID, "");
                sName = tbxAnonymousName.Text;
            }

            SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
            MailMessage mm;
            mm = new MailMessage();
            mm.BodyFormat = MailFormat.Html;
            mm.To = "[email protected];[email protected]";
            mm.From = "[email protected]";
            mm.Subject = "Someone posted a blog comment.";
            mm.Body = sName + " posted a comment on a blog: " + dtBlog.Rows[0].ItemArray[3].ToString();
            mm.Body += "<br /><br />Here is the comment:<br />" + tbxAddComment.Text;
            mm.Body += "<br /><br /><a href=\"http://www.referralnetworx.com/Blog.aspx?bid=" + iBlogID.ToString() + "\">Click to view</a>";
            SmtpMail.Send(mm);

            if (User.Identity.Name.ToLower() != dtBlog.Rows[0].ItemArray[1].ToString().ToLower())
            {
                mm = new MailMessage();
                mm.BodyFormat = MailFormat.Html;
                mm.To = dtBlog.Rows[0].ItemArray[1].ToString();
                mm.From = "[email protected]";
                mm.Subject = "Someone posted a comment on your blog.";
                mm.Body = sName + " posted a comment on your blog titled: " + dtBlog.Rows[0].ItemArray[3].ToString();
                mm.Body += "<br /><a href=\"http://www.referralnetworx.com/Blog.aspx?bid=" + iBlogID.ToString() + "\">Click to view</a>";
                SmtpMail.Send(mm);
            }

            Session["resultColor"] = "#009900";
            Session["resultTitle"] = "Comment Added";
            Session["resultMessage"] = "Thank you for your comment!";
            Session["resultReturnURL"] = Request.RawUrl;
            Response.Redirect("Result.aspx", true);
        }
        else
        {
            cvInvalidCode.IsValid = false;
        }
    }
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:54,代码来源:Blog.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            Session["CaptchaImageText"] = CaptchaImage.GenerateRandomCode(random);
        }

        if (!User.Identity.IsAuthenticated)
        {
            anonymousbox.Visible = true;
            anonymousbox2.Visible = true;
            cbxThumbsUp.Visible = false;
        }
        else
        {
            anonymousbox.Visible = false;
            anonymousbox2.Visible = false;
        }

        int iPageNumber = 0;
        if (Request.QueryString["p"] != null)
        {
            iPageNumber = Convert.ToInt32(Request.QueryString["p"]);
        }

        int iBlogID = 0;
        if (Request.QueryString["bid"] == null)
        {
            Response.Redirect("Blogs.aspx", true);
        }
        else
        {
            iBlogID = Convert.ToInt32(Request.QueryString["bid"]);
        }

        DataLayer dl = new DataLayer();
        int iMaxPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(dl.GetBlogCommentCount(iBlogID)) / 15m));
        pageNav1.NumPages = iMaxPages;
        pageNav2.NumPages = iMaxPages;
        DataTable dtBlog = dl.GetBlogBy_BlogID(iBlogID);
        if (dtBlog.Rows.Count == 0)
        {
            this.Title = "No Blog Found";
            blogtitle.InnerText = "No Blog Found";
            addcomment.Visible = false;
        }
        else
        {
            if (dtBlog.Rows[0].ItemArray[5].ToString() == "Members Only")
            {
                if (!User.Identity.IsAuthenticated)
                {
                    Session["resultColor"] = "#ff0000";
                    Session["resultTitle"] = "Members Only";
                    Session["resultMessage"] = "This is a members only blog.<br />You must log in first.";
                    Session["resultReturnURL"] = "Blogs.aspx";
                    Response.Redirect("Result.aspx", true);
                }
            }

            DataTable dtComments = dl.GetFifteenBlogCommentsBy_Page(iPageNumber, iBlogID);

            if (User.Identity.IsAuthenticated)
            {
                if (dl.GaveBlogThumbsUpAlready(iBlogID, User.Identity.Name) || (User.Identity.Name.ToLower() == dtBlog.Rows[0].ItemArray[1].ToString().ToLower()))
                {
                    cbxThumbsUp.Visible = false;
                }
                else
                {
                    cbxThumbsUp.Visible = true;
                }
            }

            this.Title = dtBlog.Rows[0].ItemArray[3].ToString();
            blogtitle.InnerText = dtBlog.Rows[0].ItemArray[3].ToString();
            postedby.InnerHtml = "Posted by <a href=\"Profile.aspx?member=" + dtBlog.Rows[0].ItemArray[1].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dtBlog.Rows[0].ItemArray[1].ToString()) + "</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" + Convert.ToDateTime(dtBlog.Rows[0].ItemArray[2]).ToString("D") + "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" + dl.GetBlogCommentCount(Convert.ToInt32(dtBlog.Rows[0].ItemArray[0])) + " Comment(s)&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<!-- AddThis Button BEGIN --><script type=\"text/javascript\">var addthis_pub=\"chevex\"; var addthis_hide_embed = true;</script><a href=\"http://www.addthis.com/bookmark.php?v=20\" onmouseover=\"return addthis_open(this, '', '[URL]', '[TITLE]')\" onmouseout=\"addthis_close()\" onclick=\"return addthis_sendto()\"><img src=\"http://s7.addthis.com/static/btn/sm-share-en.gif\" width=\"83\" height=\"16\" alt=\"Bookmark and Share\" style=\"border:0;\"/></a><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/200/addthis_widget.js\"></script><!-- AddThis Button END -->";
            blogcontent.InnerHtml = dtBlog.Rows[0].ItemArray[4].ToString().Replace("~", "") + "<br /><br /><b>" + dl.GetBlogThumbsUpCount(iBlogID).ToString() + " Thumbs Up!</b>";

            bool bColored = true;
            foreach (DataRow dr in dtComments.Rows)
            {
                string sEmail = "";
                string sLink = "";
                string sAvatar = "";
                string sName = "";
                string sSignature = "";

                if (dr.ItemArray[1].ToString().StartsWith("ANON"))
                {
                    string[] sSplit = dr.ItemArray[1].ToString().Split('|');
                    sLink = sSplit[2];
                    sAvatar = "images/MemberAvatars/no_avatar.gif";
                    sName = sSplit[1];
                }
                else
                {
                    DataTable dtMember = dl.GetMemberBy_Email(dr.ItemArray[1].ToString());

                    sEmail = dtMember.Rows[0].ItemArray[0].ToString();
//.........这里部分代码省略.........
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:101,代码来源:Blog.aspx.cs

示例3: lbxBlogs_SelectedIndexChanged

 protected void lbxBlogs_SelectedIndexChanged(object sender, EventArgs e)
 {
     addedit.InnerText = "Edit Blog";
     DataLayer dl = new DataLayer();
     DataTable dtBlog = dl.GetBlogBy_BlogID(Convert.ToInt32(lbxBlogs.SelectedValue));
     cbxDeleteBlog.Visible = true;
     spanAuthor.InnerText = dl.GetFullMemberNameBy_Email(dtBlog.Rows[0].ItemArray[1].ToString());
     tbxTitle.Text = dtBlog.Rows[0].ItemArray[3].ToString();
     rteBody.Value = dtBlog.Rows[0].ItemArray[4].ToString();
     ddlAccessLevel.SelectedIndex = ddlAccessLevel.Items.IndexOf(new ListItem(dtBlog.Rows[0].ItemArray[5].ToString()));
     postedby.Visible = true;
 }
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:12,代码来源:ManageBlogs.aspx.cs


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