public static bool Email(Relation relation) { string Url = string.Format("http://www.justsay.cn/relation/Details/{0}", relation.ID); string msg = SMTPManager.MailSending(relation.ToEmail+";"+relation.FromEmail, "JustSay[相互喜欢通知邮件]", string.Format(RelationEmailTemplete, relation.ToName, relation.FromName, Url), "", 0); if (msg != "发送成功") { ToDoListBusiness.WriteLog(msg, "邮箱异常", "SMTPManager.MailSending", true); return false; } return true; }
public static bool SMS(Relation relation) { string Url = string.Format("http://www.justsay.cn/relation/Details/{0}", relation.ID); SmsStatus status = SMSHelper.SendMsg(relation.ToPhone, string.Format(RelationSMSTemplete, relation.FromName, relation.ToName, Url)); SmsStatus status2 = SMSHelper.SendMsg(relation.FromPhone, string.Format(RelationSMSTemplete, relation.FromName, relation.ToName, Url)); if (!(status.IsSuccess && status2.IsSuccess)) { ToDoListBusiness.WriteLog(status.ErrorMessage, "短信异常", "SMSHelper.SendMsg", true); return false; } return status.IsSuccess && status2.IsSuccess; // return true; }
public ActionResult Edit(Relation relation) { if (relation.MemberID.ToString() == User.Identity.Name) { if (ModelState.IsValid) { iRelation.Update(relation); return RedirectToAction("Index"); } return View(relation); } return View("~/Views/Common/Denied.cshtml"); }
public ActionResult Create([Bind(Include = "Content,Message,ToEmail,ToPhone,ToName,ImgUrl,FlashUrl,MusicUrl,ViewName")]Confess confess) { IMemberBusiness iMember = new MemberBusiness(new JustSayEntities()); if (iMember.IsLimitPost(User.Identity.Name.ToInt())) { ViewData["Validate"] = true; } else { ModelState.Remove("_mvcCaptchaText"); } if (ModelState.IsValid) { iConfess.Add(confess); // IMemberBusiness iMember = new MemberBusiness(new JustSayEntities()); confess.Member = iMember.GetDetail(Convert.ToInt32(User.Identity.Name)); Relation relation = new Relation { FromEmail = confess.Member.Email, ShowName = confess.Member.ShowName, MemberID = confess.Member.ID, FromPhone = confess.Member.Phone, FromName = confess.Member.RealName, ToEmail = confess.ToEmail, ToName = confess.ToName, ToPhone = confess.ToPhone, }; ViewBag.IsEmailSuccess = Inform.Email(confess); ViewBag.IsSMSSuccess = false; ViewBag.IsSMSMsg = ""; if (!string.IsNullOrEmpty(confess.ToPhone)) { if (confess.Member.Score > 50) { ViewBag.IsSMSSuccess = Inform.SMS(confess); confess.Member.Score -= 50; ViewBag.IsSmsSuccess = true; } else { ViewBag.IsSMSMsg = "节操币不足50,请多发贴,多回贴"; } } ViewData["ConfessID"] = confess.ID; return View("~/Views/Relation/Create.cshtml", relation); } return View(confess); }