示例#1
0
        protected void btnComment_Click(object sender, EventArgs e)
        {
            if (Session["LoginUser"] == null)
            {
                labError.Text = "你需要登录后才能发表";
                return;
            }
            labError.Text = "";
            if (hidStart.Value.Equals("0"))
            {
                labError.Text  = "请点击星星评分";
                hidStart.Value = "0";
                return;
            }
            if (txtComment.Text.Trim().Length == 0)
            {
                labError.Text  = "请输入评论内容";
                hidStart.Value = "0";
                return;
            }
            JavaDLL dll = new JavaDLL();

            if (Request.QueryString["device"] == null)
            {
                if (dll.addComment(Convert.ToInt32(Request.QueryString["id"]), ((UserInfo)Session["LoginUser"]).UserName, Convert.ToInt32(hidStart.Value), txtComment.Text.Trim()))
                {
                    txtComment.Text = "";
                    hidStart.Value  = "0";
                    getComment();
                }
                else
                {
                    labError.Text = "评论发送失败";
                }
            }
            else
            {
                if (dll.addComment(Convert.ToInt32(Request.QueryString["id"]), ((UserInfo)Session["LoginUser"]).UserName, Convert.ToInt32(hidStart.Value), txtComment.Text.Trim(), Request.QueryString["device"]))
                {
                    txtComment.Text = "";
                    hidStart.Value  = "0";
                    getComment();
                }
                else
                {
                    labError.Text = "评论发送失败";
                }
            }
        }
示例#2
0
 public ActionResult c(int id)
 {
     if (isLogin())
     {
         UserInfo user = (UserInfo)Session["LoginUser"];
         int      aid  = Convert.ToInt32(id);
         string   txt  = Request.Form["txtComment"];
         JavaDLL  dll  = new JavaDLL();
         if (Session["LoginDevice"] != null)
         {
             dll.addComment(aid, user.UserName, txt, Session["LoginDevice"].ToString());
         }
         else
         {
             dll.addComment(aid, user.UserName, txt);
         }
         return(c(id, null));
     }
     else
     {
         return(java(id.ToString(), null, null));
     }
 }