コード例 #1
0
        public ActionResult ResultDetail(int resultId)
        {
            CdeSurveyResult model = _cdeSurveyManager.GetSurveyResult(resultId);

            ViewBag.surveyInfo = _cdeSurveyManager.GetSurveyInfoByUserSurveyId(model.UserSurveyId);
            return(View(model));
        }
コード例 #2
0
        public JsonResult SaveParticipates(int userSurveyId, string users)
        {
            dynamic           us          = JsonConvert.DeserializeObject(users);
            var               list        = new List <Cde_SurveySendUsers>();
            UserSurvey        usy         = _surveyManager.GetSurveyInfoByUserSurveyId(userSurveyId);
            Cde_Configuration config      = _configManager.GetConfig(CurrentTenant.TenantId);
            int               approveflag = config.PartUserIsApproval == 0 ? 2 : 1;

            foreach (dynamic u in us)
            {
                list.Add(new Cde_SurveySendUsers
                {
                    UserSurveyId = userSurveyId,
                    UserId       = u.id,
                    Relationship = u.ship,
                    Status       = 1
                });
            }
            if (list.Count < config.PartUserCount)
            {
                return
                    (Json(
                         new
                {
                    result = 0,
                    msg = CdeQuestion.UserSurveyStr + config.PartUserCount + CdeQuestion.UserSurveyStr1
                },
                         JsonRequestBehavior.DenyGet));
            }
            //判断各关系的人数是否合法
            if (config.MaxLeaderCount < list.Count(p => p.Relationship == 0))
            {
                return
                    (Json(
                         new
                {
                    result = 0,
                    msg = CdeQuestion.UserSurveyStr2 + config.MaxLeaderCount + CdeQuestion.UserSurveyStr1
                },
                         JsonRequestBehavior.DenyGet));
            }
            if (config.MaxColleagueCount < list.Count(p => p.Relationship == 1))
            {
                return
                    (Json(
                         new
                {
                    result = 0,
                    msg = CdeQuestion.UserSurveyStr3 + config.MaxColleagueCount + CdeQuestion.UserSurveyStr1
                },
                         JsonRequestBehavior.DenyGet));
            }
            if (config.MaxSubordinateCount < list.Count(p => p.Relationship == 2))
            {
                return
                    (Json(
                         new
                {
                    result = 0,
                    msg = CdeQuestion.UserSurveyStr4 + config.MaxSubordinateCount + CdeQuestion.UserSurveyStr1
                },
                         JsonRequestBehavior.DenyGet));
            }
            if (config.SelfParticipate < list.Count(p => p.Relationship == 3))
            {
                return
                    (Json(
                         new
                {
                    result = 0,
                    msg = CdeQuestion.UserSurveyStr5 + config.SelfParticipate + CdeQuestion.UserSurveyStr1
                },
                         JsonRequestBehavior.DenyGet));
            }
            _userSendSurveyManager.AddSurveySendUsers(list);
            _userSurveyManager.ChangeUserSurveyApproveFlag(userSurveyId, approveflag);
            if (approveflag == 1)
            {
                try
                {
                    string title = string.Format(LanguageResources.SendMessage.CdeSurveyUserApprove_Title,
                                                 CurrentUser.Realname, usy.Survey.SurveyTitle);
                    string content = string.Format(LanguageResources.SendMessage.CdeSurveyUserApprove_Content
                                                   , CurrentUser.Realname, usy.Survey.SurveyTitle,
                                                   usy.Survey.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                                   usy.Survey.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                                   Url.RetechAction("ApproveUserSurveyList", "CdeUserSurvey") + "?keep=1");

                    SendMessage(title, content, new[] { CurrentUser.Leader }, 11);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog("发送360°评估审批参评人员消息时发生错误", ex);
                }
            }

            return(Json(new { result = 1, msg = Exampaper.SaveSuccess }, JsonRequestBehavior.DenyGet));
        }