예제 #1
0
 protected void btnComments_Click(object sender, EventArgs e)
 {
     if (Session["user_name"] != null)
     {
         if (Page.IsValid)
         {
             travel_record_comt comt = new travel_record_comt();//新建查询对象
             comt.user_id     = int.Parse(Session["user_id"].ToString());
             comt.trrecord_id = int.Parse(Request.QueryString["id"]);
             comt.comt_cont   = txtComments.Text;
             comt.comt_time   = DateTime.Now;
             int result = Travel_record_comtManager.InsertTravel_record_comt(comt);
             if (result >= 1)
             {
                 ScriptManager.RegisterClientScriptBlock(updatecomment, this.GetType(), "click", "alert('评论成功!')", true);
                 BindTravelComment();
                 txtComments.Text = "";
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(updatecomment, this.GetType(), "click", "alert('评论失败!')", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(updatecomment, this.GetType(), "click", "alert('您必须先登录才能评论!')", true);
         ScriptManager.RegisterStartupScript(updatecomment, updatecomment.GetType(), "updateScript", "window.location.href='login1.aspx'", true);
     }
 }
예제 #2
0
        public void BindTravelComment()
        {
            int       trrecord_id = int.Parse(Request.QueryString["id"]);
            DataTable dt          = Travel_record_comtManager.SelectTravel_record_comt(trrecord_id);

            if (dt != null && dt.Rows.Count > 0)
            {
                LVReply.DataSource = dt;
                LVReply.DataBind();
            }
        }