public static void UpdateBBSTopicReplyStatus(BBSTopicReply entity) { DataCommand command = DataCommandManager.GetDataCommand("UpdateBBSTopicReply"); command.SetParameterValue("@Status", entity.Status); command.SetParameterValue("@SysNo", entity.TopicReplySysNo); command.SetParameterValue("@IsFirstShow", entity.IsFirstShow); command.SetParameterValue("@CompanyCode", CompanyCode); command.ExecuteNonQuery(); }
private static void ReplyIsFirstShowSendMail(BBSTopicReply entity) { //并发送email给相应的PM(topiclasteditsysno),评论发起者(TopicCreateCustomerSysNo),所有评论回复者 string MailSubject = @"您关于@ProductName的评论被回复啦"; List <string> emailaddressList = new List <string>(); StringBuilder sb = new StringBuilder(); BBSTopicMaster master = new BBSTopicMaster(); master.CommentSysNo = entity.TopicSysNo; //获取该回复的主题评论信息 List <BBSTopicMaster> Commentlist = ShowCommentDA.GetBBSMasterListBySysNo(master); #region MailBody string MailBody = @"<!DOCTYPE HTML PUBLIC \'-//W3C//DTD XHTML 1.0 Transitional//EN\'><html xmlns=\'http:" + "//www.w3.org/1999/xhtml\'>\r\n<head><title>\r\n\tUntitled Page\r\n</title><link href=\'ht" + "tp://www.newegg.com.cn/WebResources/css/MailCss.css\' rel=\'stylesheet\'\r\n t" + "ype=\'text/css\' />\r\n\r\n \r\n\r\n</head>\r\n<body>\r\n\r\n<div id=\'outside1\'>\r\n " + " <div id=\'outside2\'>\r\n <div id=\'head\'>\r\n <div " + " style=\'background: url(http://img8.newegg.com.cn/neweggPic2/Marketing/hf/head_b" + "g.jpg);height: 76px;width: 620px;margin: 0px 0px 20px 0px;\'>\r\n " + " <div id=\'logo\'>\r\n <a href=\'http://www.newegg.co" + "m.cn/\'>\r\n <img title=\'新蛋网\' height=\'51\' alt=\'新蛋网\' " + "src=\'http://www.newegg.com.cn/WebResources/images/MailImages/logo.jpg\'\r\n " + " width=\'258\' /></a></div>\r\n <d" + "iv id=\'tel\'>\r\n 全国服务热线:400-820-4400</div>\r\n " + " \r\n </div>\r\n </div>\r\n " + " <div id=\'content\'>\r\n <table border=\'0\' cellpadding=\'0\' cells" + "pacing=\'0\' class=\'table01\'>\r\n <tr class=\'table_col01\'>\r\n " + " <td class=\'table_lt\'> \r\n " + " </td>\r\n <td class=\'table_tb\'> \r\n " + " </td>\r\n <td class=\'table_rt\'> \r\n " + " </td>\r\n </tr>\r\n " + " <tr class=\'table_col01\'>\r\n <td> \r\n " + " </td>\r\n <td>\r\n " + " <div id=\'status_forReply\'>\r\n </div>\r\n " + " <div id=\'status_iconforReply\'>\r\n " + " </div>\r\n </td>\r\n " + " <td> \r\n </td>\r\n </tr>\r" + "\n <tr>\r\n <td class=\'table_lb\'>" + " \r\n </td>\r\n <td class=\'" + "table_tb\'> \r\n </td>\r\n <" + "td class=\'table_rb\'> \r\n </td>\r\n " + " </tr>\r\n </table>\r\n <div class=\'subhea" + "d\'>\r\n <span></span>\r\n <div>\r\n " + " 评论详情</div>\r\n </div>\r\n " + " <table border=\'0\' cellpadding=\'0\' cellspacing=\'0\' class=\'table01\'>\r\n " + " <tr class=\'table_col01\'>\r\n <td class=\'" + "table_lt\'> \r\n </td>\r\n <" + "td class=\'td_width02 table_tb\'> \r\n </td>\r\n " + " <td class=\'table_tb\'> \r\n </td>" + "\r\n <td class=\'td_width03 table_tb\'> \r\n " + " </td>\r\n <td class=\'td_width03 table_t" + "b\'> \r\n </td>\r\n <td clas" + "s=\'td_width03 table_tb\'> \r\n </td>\r\n " + " <td class=\'table_rt\'> \r\n </td>\r\n " + " </tr>\r\n <tr>\r\n " + " <td> \r\n </td>\r\n <td" + " colspan=\'5\'>\r\n <ul>\r\n " + " <li>相关评论内容及该评论下的所有回复</li>\r\n </ul>\r\n\r\n@AllT" + "opicContent\r\n </td>\r\n <td>" + " \r\n </td>\r\n </tr>\r\n " + " <tr>\r\n <td class=\'table_lb\'> \r\n " + " </td>\r\n\r\n <td class=\'table_t" + "b\'> \r\n </td>\r\n <td clas" + "s=\'table_tb\'> \r\n </td>\r\n " + " <td class=\'table_tb\'> \r\n </td>\r\n " + " <td class=\'table_tb\'> \r\n </td>\r\n " + " <td class=\'table_tb\'> \r\n </t" + "d>\r\n <td class=\'table_rb\'> \r\n " + " </td>\r\n </tr>\r\n </table>\r\n " + " <br />\r\n <table width=\'100%\' border=\'0\' cellpa" + "dding=\'0\'>\r\n <tr>\r\n <td height=\'27\'>" + " 您可以点击@TopicReplyLink,继续与其他的蛋友们分" + "享您的心得和体会哦~</td>\r\n </tr>\r\n<tr>\r\n <td " + "height=\'27\'>不想再收到此类邮件?点击<a href=\'http://www.newegg.com.cn/Favorite/ModifyPersona" + "lData.aspx?SubItem=02&type=1\' target=\'_blank\'><span style=\'font-size: 12pt\'><i><" + "u>这里</u></i></span></a>前往帐户中心进行设置</td>\r\n </tr>\r\n\r\n " + " </table>\r\n \r\n <table border=\'0\' cel" + "lpadding=\'0\' cellspacing=\'0\' class=\'table01\'>\r\n <tr>\r\n " + " <td style=\'width: 5px\'>\r\n </" + "td>\r\n <td id=\'Memo\' colspan=\'3\'></td>\r\n\r\n " + " </tr>\r\n </table>\r\n \r\n " + " <br>\r\n </div>\r\n <div id=\'foot\'>\r\n " + " <div id=\'bar02\'>\r\n <div id=\'bar02_left\'>\r\n " + " </div>\r\n <div id=\'bar02_right\'>\r\n " + " </div>\r\n </div>\r\n <" + "div id=\'foot_text\'>\r\n <div align=\'center\'>上海新蛋电子商务有限公司(<a" + " href=\'http://www.newegg.com.cn\'>www.newegg.com.cn</a>) | 美国新蛋(<a href=\'http://w" + "ww.newegg.com\'>www.newegg.com</a>)<br>\r\n 公司地址:上海延安西路号华敏翰尊" + "国际楼<br>\r\n 公司邮编:<br>\r\n 订购电话:400-820-44" + "00<br>\r\n 电子邮件:<a href=\'mailto:[email protected]\'>supp" + "[email protected] </a> </div>\r\n </div>\r\n </div>\r" + "\n </div>\r\n </div>\r\n</body>\r\n</html>"; #endregion if (Commentlist != null && Commentlist.Count > 0) { BBSTopicMaster topicMaster = Commentlist[0]; #region 产品标题部分 string productLink = "http://www.newegg.com.cn/Products/ProductDetail.aspx?sysno=" + topicMaster.ReferenceSysNo; sb = new StringBuilder(" <table cellpadding='0' cellspacing='0' width='80%' bordercolor='#cccccc' style='border-top: Silver 1px solid;word-break:break-all'>"); sb.Append("<tr><td colspan='2'><a href='" + productLink + "' target='_blank'><span style='font-size: 12pt'><b>商品:</b>" + topicMaster.ProductName + "</span></a><br/><hr border='1'/></td></tr>"); sb.Append("<tr><td style='padding-left: 5px; padding-top: 3px; height: 20px; width: 219px;'>"); sb.Append("<strong><span style='color: black'>" + topicMaster.Title + "</td><td align='right'> </td></tr>"); sb.Append("<tr><td colspan='2' style='padding-left: 10px;'>" + topicMaster.TopicContent.ToString().Replace("\r\n", "<br />") + "</td></tr>"); sb.Append("<tr style='height: 20px;'><td colspan='2' align='right' style='height: 20px'>"); sb.Append("<strong>" + topicMaster.CustomerName + "</strong> 评论于" + topicMaster.CreateDate.ToString("yyyy-MM-dd HH:mm") + " </td></tr>"); #endregion #region 回复部分 sb.Append("<tr><td colspan='2' style='padding-left: 10px;'>"); sb.Append("<table width='100%' cellpadding='0' cellspacing='0' style='border-top: gainsboro 1px solid'><tr> <td style='width: 32px' valign='top'><span style='color: royalblue'><strong>回复</strong></span></td><td>"); //发邮件该商品的PM if (!string.IsNullOrEmpty(Commentlist[0].PMEmailAddress)) { emailaddressList.Add(Commentlist[0].PMEmailAddress); } if (Commentlist[0].IsSubscribe == 1) { emailaddressList.Add(Commentlist[0].CustomerEmail); } List <BBSTopicReply> replylist = ShowCommentDA.GetAllShowBBSTopicReplyByTopicSysNo(entity.TopicSysNo); if (replylist != null && replylist.Count > 0) { foreach (BBSTopicReply repInfo in replylist) { sb.Append("<table width='100%' cellpadding='0' cellspacing='0'>"); sb.Append("<tr style='" + (repInfo == null ? "background-color:#FFFFCC;" : " ") + "'><td>"); sb.Append("<img src='http://www.newegg.com.cn/WebResources/Images/BBS/arrow_blue_right.gif' /> " + repInfo.ReplyContent.ToString().Replace("\r\n", "<br />")); sb.Append(" " + (Convert.ToInt32(repInfo.WithAdditionalText) == 1 ? (repInfo == null ? "感谢您对新蛋网的关注与支持,祝您购物愉快!" : "") : "") + "</td></tr>"); sb.Append(" <tr><td align='right' valign='top' style='word-break: normal'><strong>"); sb.Append(repInfo.CreateUserType != 0 ? "新蛋网" : repInfo.ReplyCustomerName + "</strong>"); sb.Append(" 回复于 " + Convert.ToDateTime(repInfo.CreateDate).ToString("yyyy-MM-dd HH:mm") + " "); sb.Append("</td></tr></table>"); if (repInfo.IsFirstShow == 1) { if (!string.IsNullOrEmpty(repInfo.ReplyCustomerEmail) && repInfo.CreateUserSysNo != entity.CreateUserSysNo && repInfo.IsSubscribe == 1 && repInfo.CreateUserType == 0 && !emailaddressList.Contains(repInfo.ReplyCustomerEmail)) { emailaddressList.Add(repInfo.ReplyCustomerEmail); //所有评论回复已展示的回复者 } } } sb.Append(" </td></tr></table>"); sb.Append("</td></tr>"); sb.Append("</table>"); string replyLink = "http://www.newegg.com.cn/Products/AddTopicReply.aspx?ReplyTopicSysNo=" + entity.TopicSysNo + "&ProductSysNo=" + topicMaster.ReferenceSysNo; MailBody = MailBody.Replace("@TopicReplyLink", "<a href='" + replyLink + "' target='_blank'><span style='font-size: 14pt'><i><u>回复</u></i></span></a>"); } MailSubject = MailSubject.Replace("@ProductName", topicMaster.ProductName); MailBody = MailBody.Replace("@AllTopicContent", sb.ToString()) .Replace("@ProductSysNo", topicMaster.ReferenceSysNo.ToString()); #endregion } emailaddressList.Distinct(); foreach (string emailAddress in emailaddressList) { bool mailstatus = ShowCommentDA.InsertReplyMail(emailAddress, string.Empty, MailSubject, MailBody); if (!mailstatus) { throw new Exception(DateTime.Now + "对评论" + entity.TopicSysNo + "的回复" + entity.TopicReplySysNo + "第一次展示发邮件通知出错!"); } } WriteLog("评论" + Commentlist[0].CommentSysNo + "下的回复" + entity.TopicReplySysNo + "展示成功。并发送email给相应的PM,评论发起者,所有评论回复者。"); }