Пример #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 ActionResult AjaxGbook(FormCollection Fm)
 {
     string str = InjectionFilter.Filter(Fm["Title"]);
     string str2 = InjectionFilter.Filter(Fm["Content"]);
     string str3 = InjectionFilter.Filter(Fm["Email"]);
     if ((string.IsNullOrWhiteSpace(str) || string.IsNullOrWhiteSpace(str2)) || string.IsNullOrWhiteSpace(str3))
     {
         return base.Content("false");
     }
     Maticsoft.BLL.Members.Guestbook guestbook = new Maticsoft.BLL.Members.Guestbook();
     Maticsoft.Model.Members.Guestbook model = new Maticsoft.Model.Members.Guestbook {
         CreatedDate = DateTime.Now,
         CreatorEmail = str3,
         Description = str2,
         Title = str,
         Status = 0,
         ToUserID = -1,
         ParentID = 0,
         CreateNickName = str3
     };
     if (guestbook.Add(model) <= 0)
     {
         return base.Content("false");
     }
     return base.Content("true");
 }
Пример #3
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;
 }
Пример #4
0
 public ActionResult Index(string viewName = "Index", int top = 6)
 {
     List<Maticsoft.Model.Members.Guestbook> modelList = new Maticsoft.BLL.Members.Guestbook().GetModelList(top);
     return base.View(viewName, modelList);
 }