コード例 #1
0
 /// <summary>
 /// 刪除訊息
 /// </summary>
 /// <param name="messageVO">被刪除的訊息</param>
 public void DeleteMessage(MessageVO messageVO)
 {
     NHibernateDao.Delete(messageVO);
 }
コード例 #2
0
 /// <summary>
 /// 刪除訊息
 /// </summary>
 /// <param name="messageVO">被刪除的訊息</param>
 public void DeleteMessage(MessageVO messageVO)
 {
     MessageDao.DeleteMessage(messageVO);
 }
コード例 #3
0
        private string GenMailContent(MessageVO messageVO)
        {
            StringBuilder sbContent = new StringBuilder();

            sbContent.Append(string.Format("時  間:{0}<br />", messageVO.CreatedDate.Value.ToString()));
            sbContent.Append(string.Format("姓  名:{0}<br />", messageVO.CreateName));
            sbContent.Append(string.Format("電  話:{0}<br />", messageVO.Phone));
            sbContent.Append(string.Format("手  機:{0}<br />", messageVO.Mobile));
            sbContent.Append(string.Format("傳  真:{0}<br />", messageVO.Fax));
            sbContent.Append(string.Format("電子信箱:{0}<br />", messageVO.EMail));
            sbContent.Append(string.Format("意  見:{0}<br />", messageVO.Content.Replace("\n", "<br />")));

            return sbContent.ToString();
        }
コード例 #4
0
 /// <summary>
 /// 新增訊息
 /// </summary>
 /// <param name="messageVO">被新增的訊息</param>
 /// <returns>新增後的訊息</returns>
 public MessageVO CreateMessage(MessageVO messageVO)
 {
     return MessageDao.CreateMessage(messageVO);
 }
コード例 #5
0
        public void Test_SendMessageMail()
        {
            //建立一篇訊息
            MessageVO messageVO = new MessageVO();
            messageVO.Content = "意見";
            messageVO.CreateName = "張大保";
            messageVO.EMail = "*****@*****.**";
            messageVO.Fax = "23223333";
            messageVO.Phone = "22234563";
            messageVO.Mobile = "0912333444";
            messageVO.CreatedDate = DateTime.Now;
            messageVO.CreateIP = "127.0.0.1";

            messageVO = m_MessageService.CreateMessage(messageVO);

            string classify = "聯絡我們收件者";
            IList<ItemParamVO> contactorList = m_SystemService.GetAllItemParamByNoDel(classify);

            if (contactorList != null && contactorList.Count > 0)
            {
                SystemParamVO mailVO = m_SystemService.GetSystemParamByRoot();
                MailService mailService = new MailService(mailVO.MailSmtp, int.Parse(mailVO.MailPort), mailVO.EnableSSL, mailVO.Account, mailVO.Password);

                StringBuilder sbMailList = new StringBuilder();
                foreach (ItemParamVO contactor in contactorList)
                {
                    sbMailList.Append(string.Format("{0};", contactor.Value));
                }

                string mailTitle = string.Format("收到一封由【{0}】從產基會網站提出的意見信。", messageVO.CreateName);
                string mailContent = GenMailContent(messageVO);

                mailService.SendMail(mailVO.SendEmail, sbMailList.ToString(), mailTitle, mailContent);
            }
        }