protected void Page_Load(object sender, EventArgs e) { M_UserInfo info = buser.GetLogin(); if (info.IsNull) { Response.Redirect("Login.aspx"); } //if (!B_UserPurview.SelReturnByIDs(buser.GetLogin().UserRole, "OAEmailRead")) //{ // function.WriteErrMsg("对不起,您所在角色组没有使用权限"); //} ViewState["MsgID"] = Request.QueryString["id"].ToString(); if (!Page.IsPostBack) { M_Message messInfo = B_Message.GetMessByID(DataConverter.CLng(ViewState["MsgID"].ToString())); if (!bll.AllowRead(messInfo.MsgID, info.UserID.ToString()))//如无读该条信息的权限 { function.WriteErrMsg("无权限阅读该条信息!!!"); } this.LblSender.Text = buser.GetUserNameByIDS(messInfo.Sender.ToString()); string userNames = buser.GetUserNameByIDS(messInfo.Incept.ToString()); this.LblIncept.Text = userNames.Length > 100 ? userNames.Substring(0, 100) + "..." : userNames; this.LblSendTime.Text = messInfo.PostDate.ToString("yyyy年MM月dd日 HH:mm"); this.LblTitle.Text = messInfo.Title; this.txt_Content.Text = messInfo.Content; if (!string.IsNullOrEmpty(messInfo.Attachment)) { GetFile(messInfo.Attachment); } if (!string.IsNullOrEmpty(Request.QueryString["read"])) { string ccuser = "******" + info.UserID + ","; if (messInfo.CCUser.IndexOf(ccuser) > -1) { BtnReply.Visible = false; LBCopy.Visible = true; } if (messInfo.ReadUser.IndexOf("," + info.UserID + ",") == -1) { messInfo.ReadUser += info.UserID.ToString(); messInfo.status = 1; B_Message.Update(messInfo); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(); M_Message messInfo = B_Message.GetMessByID(Mid); if (messInfo == null) { function.WriteErrMsg("邮件不存在"); } if (!msgBll.AllowRead(messInfo.MsgID, mu.UserID.ToString())) { function.WriteErrMsg("无权限阅读该邮件!!!"); } LblSender.Text = "<a href='MessageSend.aspx?id=" + Mid + "'>" + buser.GetUserNameByIDS(messInfo.Sender) + "</a>"; string userNames = buser.GetUserNameByIDS(messInfo.Incept.ToString()); LblIncept.Text = StringHelper.SubStr(userNames); LblSendTime.Text = messInfo.PostDate.ToString("yyyy年MM月dd日 HH:mm"); LblTitle.Text = messInfo.Title; txt_Content.Text = messInfo.Content; Attach_Hid.Value = messInfo.Attachment; if (!string.IsNullOrEmpty(Request.QueryString["read"])) { string ccuser = "******" + mu.UserID + ","; if (messInfo.CCUser.IndexOf(ccuser) > -1) { CC_Btn.Visible = false; } if (messInfo.ReadUser.IndexOf("," + mu.UserID + ",") == -1) { messInfo.ReadUser += mu.UserID.ToString(); messInfo.status = 1; B_Message.Update(messInfo); } } } }