📄 writeback.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using LeaveMessageMVC.MVC.BusinessLogicLayer.ParameterInformation;
using LeaveMessageMVC.MVC.DataBaseControlLayer;
using LeaveMessageMVC.MVC.BusinessLogicLayer;
using LeaveMessageMVC.MVC.BusinessLogicLayer.SomeFunctions;
public partial class Default2 : System.Web.UI.Page
{
string m_ownerID = "";
string m_yourName = "";
string m_qqmsn = "";
string m_contents = "";
string m_writeback = "";
LeaveMessagePara LMP = new LeaveMessagePara();
protected void Page_Load(object sender, EventArgs e)
{
//禁止浏览器的缓存
Response.Cache.SetNoStore();
Response.Cache.SetNoServerCaching();
Response.Write("<script type=\"text/javascript\">");
Response.Write("function CtrlEnter(button){");
Response.Write("if(event.ctrlKey && event.keyCode==13)document.all[button].click();}");
Response.Write("</script>");
WBContent.Attributes.Add("onkeydown", "CtrlEnter('WBB');");
m_ownerID = Session["OwnerID"].ToString();
if (!Page.IsPostBack)
{
if (Session["YourName"] != null)
{
m_yourName = Session["YourName"].ToString();
YourName.Text = m_yourName;
}
if (Session["QQMSN"] != null)
{
m_qqmsn = Session["QQMSN"].ToString(); ;
YourQQMSN.Text = m_qqmsn;
}
}
if (!DBControl.AccessConnection)
{
SqlDataReader dr = LMManage.GetLM(m_ownerID);
while (dr.Read())
{
LMOwner.Text = dr["User"].ToString();
LMSubmittime.Text = dr["SubmitTime"].ToString();
m_contents = dr["Contents"].ToString();
m_writeback = dr["WriteBack"].ToString();
LMContents.Text = m_contents;
}
dr.Close();
}
else
{
DataTable dt = LMManage.aGetLM(m_ownerID);
LMOwner.Text = dt.Rows[0]["User"].ToString();
LMSubmittime.Text = dt.Rows[0]["SubmitTime"].ToString();
m_contents = dt.Rows[0]["Contents"].ToString();
m_writeback = dt.Rows[0]["WriteBack"].ToString();
LMContents.Text = m_contents;
}
}
protected void Submit_Click(object sender, EventArgs e)
{
if (YourName.Text == "")
{
Response.Write("<Script Language=JavaScript>alert(\"提示:回复他人留言,必须输入您的用户名。\");</script>");
Response.Write("<script>setTimeout(\"document.all.YourName.focus();\",500);</script>");
}
else if (WBContent.Text == "")
Response.Write("<Script Language=JavaScript>alert(\"提示:不能回复空信息。\")</Script>");
else
{
m_yourName = YourName.Text;
m_qqmsn = YourQQMSN.Text;
LMP.ID = m_ownerID;
LMP.WriteBack = m_writeback + "【" + m_yourName + "】(QQ/MSN:" + m_qqmsn + ")回复到:<br>" + FormatString.FormatStr(WBContent.Text) + "<br>" + DateTime.Now + "<br><br>";
if (LMManage.UpdateLeaveMessage(LMP))
{
Session["BUser"] = m_yourName;
Session["QQorMSN"] = m_qqmsn;
if (Request.QueryString["index"] == "y")
Response.Redirect("index.aspx");
else
Response.Redirect("LMListForPublic.aspx");
}
else Response.Redirect("ShowErrorMsg.aspx?name=" + m_yourName);
}
}
protected void Back_Click(object sender, EventArgs e)
{
m_yourName = YourName.Text;
m_qqmsn = YourQQMSN.Text;
Session["BUser"] = m_yourName;
Session["QQorMSN"] = m_qqmsn;
if (Request.QueryString["index"] == "y")
{
Response.Redirect("index.aspx");
}
else
{
Response.Redirect("LMListForPublic.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -