using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class Qa_center : System.Web.UI.Page { public DateTime dates; protected void Page_Load(object sender, EventArgs e) { if (Session["member"] != null) { DataTable dt = (DataTable)Session["member"]; this.txtname.Text = dt.Rows[0]["names"].ToString(); this.txtname.ReadOnly = true; } dates = DateTime.Now;//发表留言的时间 后台可以根据留言时间处理 } /// /// 提交留言信息 /// /// /// protected void btnSubmit_Click(object sender, EventArgs e) { string sql = "insert into msgtab(names,telephone,email,address,contents,mDate) values('" + txtname.Text + "','" + txtphone.Text + "','" + txtemail.Text + "','" + txtaddress.Text + "','" + txtcontent.Text + "','" + dates + "')"; int i = DBH.DBHelper.ExecuteNonQuery(sql); if (i > 0) { Methods1.Methods1.Alert(this, "谢谢您的留言,我们将尽快回复!"); txtcontent.Text = ""; } else { Methods1.Methods1.Alert(this, "对不起,留言失败,请重新填写留言!"); } } protected void BtnClear_Click(object sender, EventArgs e) { txtname.Text = ""; txtphone.Text = ""; txtemail.Text = ""; txtaddress.Text = ""; txtcontent.Text = ""; } }