Ejemplo n.º 1
0
        public void PostAssessment(int employeeID, int stID, string judgment)
        {
            int    _code    = 0;
            string _message = "考评录入失败";

            if (!string.IsNullOrEmpty(judgment))
            {
                Employee _employee = _employeeService.GetBaseEmployeeByID(employeeID);

                if (_employee != null)
                {
                    Assessment _assessment = new Assessment();
                    _assessment.EmployeeID = employeeID;
                    _assessment.STID       = stID;
                    IList <Assessment> _assessmentList = _assessmentService.GetAssessment(_assessment);
                    if (_assessmentList.Count > 0)
                    {
                        _assessment          = _assessmentList[0];
                        _assessment.TrueName = _employee.TrueName;
                        _assessment.Judgment = judgment;

                        _code    = _assessmentService.UpdateAssessment(_assessment);
                        _message = "修改考评记录成功!";
                    }
                    else
                    {
                        _assessment.TrueName = _employee.TrueName;
                        _assessment.Judgment = judgment;
                        _code    = _assessmentService.InsertAssessment(_assessment);
                        _message = "录入考评记录成功!";
                    }
                }
                else
                {
                    _code    = -1;
                    _message = "对不起,用户不存在!";
                }
            }
            else
            {
                _message = "对不起,评语不能为空!";
            }
            RenderText("{\"code\":\"" + _code + "\",\"message\":\"" + _message + "\"}");

            CancelLayout();
        }