📄 messagesingle.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;
public partial class message_messageSingle : PageBase
{
Itsv.Model.message_list model = new Itsv.Model.message_list();
Itsv.BLL.message_list bll = new Itsv.BLL.message_list();
protected void Page_Load(object sender, EventArgs e)
{
if (CurrentUser == null)
{
return;
}
if(!Page.IsPostBack)
{
setData();
}
}
private void setData()
{
BindSingleData();
}
//绑定单个信息明细
private void BindSingleData()
{
try
{
int code = Convert.ToInt32(Request.QueryString["code"].ToString());
string strWhere = " msg_id = " + code + "";
DataSet ds = new DataSet();
ds = bll.GetList(strWhere);
lblCode.Text = ds.Tables[0].Rows[0]["msg_id"].ToString();
lblSenderName.Text = ds.Tables[0].Rows[0]["sender_name"].ToString();
lblReceivedName.Text = ds.Tables[0].Rows[0]["receiver_name"].ToString();
lblTitle.Text = ds.Tables[0].Rows[0]["title"].ToString();
txtContent.Text = ds.Tables[0].Rows[0]["content"].ToString();
if (ds.Tables[0].Rows[0]["is_important"].ToString() == "0")
{
lblImportant.Text = "普通信息";
}
else
{
lblImportant.Text = "重要信息";
}
if (ds.Tables[0].Rows[0]["is_read"].ToString() == "0")
{
lblRead.Text = "未阅信息";
}
else
{
lblRead.Text = "已阅信息";
}
HyperLink1.Text = ds.Tables[0].Rows[0]["acc_name"].ToString();
HyperLink1.NavigateUrl = "../" + ds.Tables[0].Rows[0]["acc_path"].ToString();
lblTime.Text = ds.Tables[0].Rows[0]["date_time"].ToString();
//将信息设置为只读
string account = CurrentUser.account;
string Rname = ds.Tables[0].Rows[0]["receiver"].ToString();
if(account == Rname)
{
bll.UpdateIsRead(code);
}
if (account == ds.Tables[0].Rows[0]["sender"].ToString())
{
this.btnAnswer.Enabled = false;
}
}
catch(Exception)
{
lblCode.Text = "";
lblSenderName.Text = "";
lblReceivedName.Text = "";
lblTitle.Text = "";
txtContent.Text = "";
lblImportant.Text = "";
lblRead.Text = "";
HyperLink1.Text = "";
lblTime.Text = "";
}
}
protected void btnReturn_Click(object sender, EventArgs e)
{
try
{
int tag = Convert.ToInt32(Request.QueryString["tag"].ToString());
if (tag == 1)
{
Response.Redirect("../message/mesageList.aspx");
}
}
catch
{
Response.Write("<script language='javascript'>window.opener.location='mesageList.aspx';;window.close();</script>");
//Response.Write("<script language='javascript'>window.dialogArguments.location='../message/MesageList.aspx';window.close();</script>");
}
}
//回复信息
protected void btnAnswer_Click(object sender, EventArgs e)
{
//模态窗口的
//Response.Write("<script>window.dialogArguments.location='sendMessage.aspx?received_name=" + lblSenderName.Text + "';window.close();</script>");
//window.open 窗口方式的
try
{
int tag = Convert.ToInt32(Request.QueryString["tag"].ToString());
if (tag == 1)
{
Response.Redirect("sendMessage.aspx?received_name=" + Server.UrlEncode(lblSenderName.Text) + "");
}
}
catch
{
Response.Write("<script>window.opener.location='sendMessage.aspx?received_name=" + Server.UrlEncode(lblSenderName.Text) + "';window.close();</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -