标题:代码修改
只看楼主
抱大腿
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2014-3-24
结帖率:100%
 问题点数:0 回复次数:1 
代码修改
这段代码有点问题,求大神指导。。。。实现的功能是:如果用户已登录,评价内容不为空,则提示评价成功!!!,评价内容为空,则提示操作失败,请重新操作!!!;如果用户未登录,则提示请先登录!!!。

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>");
            }

        }
搜索更多相关主题的帖子: public 用户 
2014-03-24 16:28
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
你要先得到评价内容才能判断
2014-03-27 11:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-429072-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.086625 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved