您目前尚未登陆,请选择【登陆】或【注册
首页->留言本类->51aspx修正版简单三层留言板源码>>WriteBack.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:51aspx修正版简单三层留言板源码
当前文件:文件类型 LeaveMessageMVC/WriteBack.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12using LeaveMessageMVC.MVC.BusinessLogicLayer.ParameterInformation; 13using LeaveMessageMVC.MVC.DataBaseControlLayer; 14using LeaveMessageMVC.MVC.BusinessLogicLayer; 15using LeaveMessageMVC.MVC.BusinessLogicLayer.SomeFunctions; 16 17public partial class Default2 : System.Web.UI.Page 18{ 19 string m_ownerID = ""; 20 string m_yourName = ""; 21 string m_qqmsn = ""; 22 string m_contents = ""; 23 string m_writeback = ""; 24 LeaveMessagePara LMP = new LeaveMessagePara(); 25 26 protected void Page_Load(object sender, EventArgs e) 27 { 28 //禁止浏览器的缓存 29 Response.Cache.SetNoStore(); 30 Response.Cache.SetNoServerCaching(); 31 32 Response.Write("<script type=\"text/javascript\">"); 33 Response.Write("function CtrlEnter(button){"); 34 Response.Write("if(event.ctrlKey && event.keyCode==13)document.all[button].click();}"); 35 Response.Write("</script>"); 36 WBContent.Attributes.Add("onkeydown", "CtrlEnter('WBB');"); 37 38 m_ownerID = Session["OwnerID"].ToString(); 39 40 if (!Page.IsPostBack) 41 { 42 if (Session["YourName"] != null) 43 { 44 m_yourName = Session["YourName"].ToString(); 45 YourName.Text = m_yourName; 46 } 47 48 if (Session["QQMSN"] != null) 49 { 50 m_qqmsn = Session["QQMSN"].ToString(); ; 51 YourQQMSN.Text = m_qqmsn; 52 } 53 } 54 55 if (!DBControl.AccessConnection) 56 { 57 SqlDataReader dr = LMManage.GetLM(m_ownerID); 58 while (dr.Read()) 59 { 60 LMOwner.Text = dr["User"].ToString(); 61 LMSubmittime.Text = dr["SubmitTime"].ToString(); 62 m_contents = dr["Contents"].ToString(); 63 m_writeback = dr["WriteBack"].ToString(); 64 LMContents.Text = m_contents; 65 } 66 dr.Close(); 67 } 68 else 69 { 70 DataTable dt = LMManage.aGetLM(m_ownerID); 71 LMOwner.Text = dt.Rows[0]["User"].ToString(); 72 LMSubmittime.Text = dt.Rows[0]["SubmitTime"].ToString(); 73 m_contents = dt.Rows[0]["Contents"].ToString(); 74 m_writeback = dt.Rows[0]["WriteBack"].ToString(); 75 LMContents.Text = m_contents; 76 } 77 } 78 79 protected void Submit_Click(object sender, EventArgs e) 80 { 81 if (YourName.Text == "") 82 { 83 Response.Write("<Script Language=JavaScript>alert(\"提示:回复他人留言,必须输入您的用户名。\");</script>"); 84 Response.Write("<script>setTimeout(\"document.all.YourName.focus();\",500);</script>"); 85 } 86 else if (WBContent.Text == "") 87 Response.Write("<Script Language=JavaScript>alert(\"提示:不能回复空信息。\")</Script>"); 88 else 89 { 90 m_yourName = YourName.Text; 91 m_qqmsn = YourQQMSN.Text; 92 93 LMP.ID = m_ownerID; 94 LMP.WriteBack = m_writeback + "" + m_yourName + "】(QQ/MSN:" + m_qqmsn + ")回复到:<br>" + FormatString.FormatStr(WBContent.Text) + "<br>" + DateTime.Now + "<br><br>"; 95 96 if (LMManage.UpdateLeaveMessage(LMP)) 97 { 98 Session["BUser"] = m_yourName; 99 Session["QQorMSN"] = m_qqmsn; 100 if (Request.QueryString["index"] == "y") 101 Response.Redirect("index.aspx"); 102 else 103 Response.Redirect("LMListForPublic.aspx"); 104 } 105 else Response.Redirect("ShowErrorMsg.aspx?name=" + m_yourName); 106 } 107 } 108 109 protected void Back_Click(object sender, EventArgs e) 110 { 111 m_yourName = YourName.Text; 112 m_qqmsn = YourQQMSN.Text; 113 114 Session["BUser"] = m_yourName; 115 Session["QQorMSN"] = m_qqmsn; 116 if (Request.QueryString["index"] == "y") 117 { 118 Response.Redirect("index.aspx"); 119 } 120 else 121 { 122 Response.Redirect("LMListForPublic.aspx"); 123 } 124 } 125} 126
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:51aspx修正版简单三层留言板源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号