using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CodeCafe.Web;
public partial class Digestiblog_View : System.Web.UI.Page
{
int CurrentBlog = 0;
protected int ArticleID;
/**********************************************************************************************************/
///
/// Handles the Load event of the Page control.
///
/// The source of the event.
/// The instance containing the event data.
protected void Page_Load(object sender, EventArgs e)
{
CurrentBlog = Utils.StrToIntDef(Request["id"], 0);
ShowBlog();
}
/**********************************************************************************************************/
///
/// Shows the blog.
///
private void ShowBlog()
{
clsBlog blog = new clsBlog();
blog.Load(CurrentBlog);
ArticleID = blog.bl_id;
if (blog.bl_id > 0)
{
ltTitle.Text = blog.bl_title;
ltCopy.Text = blog.bl_post;
dsBlogs.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
dsBlogs.SelectCommand = "BlogComment_ListByStatus";
dsBlogs.SelectParameters.Clear();
dsBlogs.SelectParameters.Add("BlogID", TypeCode.Int32, blog.bl_id.ToString());
dsBlogs.SelectParameters.Add("BlogStatus", TypeCode.Int32, "1");
dsBlogs.DataBind();
pnlComments.Visible = (dlComments.Items.Count > 0);
}
else
{
ltTitle.Text = "Invalid blog selected!";
pnlComments.Visible = false;
pnlSubmitComment.Visible = false;
pnlButtons.Visible = false;
}
}
/**********************************************************************************************************/
///
/// Saves the blog comment.
///
/// The sender.
/// The instance containing the event data.
protected void SaveComment(object sender, EventArgs e)
{
clsBlog blog = new clsBlog();
blog.Load(CurrentBlog);
if (blog.bl_id > 0)
{
clsBlogComment comment = new clsBlogComment();
comment.bl_id = blog.bl_id;
comment.bl_status = 0;
comment.bc_id = 0;
comment.bc_date = DateTime.Now;
comment.bc_email = tbEmail.Text;
comment.bc_user = tbName.Text;
comment.bc_post = tbComment.Text;
comment.Save();
lbSent.Visible = true;
tbEmail.Text = "";
tbName.Text = "";
tbComment.Text = "";
}
}
}