示例#1
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.Members.Guestbook guestbook = new Maticsoft.BLL.Members.Guestbook();
     Maticsoft.Model.Members.Guestbook model = guestbook.GetModel(this.Id);
     try
     {
         if (model != null)
         {
             model.ReplyDescription = this.TxtReply.Text;
             model.Status = 1;
             model.HandlerDate = new DateTime?(DateTime.Now);
             model.HandlerNickName = base.CurrentUser.NickName;
             model.HandlerUserID = new int?(base.CurrentUser.UserID);
             if (guestbook.Update(model))
             {
                 MessageBox.ShowSuccessTip(this, "发送成功");
                 this.lblTip.Visible = true;
             }
             else
             {
                 MessageBox.ShowFailTip(this, "发送失败,请检查邮件配置");
                 this.lblTip.InnerText = "出现异常,请重试";
                 this.lblTip.Visible = true;
             }
         }
     }
     catch (Exception)
     {
         MessageBox.ShowFailTip(this, "发送失败,请检查邮件配置");
     }
 }
示例#2
0
 public bool SendGuestBookEmail(Maticsoft.Model.Members.Guestbook GuestBookModel)
 {
     Maticsoft.BLL.Members.Guestbook guestbook = new Maticsoft.BLL.Members.Guestbook();
     int templetId = Globals.SafeInt(ConfigSystem.GetValueByCache("EmailTemplet_GuestBook"), 0);
     Maticsoft.Model.Ms.EmailTemplet modelByCache = this.GetModelByCache(templetId);
     if (((modelByCache != null) && (GuestBookModel != null)) && (GuestBookModel.ParentID.HasValue && (GuestBookModel.ParentID.Value > 0)))
     {
         Maticsoft.Model.Members.Guestbook model = guestbook.GetModel(GuestBookModel.ParentID.Value);
         if (model != null)
         {
             string body = this.ReplaceTag(modelByCache.EmailBody, new string[][] { new string[] { "{Domain}", HttpContext.Current.Request.Url.Authority }, new string[] { "{CreatedDate}", DateTime.Now.ToString("yyyy-MM-dd") }, new string[] { "{Description}", model.Description }, new string[] { "{UserName}", model.CreateNickName }, new string[] { "{ReplyResult}", GuestBookModel.Description }, new string[] { "{QuestionDate}", model.CreatedDate.ToString("yyyy-MM-dd") } });
             try
             {
                 MailSender.Send(GuestBookModel.CreatorEmail, modelByCache.EmailSubject, body);
                 return true;
             }
             catch (Exception)
             {
                 return false;
             }
         }
     }
     return false;
 }