public void ForwardSet(int MailID)
    {
        ML_MailBLL mailbll = new ML_MailBLL(MailID);
        string tmpStr = "<br/>" + mailbll.Model.Content.ToString();
        tmpStr = tmpStr.Replace("<br/>", "\r\n");
        this.txtSubject.Text = "Fw:" + mailbll.Model.Subject.ToString();
        this.ckedit_content.Text = "你好!\n\n\n";
        this.ckedit_content.Text += "=======下面是转发邮件=======\n";
        this.ckedit_content.Text += "原邮件发件人姓名:" + mailbll.Model.Sender.ToString() + "\n";
        this.ckedit_content.Text += "原邮件发送时间:" + mailbll.Model.SendTime.ToString() + "\n";
        this.ckedit_content.Text += "原邮件收件人姓名:" + mailbll.Model.ReceiverStr.ToString() + "\n";
        this.ckedit_content.Text += tmpStr;

        //设置附件信息
        ML_AttachFileBLL attachfiledal = new ML_AttachFileBLL();
        IList<ML_AttachFile> fileList = mailbll.GetAttachFiles();
        if (fileList.Count != 0)
        {
            for (int i = 0; i < fileList.Count; i++)
            {
                ML_AttachFile att = new ML_AttachFile();

                att.Size = fileList[i].Size;
                att.Name = fileList[i].Name;
                att.Uploaduser = fileList[i].Uploaduser;
                att.Extname = fileList[i].Extname;
                att.GUID = fileList[i].GUID;
                upattlist.Add(att);
            }
        }
        BindAttList();
    }
    public void ForwardSet(int MailID)
    {
        ML_MailBLL mailbll = new ML_MailBLL(MailID);
        string     tmpStr  = "<br/>" + mailbll.Model.Content.ToString();

        tmpStr = tmpStr.Replace("<br/>", "\r\n");
        this.txtSubject.Text      = "Fw:" + mailbll.Model.Subject.ToString();
        this.ckedit_content.Text  = "你好!\n\n\n";
        this.ckedit_content.Text += "=======下面是转发邮件=======\n";
        this.ckedit_content.Text += "原邮件发件人姓名:" + mailbll.Model.Sender.ToString() + "\n";
        this.ckedit_content.Text += "原邮件发送时间:" + mailbll.Model.SendTime.ToString() + "\n";
        this.ckedit_content.Text += "原邮件收件人姓名:" + mailbll.Model.ReceiverStr.ToString() + "\n";
        this.ckedit_content.Text += tmpStr;

        //设置附件信息
        ML_AttachFileBLL      attachfiledal = new ML_AttachFileBLL();
        IList <ML_AttachFile> fileList      = mailbll.GetAttachFiles();

        if (fileList.Count != 0)
        {
            for (int i = 0; i < fileList.Count; i++)
            {
                ML_AttachFile att = new ML_AttachFile();

                att.Size       = fileList[i].Size;
                att.Name       = fileList[i].Name;
                att.Uploaduser = fileList[i].Uploaduser;
                att.Extname    = fileList[i].Extname;
                att.GUID       = fileList[i].GUID;
                upattlist.Add(att);
            }
        }
        BindAttList();
    }
    public void ReplySet(int MailID)
    {
        ML_MailBLL mailbll = new ML_MailBLL(MailID);

        string tmpStr = "<br/>" + mailbll.Model.Content.ToString();

        tmpStr = tmpStr.Replace("<br/>", "\r\n");
        this.txtSubject.Text = "回复:" + mailbll.Model.Subject.ToString();
        SendToRealName       = mailbll.Model.Sender.ToString();
        Org_StaffBLL staffbll = new Org_StaffBLL();

        SendTo = mailbll.Model.Sender.ToString();
        if (SendTo != "")
        {
            if (UserBLL.GetStaffByUsername(SendTo) != null)
            {
                SendToRealName = SendTo + "[" + UserBLL.GetStaffByUsername(SendTo).RealName + "]" + ",";
            }
            else
            {
                MessageBox.Show(this, "用户名不存在");
            }
        }
        //SendTo = mailbll.Model.CcToAddr.ToString() + ",";
        this.ckedit_content.Text  = SendToRealName + "你好!<br/><br/><br/><br/><hr/>";
        this.ckedit_content.Text += "-----------------" + mailbll.Model.SendTime.ToString("yyyy年MM月dd日 HH:mm") + ", " + SendToRealName + "在来信中写道:" + "-----------------<br/>";
        this.ckedit_content.Text += tmpStr;
    }
    /// </summary>
    public void ReadMailInfo()
    {
        ML_MailBLL mailbll = new ML_MailBLL(int.Parse(MailID));

        mailbll.UpdateIsRead();

        if (mailbll.Model.Sender != null)
        {
            lblSenderName.Text = mailbll.Model.Sender.ToString();       //寄信人
            if (mailbll.Model.Receiver == "" && mailbll.Model.ReceiverStr != "")
            {
                if (mailbll.Model.ReceiverStr.Substring(mailbll.Model.ReceiverStr.Length - 1, 1) == ",")
                {
                    lblReceiver.Text = mailbll.Model.ReceiverStr.Substring(0, mailbll.Model.ReceiverStr.Length - 1);
                }
                else
                {
                    lblReceiver.Text = mailbll.Model.ReceiverStr;
                }
            }
        }
        if (mailbll.Model.Receiver != null && mailbll.Model.Receiver != "")
        {
            lblReceiver.Text = mailbll.Model.ReceiverStr.ToString();       //收信人
        }

        if (mailbll.Model.CcToAddr != null)
        {
            lblCcToAddr.Text = mailbll.Model.CcToAddr.ToString();       //抄送地址
        }
        //if (mailbll.Model.BccToAddr != null)
        //{
        //    lblBccToAddr.Text = mailbll.Model.BccToAddr.ToString();         //密送地址
        //}
        if (mailbll.Model.Subject != null)
        {
            lblSubject.Text = mailbll.Model.Subject.ToString();             //主题
        }
        if (mailbll.Model.SendTime != null)
        {
            lblSendTime.Text = mailbll.Model.SendTime.ToString();               //发送时间
        }
        if (mailbll.Model.Content != null)
        {
            lblContent.Text = mailbll.Model.Content.ToString();         //内容
        }

        #region 显示附件信息

        IList <ML_AttachFile> fileList = mailbll.GetAttachFiles();

        foreach (ML_AttachFile attach in fileList)
        {
            lblAttachFile.Text += "&nbsp;<a href='Download.aspx?GUID=" + attach.GUID.ToString() + "' target='_blank'>" +
                                  attach.Name.ToString() + "(" + (attach.Size / 1024).ToString() + " KB)</a><br>";
        }
        #endregion
    }
    /// </summary>
    public void ReadMailInfo()
    {
        ML_MailBLL mailbll = new ML_MailBLL(int.Parse(MailID));
        mailbll.UpdateIsRead();

        if (mailbll.Model.Sender != null)
        {
            lblSenderName.Text = mailbll.Model.Sender.ToString();       //寄信人
            if (mailbll.Model.Receiver == "" && mailbll.Model.ReceiverStr != "")
            {
                if (mailbll.Model.ReceiverStr.Substring(mailbll.Model.ReceiverStr.Length - 1, 1) == ",")
                    lblReceiver.Text = mailbll.Model.ReceiverStr.Substring(0, mailbll.Model.ReceiverStr.Length - 1);
                else
                    lblReceiver.Text = mailbll.Model.ReceiverStr;
            }
        }
        if (mailbll.Model.Receiver != null && mailbll.Model.Receiver != "")
        {
            lblReceiver.Text = mailbll.Model.ReceiverStr.ToString();       //收信人
        }

        if (mailbll.Model.CcToAddr != null)
        {
            lblCcToAddr.Text = mailbll.Model.CcToAddr.ToString();       //抄送地址
        }
        //if (mailbll.Model.BccToAddr != null)
        //{
        //    lblBccToAddr.Text = mailbll.Model.BccToAddr.ToString();         //密送地址
        //}
        if (mailbll.Model.Subject != null)
        {
            lblSubject.Text = mailbll.Model.Subject.ToString();             //主题
        }
        if (mailbll.Model.SendTime != null)
        {
            lblSendTime.Text = mailbll.Model.SendTime.ToString();               //发送时间
        }
        if (mailbll.Model.Content != null)
        {
            lblContent.Text = mailbll.Model.Content.ToString();         //内容
        }

        #region 显示附件信息

        IList<ML_AttachFile> fileList = mailbll.GetAttachFiles();

        foreach (ML_AttachFile attach in fileList)
        {
            lblAttachFile.Text += "&nbsp;<a href='Download.aspx?GUID=" + attach.GUID.ToString() + "' target='_blank'>" +
                attach.Name.ToString() + "(" + (attach.Size / 1024).ToString() + " KB)</a><br>";
        }
        #endregion
    }
 protected void NewMailCount()
 {
     if (Session["UserName"] == null)
     {
         MessageBox.ShowAndRedirect(this.Page, "对不起,会话超时,请重新登录!", "/Default.aspx");
         return;
     }
     else
     {
         string userName = Session["UserName"].ToString();
         ML_MailBLL bll = new ML_MailBLL();
         int count = bll.GetNewMailCountByReceiver(userName);
         this.lb_NewMailCount.Text = count.ToString();
     }
 }
 protected void NewMailCount()
 {
     if (Session["UserName"] == null)
     {
         MessageBox.ShowAndRedirect(this.Page, "对不起,会话超时,请重新登录!", "/Default.aspx");
         return;
     }
     else
     {
         string     userName = Session["UserName"].ToString();
         ML_MailBLL bll      = new ML_MailBLL();
         int        count    = bll.GetNewMailCountByReceiver(userName);
         //this.lb_NewMailCount.Text = count.ToString();
     }
 }
    public void ReplySet(int MailID)
    {
        ML_MailBLL mailbll = new ML_MailBLL(MailID);

        string tmpStr = "<br/>" + mailbll.Model.Content.ToString();
        tmpStr = tmpStr.Replace("<br/>", "\r\n");
        this.txtSubject.Text = "回复:" + mailbll.Model.Subject.ToString();
        SendToRealName = mailbll.Model.Sender.ToString();
        Org_StaffBLL staffbll = new Org_StaffBLL();
        SendTo = mailbll.Model.Sender.ToString();
        if (SendTo != "")
        {
            if (UserBLL.GetStaffByUsername(SendTo) != null)
                SendToRealName = SendTo + "[" + UserBLL.GetStaffByUsername(SendTo).RealName + "]" + ",";
            else
                MessageBox.Show(this, "用户名不存在");
        }
        //SendTo = mailbll.Model.CcToAddr.ToString() + ",";
        this.ckedit_content.Text = SendToRealName + "你好!<br/><br/><br/><br/><hr/>";
        this.ckedit_content.Text += "-----------------" + mailbll.Model.SendTime.ToString("yyyy年MM月dd日 HH:mm") +", "+ SendToRealName+"在来信中写道:" + "-----------------<br/>";
        this.ckedit_content.Text += tmpStr;
    }
Example #9
0
    private void BindMail()
    {
        if (ViewState["PageIndex"] != null)
        {
            this.ud_Mail.PageIndex = Int32.Parse(ViewState["PageIndex"].ToString());
        }
        BindFolderType();

        string userName = (string)Session["UserName"];

        this.ud_Mail.ConditionString = contionString;
        this.ud_Mail.BindGrid();

        int count = 0;

        for (int i = 0; i < this.ud_Mail.Rows.Count; i++)
        {
            ML_MailBLL bll = new ML_MailBLL(Convert.ToInt32(this.ud_Mail.DataKeys[i]["ML_Mail_ID"].ToString()));
            if (bll.Model.IsRead == "N")
            {
                count++;
            }
        }


        #region 显示未读邮件数,删除按钮
        if (ViewState["FolderType"].ToString() != "4")
        {
            this.lblMsg.Text = this.ud_Mail.Rows.Count.ToString() + "/<font color=red>" + count.ToString() + "</font>未读";
        }
        if (this.ud_Mail.Rows.Count != 0)
        {
            this.btnDelete.Visible = true;
            this.btnDelete.Attributes["onclick"] = "javascript:return confirm('您确认要删除吗?');";
        }
        #endregion
    }
    protected void btnSendMail_Click(object sender, EventArgs e)
    {
        ML_Mail mailbody = new ML_Mail();

        mailbody = ProcessFormPost();
        ArrayList mails_id = ML_MailBLL.MailSend(mailbody); // 返回已经发送的邮件ID列表(包括抄送和密抄)

        List <int> receiverList = new List <int>();

        ArrayList upattlist = (ArrayList)Session["upattlist"];

        #region 将附件文件读取到字节组中
        ArrayList upattbuff = new ArrayList(upattlist.Count);
        for (int i = 0; i < upattlist.Count; i++)
        {
            byte[]        buff = null;
            ML_AttachFile att  = (ML_AttachFile)upattlist[i];
            string        path = att.Visualpath;
            if (path == "")
            {
                //转发的附件
                buff = new ML_AttachFileBLL(att.GUID).GetData();
            }
            else
            {
                if (path.StartsWith("~"))
                {
                    path = Server.MapPath(path);
                }
                FileStream stream = new FileStream(path, FileMode.Open);
                buff = new byte[stream.Length];
                stream.Read(buff, 0, buff.Length);
                stream.Close();

                att.Visualpath = "";
                File.Delete(path);
            }
            upattbuff.Add(buff);
        }

        if (ViewState["SavePath"] != null)
        {
            string path = (string)ViewState["SavePath"];
            path = path.Substring(0, path.LastIndexOf("/"));
            Directory.Delete(path, true);
            ViewState["SavePath"] = null;
        }
        #endregion

        ML_AttachFileBLL bll = new ML_AttachFileBLL();
        for (int i = 0; i < upattlist.Count; i++)
        {
            ML_AttachFile att = (ML_AttachFile)upattlist[i];
            foreach (int mailID in mails_id)
            {
                ML_AttachFileBLL attbll = new ML_AttachFileBLL();
                attbll.Model        = att;
                attbll.Model.Mailid = mailID;

                attbll.Add((byte[])upattbuff[i]);
            }
        }

        if (this.cbRemind.Checked == true)
        {
            receiverList = ProcessSM();
        }
        Response.Redirect("index.aspx");
    }
Example #11
0
 private void BindMail()
 {
     gv_Mail.BindGrid <ML_Mail>(ML_MailBLL.GetRecieveMail((string)Session["UserName"]));
 }