Exemple #1
0
 public bool addSuperiorLetter(SuperiorLetter superiorLetter)
 {
     try
     {
         _superiorLetterRepository.Add(superiorLetter);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #2
0
 public bool updateSperiorLetter(SuperiorLetter superiorLetter)
 {
     try
     {
         _superiorLetterRepository.Update(superiorLetter);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #3
0
        public ActionResult CheckSperiorLetter(long userId)
        {
            SuperiorLetter superiorLetter = _superiorLetterService.getSuperiorLettersBySuidRuidC(loginUser.userId, userId);

            if (superiorLetter != null)
            {
                JsonResult["boo_success"] = true;
                return(Json(JsonResult));
            }
            else
            {
                JsonResult["boo_success"] = false;
                return(Json(JsonResult));
            }
        }
Exemple #4
0
        public ActionResult UpdateSperiorLetter(long userId, string message)
        {
            SuperiorLetter superiorLetter = _superiorLetterService.getSuperiorLettersBySuidRuid(loginUser.userId, userId);

            superiorLetter.superiorLetterIfReply   = true;
            superiorLetter.superiorLetterNewestRly = message;
            if (_superiorLetterService.updateSperiorLetter(superiorLetter))
            {
                JsonResult["boo_success"] = true;
                return(Json(JsonResult));
            }
            else
            {
                JsonResult["boo_success"] = false;
                return(Json(JsonResult));
            }
        }
Exemple #5
0
        public ActionResult AddSuperiorLetter(long userId)
        {
            SuperiorLetter superiorLetter = new SuperiorLetter();

            superiorLetter.superiorLetterReceiveUId = userId;
            superiorLetter.superiorLetterSendUId    = loginUser.userId;
            if (_superiorLetterService.addSuperiorLetter(superiorLetter))
            {
                JsonResult["boo_success"] = true;
                return(Json(JsonResult));
            }
            else
            {
                JsonResult["boo_success"] = false;
                return(Json(JsonResult));
            }
        }
Exemple #6
0
        public ActionResult bestSuperior(long superiorLetterId, long userId, int superiorLetterIfComment)
        {
            SuperiorLetter superiorLetter = _superiorLetterService.getSuperiorLettersById(superiorLetterId);

            superiorLetter.superiorLetterIfComment = superiorLetterIfComment;
            if (_superiorLetterService.updateSperiorLetter(superiorLetter))
            {
                //更新或添加一周方案高手榜的相关数据
                User user = _userService.getUserById(userId);
                if (user.userWeekExpsStartTime == null || user.userWeekExps == null)
                {
                    user.userWeekExps          = 1;
                    user.userWeekExpsStartTime = DateTime.Now;
                    _userService.updateUser(user);
                }
                else
                {
                    DateTime d = Convert.ToDateTime(user.userWeekExpsStartTime);
                    if ((DateTime.Now - d).TotalDays > 7)
                    {
                        user.userWeekExps          = 1;
                        user.userWeekExpsStartTime = DateTime.Now;
                        _userService.updateUser(user);
                    }
                    else
                    {
                        user.userWeekExps = user.userWeekExps + 1;
                        _userService.updateUser(user);
                    }
                }
                JsonResult["boo_success"] = true;
                return(Json(JsonResult));
            }
            else
            {
                JsonResult["boo_success"] = false;
                return(Json(JsonResult));
            }
        }