//存草稿//
        protected void Button1_Click(object sender, EventArgs e)
        {
            B_Message message = new B_Message();

            if (Page.IsValid)
            {
                M_Message messInfo = new M_Message();
                if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
                {
                    messInfo = message.SelReturnModel(Convert.ToInt32(Request.QueryString["Drafid"]));
                }
                User_T.Text         = StrHelper.RemoveDupByIDS(User_T.Text);
                messInfo.Incept     = buser.SelUserIDByOA(User_T.Text);
                messInfo.Sender     = buser.GetLogin().UserID.ToString();
                messInfo.Title      = this.TxtTitle.Text;
                messInfo.PostDate   = DateTime.Now;
                messInfo.Content    = this.EditorContent.Text;
                messInfo.Savedata   = 1;
                messInfo.Receipt    = "";
                messInfo.Attachment = SaveFile();
                if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
                {
                    messInfo.Attachment = (hasFileData.Value + "," + SaveFile()).Trim(',');
                    B_Message.Update(messInfo);
                }
                else
                {
                    message.GetInsert(messInfo);
                }
            }
            Response.Redirect("MessageDraftbox.aspx");
        }
        //发送
        protected void BtnSend_Click(object sender, EventArgs e)
        {
            M_UserInfo mu = buser.GetLogin();

            if (mu.MailSize != -1)//邮箱容量检测
            {
                float surSize = CheckMailSize(mu);
                float upSize  = 0;
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    if (Request.Files[i].ContentLength < 1)
                    {
                        continue;
                    }
                    upSize += float.Parse((Request.Files[i].ContentLength / 1024f / 1024f).ToString("0.0"));
                }
                if (surSize <= upSize)//如果剩余容量小于该次上传的附件容量
                {
                    function.Script(this, "alert('邮箱空间已满,无法发送邮件:" + MailRemind(mu) + "');");
                    return;
                }
            }
            M_Message messInfo = new M_Message();

            if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
            {
                messInfo = msgBll.SelReturnModel(Convert.ToInt32(Request.QueryString["Drafid"]));
            }
            string UserID = buser.GetLogin().UserID.ToString();

            //发送
            messInfo.Incept   = buser.GetIdsByUserName(User_T.Text.Trim());
            messInfo.Sender   = UserID;
            messInfo.Title    = this.TxtTitle.Text;
            messInfo.PostDate = DataConverter.CDate(DateTime.Now);
            messInfo.Content  = this.EditorContent.Text;
            messInfo.Savedata = 0;
            messInfo.Receipt  = "";
            messInfo.CCUser   = buser.SelUserIDByOA(CCUser_T.Text.Trim());
            if (string.IsNullOrEmpty(messInfo.Incept.Replace(",", "")))
            {
                function.WriteErrMsg("收件人不存在,请检测输入是否正确");
            }
            messInfo.Attachment = SaveFile().TrimEnd(',');
            if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
            {
                messInfo.Attachment = (hasFileData.Value + "," + SaveFile()).Trim(',');
                B_Message.Update(messInfo);
            }
            else
            {
                msgBll.GetInsert(messInfo);
            }
            Response.Redirect("MessageOutbox.aspx");
        }
        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);
             }
         }
     }
 }