📄 receive.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 Office.Model;
using Office.BLL;
using System.Collections.Generic;
public partial class Receive : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.GridView1.Visible = true;
Search();
}
}
private void Search()
{
UserInfo user = (UserInfo)Session["User"];
IList<Message> m = MessageManager.GetMessageUserId(user.UserId);
this.GridView1.DataSource = m;
this.GridView1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/Message/MailBox/MailBox.aspx");
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
UserInfo user = (UserInfo)Session["User"];
Label l3 = e.Row.FindControl("Label3") as Label;
int typeId = Convert.ToInt32(l3.Text);
Label l4 = e.Row.FindControl("Label4") as Label;
int messageId = Convert.ToInt32(l4.Text);
string userId = (MessageToUserManager.GetMessageToUserByMessageId(messageId)).ToUserId;
Label l1 = e.Row.FindControl("Label1") as Label;
//foreach (MessageToUser m in toUser)
//{
if (userId.Equals("0"))
{
l1.Text = "所有人";
}
else
{
string name = UserInfoManager.GetUserInfoByUserId(userId).UserName;
l1.Text = name;
}
//}
Label l2 = e.Row.FindControl("Label2") as Label;
l2.Text = "***" + MessageTypeManager.GetMessageTypeByMessageTypeId(typeId).MessageTypeName + "***";
if (l2.Text.Equals("***紧急消息***"))
{
l2.ForeColor = System.Drawing.Color.Red;
}
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#95B8FF'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
e.Row.Attributes["style"] = "Cursor:hand";
}
int count = GridView1.Rows.Count;
string ID = "";
for (int i = 0; i < count; i++)
{
ID = this.GridView1.DataKeys[i].Value.ToString();
GridView1.Rows[i].Attributes.Add("onclick", "newwin=window.open('ReceiveMailDetail.aspx?" + ID + "','newwin','width=600,height=550')");
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String str = "";
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
CheckBox chk = GridView1.Rows[i].FindControl("chkSelect") as CheckBox;
if (chk.Checked)
{
str += (GridView1.Rows[i].FindControl("Label4") as Label).Text + ",";
}
}
if (str == "")
str += "0,";
if (MessageToUserManager.DeleteMessageToUserMessageIds(str.Substring(0, str.Length - 1)) && MessageManager.DeleteMessageMessageIds(str.Substring(0, str.Length - 1)))
{
}
else
{
Response.Write("<script>alert('删除失败!!!')</script>");
}
this.Search();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -