本文整理汇总了C#中DataLayer.GetBlogCommentCount方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.GetBlogCommentCount方法的具体用法?C# DataLayer.GetBlogCommentCount怎么用?C# DataLayer.GetBlogCommentCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataLayer
的用法示例。
在下文中一共展示了DataLayer.GetBlogCommentCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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> | " + Convert.ToDateTime(dtBlog.Rows[0].ItemArray[2]).ToString("D") + " | " + dl.GetBlogCommentCount(Convert.ToInt32(dtBlog.Rows[0].ItemArray[0])) + " Comment(s) | <!-- 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();
//.........这里部分代码省略.........
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//if (!User.Identity.IsAuthenticated)
//{
// Session["resultColor"] = "#ff0000";
// Session["resultTitle"] = "Members Only";
// Session["resultMessage"] = "This is a members only area.<br />You must log in first.";
// Session["resultReturnURL"] = "Blogs.aspx";
// Response.Redirect("Result.aspx", true);
//}
int iPageNumber = 0;
if (Request.QueryString["p"] != null)
{
iPageNumber = Convert.ToInt32(Request.QueryString["p"]);
}
DataLayer dl = new DataLayer();
int iBlogCount;
DataTable dtBlogs;
if (User.Identity.IsAuthenticated)
{
dtBlogs = dl.GetFiveBlogsBy_Page(iPageNumber, "Members Only");
iBlogCount = dl.GetBlogCount("Members Only");
}
else
{
dtBlogs = dl.GetFiveBlogsBy_Page(iPageNumber, "Everyone");
iBlogCount = dl.GetBlogCount("Everyone");
}
int iMaxPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(iBlogCount) / 5m));
pageNav1.NumPages = iMaxPages;
pageNav2.NumPages = iMaxPages;
foreach (DataRow dr in dtBlogs.Rows)
{
if (dr.ItemArray[5].ToString() == "Members Only")
{
blogs.InnerHtml += "<div style=\"background-color:#ddddff; padding:5px;\"><div style=\"text-align:center;\">-= <i>Members Only Blog</i> =-</div><br />";
}
else
{
blogs.InnerHtml += "<div>";
}
blogs.InnerHtml += "<div style=\"text-align:left;font-size:35px;font-family:arial;\"><a class=\"navlink\" href=\"Blog.aspx?bid=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[3].ToString() + "</a></div>";
blogs.InnerHtml += "<div style=\"text-align:left;\">Posted by <a href=\"Profile.aspx?member=" + dr.ItemArray[1].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dr.ItemArray[1].ToString()) + "</a> | " + Convert.ToDateTime(dr.ItemArray[2]).ToString("D") + " | " + dl.GetBlogCommentCount(Convert.ToInt32(dr.ItemArray[0])) + " Comment(s)</div><br />";
string sBody = dr.ItemArray[4].ToString();
if (sBody.Contains('~'))
{
sBody = sBody.Remove(sBody.IndexOf('~'));
blogs.InnerHtml += "<div style=\"text-align:left;\"><table style=\"width:100%;\"><tr><td>" + dr.ItemArray[4].ToString().Remove(dr.ItemArray[4].ToString().IndexOf('~')) + "<br /><br /><b><a class=\"navlink\" href=\"Blog.aspx?bid=" + dr.ItemArray[0].ToString() + "\">(Read More)</a></b><br /></td></tr></table></div>";
}
else
{
blogs.InnerHtml += "<div><i>No Summary.</i><br /><br /><b><a class=\"navlink\" href=\"Blog.aspx?bid=" + dr.ItemArray[0].ToString() + "\">(Read More)</a></b><br /></div>";
}
blogs.InnerHtml += "</div><hr /><br />";
}
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Featured Member</div><div class=\"contentpanel\">"));
DataTable dtRandomMember = dl.GetRandomMember();
loggedinpanels.Controls.Add(new LiteralControl("<table style=\"width:100%;\"><tr><td style=\"font-size:13px;text-align:center;\"><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=100&image=images/MemberAvatars/" + dtRandomMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\">View Profile</a></td><td style=\"padding-left:5px;font-size:13px;width:100%;\"><b>Name:</b> " + dtRandomMember.Rows[0].ItemArray[2].ToString() + "<br /><br /><b>Location:</b> " + dtRandomMember.Rows[0].ItemArray[17].ToString() + "<br /><br /><b>Business:</b> " + dtRandomMember.Rows[0].ItemArray[8].ToString() + "<br /><br />"));
if (dtRandomMember.Rows[0].ItemArray[6].ToString() != "")
{
loggedinpanels.Controls.Add(new LiteralControl("<center><a href=\"" + dtRandomMember.Rows[0].ItemArray[6].ToString() + "\">Visit Website</a></center>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</td></tr></table></div>"));
}
DataTable dtMemberAd = dl.GetRandomAd();
loggedinpanels.Controls.Add(new LiteralControl("<div class=\"contenttitle\">Member Ad</div><div style=\"text-align:center;\" class=\"contentpanel\"><a href=\"" + dtMemberAd.Rows[0].ItemArray[2].ToString() + "\"><img style=\"width:230px; border-width:0px;\" src=\"" + dtMemberAd.Rows[0].ItemArray[1].ToString() + "\" /></a></div>"));
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Popular Topics</div><div style=\"font-size:15px;\" class=\"contentpanel\"><ul>"));
DataTable dtTopics = dl.GetFiveTopics();
foreach (DataRow dr in dtTopics.Rows)
{
loggedinpanels.Controls.Add(new LiteralControl("<li><a href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a></li>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</ul></div>"));
}
}