📄 maildetail.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication8.firstPage
{
/// <summary>
/// mailDetail 的摘要说明。
/// </summary>
public class mailDetail : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlTextArea description;
protected System.Web.UI.HtmlControls.HtmlInputText subject;
protected System.Web.UI.HtmlControls.HtmlTableCell attach;
protected System.Web.UI.HtmlControls.HtmlInputButton submit;
protected System.Web.UI.HtmlControls.HtmlTableCell shop;
protected System.Web.UI.WebControls.HyperLink attachFile;
protected System.Web.UI.HtmlControls.HtmlInputText send;
protected System.Web.UI.HtmlControls.HtmlTableCell ads;
protected System.Web.UI.WebControls.Label count;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(Session["userName"] == null)
Response.Redirect("../login.aspx");
if(Session["type"].Equals("个人"))
{
shop.InnerHtml = "<div align='center'><A href='shopping.aspx'><IMG height='29' src='images/shopping.gif' width='157' border='0'></A></div>";
ads.Visible = false;
}
else if(Session["type"].Equals("企业"))
shop.InnerHtml = "<div align='center'><A href='enterprise.aspx'><IMG height='29' src='images/shopping.gif' width='157' border='0'></A></div>";
count.Text = Application["count"].ToString();
string id = Request["id"];
Connection connection = new Connection(Application["market"].ToString());
SqlDataReader reader = connection.execute("select * from Mail where id='"+id+"'");
if(reader.Read())
{
send.Value = reader["sender"].ToString();
subject.Value = reader["subject"].ToString();
description.Value = reader["body"].ToString();
string state = reader["state"].ToString();
string path = Server.MapPath("mail")+"\\"+id+".txt";
if(File.Exists(path))
{
attach.Visible = true;
attachFile.Text = "附件";
attachFile.NavigateUrl = "mail/"+id+".txt";
}
else
attach.Visible = false;
if(state.Equals("未读"))
{
reader.Close();
reader = connection.execute("update Mail set state='已读' where id='"+Request["id"]+"'");
reader.Close();
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.submit.ServerClick += new System.EventHandler(this.submit_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void submit_ServerClick(object sender, System.EventArgs e)
{
Response.Redirect("mail.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -