代码修改
这段代码有点问题,求大神指导。。。。实现的功能是:如果用户已登录,评价内容不为空,则提示评价成功!!!,评价内容为空,则提示操作失败,请重新操作!!!;如果用户未登录,则提示请先登录!!!。namespace LBSYS.WebPage
{
public partial class Comment : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
LBSYS.Model.Message mes = new LBSYS.Model.Message();
if (this.Request.Cookies["userid"].Value != "" && this.Request.Cookies["userid"].Value != null)
{
mes.Jingdian_Id = int.Parse(this.Request.QueryString["id"]);
mes.Message_Content = this.TextBox3.Text;
= DateTime.Now;
try
{
try
{
if (LBSYS.BLL.Message.Add(mes) > 0)
{
this.Response.Write("<script>alert('评论成功!!!');window.location='index.aspx'</script>");
}
}
catch (Exception)
{
this.Response.Write("<script>alert('操作失败,请重新操作!!!')</script>");
}
}
catch (Exception)
{
this.Response.Write("<script>alert('请注意格式填写是否正确!!!')</script>");
}
}
else
{
this.Response.Write("<script>alert('请先登录!!!');window.location='User_Login.aspx'</script>");
}
}