📄 message_look.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BLL;
using Socut.Data;
namespace Websystem.admin
{
/// <summary>
/// message_look 的摘要说明。
/// </summary>
///
public class message_look : System.Web.UI.Page
{
protected messages mes=new messages();
protected user us=new user();
protected System.Web.UI.WebControls.TextBox name;
protected System.Web.UI.WebControls.TextBox email;
protected System.Web.UI.WebControls.TextBox tel;
protected System.Web.UI.WebControls.TextBox datetime;
protected System.Web.UI.WebControls.TextBox title;
protected System.Web.UI.WebControls.TextBox content;
protected System.Web.UI.WebControls.TextBox set_content;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox Company;
protected System.Web.UI.WebControls.TextBox Fax;
protected System.Web.UI.WebControls.TextBox Country;
protected System.Web.UI.WebControls.TextBox Zip;
protected System.Web.UI.WebControls.TextBox Address;
protected int id=0;
private void Page_Load(object sender, System.EventArgs e)
{
other ot = new other();
ot.chk_user();
try
{
id=Convert.ToInt32(Request.QueryString["id"].ToString());
}
catch
{
id=0;
}
if( mes.get_message(id)=="YES")MESSAGE_again_load(id);
else
this.Label1.Text=System.DateTime.Now.ToString();
if(!this.IsPostBack)
message_load(id);
}
//加载留言信息
protected void message_load(int id)
{
DataSet ds=new DataSet();
CData myData=new CData();
string sql="select top 1 user_name,user_IP,user_EMAIL,USER_TEL,inputtime,title,content,Company,Fax,Country,Zip,Address from message where id="+id;
ds=myData.GetDataSet(sql,0,0,"message");
if(ds.Tables["message"].Rows.Count>0)
{
this.name.Text=ds.Tables["message"].Rows[0][0].ToString()+"["+ds.Tables["message"].Rows[0][1].ToString()+"]";
this.email.Text=ds.Tables["message"].Rows[0][2].ToString();
this.tel.Text=ds.Tables["message"].Rows[0][3].ToString();
this.datetime.Text=ds.Tables["message"].Rows[0][4].ToString();
this.title.Text=ds.Tables["message"].Rows[0][5].ToString();
this.content.Text=ds.Tables["message"].Rows[0][6].ToString();
this.Company.Text=ds.Tables["message"].Rows[0][7].ToString();
this.Fax.Text=ds.Tables["message"].Rows[0][8].ToString();
this.Country.Text=ds.Tables["message"].Rows[0][9].ToString();
this.Zip.Text=ds.Tables["message"].Rows[0][10].ToString();
this.Address.Text=ds.Tables["message"].Rows[0][11].ToString();
}
}
//加载已经被回复的信息
protected void MESSAGE_again_load(int id)
{
this.Button1.Text="修改";
DataSet ds=new DataSet();
CData myData=new CData();
string sql="select top 1 MESSAGE_content,MESSAGE_inputtime,MESSAGE_user_id from MESSAGE_again where MESSAGE_id="+id;
ds=myData.GetDataSet(sql,0,0,"MESSAGE_again");
if(ds.Tables["MESSAGE_again"].Rows.Count>0)
{
this.Label1.Text=ds.Tables["MESSAGE_again"].Rows[0][1].ToString()+" <font color=\"#0000ff\"><b>回复人</b></font >:"+us.search_data("[user]","id",Convert.ToInt32(ds.Tables["MESSAGE_again"].Rows[0][2].ToString()),"login_name");
this.set_content.Text=ds.Tables["MESSAGE_again"].Rows[0][0].ToString();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
CData myData=new CData();
string get_content=Request.Form["set_content"].ToString().Replace("'","'");
string sql="";
if( mes.get_message(id)=="YES")
{
sql="update MESSAGE_again set MESSAGE_content='"+get_content+"' where MESSAGE_id="+id;
//sql="delete from MESSAGE_again where MESSAGE_id="+id;
}
else
{
sql="insert into MESSAGE_again (MESSAGE_id,MESSAGE_content,MESSAGE_inputtime,MESSAGE_user_id) ";
sql+="values ("+id+",'"+get_content+"','"+System.DateTime.Now+"',1)";
}
myData.GetExecuteNonQuery(sql);
Response.Redirect("message.aspx",true);
}
private void Button2_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -