📄 writebackweb.ascx.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 System.Data.OleDb;
using LeaveMessageMVC.MVC.BusinessLogicLayer.ParameterInformation;
using LeaveMessageMVC.MVC.DataBaseControlLayer;
using LeaveMessageMVC.MVC.BusinessLogicLayer;
using LeaveMessageMVC.MVC.BusinessLogicLayer.SomeFunctions;
public partial class WriteBackWeb : System.Web.UI.UserControl
{
string m_ownerID = "";
string m_yourName = "";
string m_qqmsn = "";
string m_contents = "";
string m_writeback = "";
LeaveMessageMVC.MVC.BusinessLogicLayer.ParameterInformation.LeaveMessagePara LMP = new LeaveMessagePara();
protected void Page_Load(object sender, EventArgs e)
{
//禁止浏览器的缓存
Response.Cache.SetNoStore();
Response.Cache.SetNoServerCaching();
m_ownerID = Session["OwnerID"].ToString();
m_yourName = Session["YourName"].ToString();
m_qqmsn = Session["QQMSN"].ToString();
//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');");
if (!DBControl.AccessConnection)
{
SqlDataReader dr = LMManage.GetLM(m_ownerID);
while (dr.Read())
{
LMOwner.Text = dr["User"].ToString();
LMSubmittime.Text = dr["SubmitTime"].ToString();
YourName.Text = m_yourName;
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();
YourName.Text = m_yourName;
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 (WBContent.Text == "")
Response.Write("<Script Language=JavaScript>alert(\"提示:不能回复空信息。\")</Script>");
else
{
LMP.ID = m_ownerID;
LMP.WriteBack = m_writeback + "【" + m_yourName + "】(QQ/MSN:" + Session["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)
{
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 + -