Ejemplo n.º 1
0
 public void Update(Message model)
 {
     var target = Find(model.ID);
     db.Attach<Message>(target);
     target.Content = model.Content;
     target.Title = model.Title;
     db.Commit();
 }
Ejemplo n.º 2
0
 public void AddSysMessage()
 {
     var message = new Message()
     {
         AddTime = DateTime.Now,
         SenderID = 0,
         RecipientID = 1,
         MessageType = (int)MessageType.System,
         RecipienterStatus = (int)MessageStatus.Show,
         Title = "系统留言添加",
         Content = "系统留言添加"
     };
     MessageService.Create(message);
 }
Ejemplo n.º 3
0
 public void AddMemberMessage()
 {
     var message = new Message()
     {
         AddTime = DateTime.Now,
         SenderID = 2,
         RecipientID = 1,
         MessageType = (int)MessageType.Member,
         RecipienterStatus = (int)MessageStatus.Show,
         Title = "用户发送留言",
         Content = "用户发送留言"
     };
     MessageService.Create(message);
 }
Ejemplo n.º 4
0
 public ActionResult Details(MessageViewModel model)
 {
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var entity = new Message()
             {
                 SenderID = CookieHelper.MemberID,
                 RecipientID = model.SenderID,
                 Title = model.Name,
                 Content = model.Replay,
                 AddTime = DateTime.Now,
                 MessageType = (int)MessageType.Reply,
                 RecipienterStatus = (int)MessageStatus.Show,
                 SenderStatus = (int)MessageStatus.Show
             };
             MessageService.Create(entity);
             result.Message = "回复留言成功!";
             return Content("<script>window.top.location.reload();</script>");
         }
         catch (Exception ex)
         {
             result.Message = "回复留言失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "回复留言失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Ejemplo n.º 5
0
 private void SendAuthFieldedMessage(IEnumerable<int> IdsArray, string reason = null)
 {
     foreach (var id in IdsArray)
     {
         var outdoor = Find(id);
         var memberID = outdoor.MemberID;
         var info = "您好!您发布媒体信息:(" + outdoor.Name + ")未通过审核";
         var infoContent = "【请检查信息是否含有非法字符,或者表单是否填写完整】";
         if (!string.IsNullOrEmpty(reason))
         {
             infoContent = reason;
         }
         var message = new Message()
         {
             AddTime = DateTime.Now,
             SenderID = 0,
             RecipientID = memberID,
             MessageType = (int)MessageType.System,
             RecipienterStatus = (int)MessageStatus.Show,
             Title = info,
             Content = infoContent
         };
         MessageService.Create(message);
     }
 }
Ejemplo n.º 6
0
 public void Delete(Message model)
 {
     var target = Find(model.ID);
     db.Remove<Message>(target);
     db.Commit();
 }
Ejemplo n.º 7
0
 public void Create(Message model)
 {
     db.Add<Message>(model);
     db.Commit();
 }
Ejemplo n.º 8
0
 private void SendCompanyAuthFailedMessage(IEnumerable<int> IdsArray)
 {
     foreach (var id in IdsArray)
     {
         var member = MemberService.Find(id);
         var message = new Message()
         {
             AddTime = DateTime.Now,
             SenderID = 0,
             RecipientID = member.MemberID,
             MessageType = (int)MessageType.System,
             RecipienterStatus = (int)MessageStatus.Show,
             Title = member.NickName + ",您好!您的企业资料未通过审核",
             Content = member.NickName + ",您好!您的企业资料未通过审核。具体原因,请查看企业基本信息"
         };
         MessageService.Create(message);
     }
 }
Ejemplo n.º 9
0
        public ActionResult AddMessage(int id, string name, string content)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                var message = new Message()
                {
                    AddTime = DateTime.Now,
                    SenderID = CookieHelper.MemberID,
                    RecipientID = id,
                    MessageType = (int)MessageType.Member,
                    RecipienterStatus = (int)MessageStatus.Show,
                    Title = name,
                    Content = content
                };
                MessageService.Create(message);
                result.Message = "留言成功!";
            }
            catch (Exception ex)
            {
                result.Message = "留言失败!";
                result.AddServiceError(Utilities.GetInnerMostException(ex));
                LogHelper.WriteLog(CookieHelper.MemberID + "留言失败!", ex);
            }

            return Json(result);
        }