📄 receivemail.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 System.Collections.Generic;
using MyOffice.BLL;
using MyOffice.Models;
public partial class Message_ReceiveMail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
string userid = (string)Session["UserId"];
gvPersonMessageInfo.DataSource = MessageBLL.liUserIdMesToU(userid);
gvPersonMessageInfo.DataBind();
}
}
protected void gvPersonMessageInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onmouseover","color=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
e.Row.Attributes.Add("onmouseout","this.style.backgroundColor=color");
Image image1 = (Image)e.Row.FindControl("imgMessage");
int id = int.Parse(gvPersonMessageInfo.DataKeys[e.Row.RowIndex].Value.ToString());
string userid = (string)Session["UserId"];
MessageToUserModel metous = MessageBLL.UIdMIdMeToUser(id,userid);
if (metous != null)
{
if (metous.IfRead == 0)
{
image1.Visible = true;
}
else if (metous.IfRead == 1)
{
image1.Visible = false;
}
}
e.Row.Attributes.Add("onclick","location='ReceiveMailDetail.aspx?Id="+id+"'");
}
}
protected void btnReturn_ServerClick(object sender, EventArgs e)
{
Response.Redirect("News.aspx");
}
protected void btnDelete_ServerClick(object sender, EventArgs e)
{
OperateLogModel oplom = new OperateLogModel();
string userids = (string)Session["UserId"];
oplom.UserId = userids;
oplom.ObjectId = "104002";
oplom.OperateTime = DateTime.Now;
oplom.OperateName = "删除";
oplom.OperateDesc = "删除收件箱";
string xuanzhong = "";
for (int number = 0; number < gvPersonMessageInfo.Rows.Count; number++) {
CheckBox cb = gvPersonMessageInfo.Rows[number].FindControl("chkSelect") as CheckBox;
if (cb.Checked) {
Label lb = gvPersonMessageInfo.Rows[number].FindControl("Label5") as Label;
xuanzhong = xuanzhong + lb.Text+",";
}
}
if (xuanzhong.Length > 0)
{
xuanzhong = xuanzhong.Substring(0, xuanzhong.Length - 1);
int number = MessageBLL.DeleteIdMessToUser(xuanzhong);
if (number == 0)
{
Response.Write("<script>alert('删除失败!!!');</script>");
}
else {
int inOper = SysManageBLL.InsertOperate(oplom);
string userid = (string)Session["UserId"];
gvPersonMessageInfo.DataSource = MessageBLL.liUserIdMesToU(userid);
gvPersonMessageInfo.DataBind();
}
}
else {
Response.Write("<script>alert('请选择删除对象!!!');</script>");
}
}
protected void gvPersonMessageInfo_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -