Пример #1
0
        public ActionResult AddStudent(string phone, string code)
        {
            bool   success   = false;
            string msg       = "";
            var    student   = studentInfoBll.GetStudentInfoByAccount(phone);
            bool   checkCode = true;

            try
            {
                checkCode = SmsCookie.GetSmsCode.Check(phone, code);
            }
            catch (Exception)
            {
                checkCode = false;
            }

            if (student != null && student.Bst_SchoolId == 0 && checkCode)
            {
                success = studentApplyBll.StudentApply(student.Bst_Id, CurrentUser.Teacher.Yoh_Phone, CurrentUser.Teacher.Yoh_Id);
                msg     = success ? "添加成功" : "添加失败";
            }
            else
            {
                if (student == null)
                {
                    msg = "该手机号未注册";
                }
                else if (student.Bst_SchoolId > 0)
                {
                    msg = "该学生已绑定校区";
                }
                else
                {
                    msg = "验证码错误";
                }
                success = false;
            }
            return(Json(new JsonSimpleResponse()
            {
                State = success, ErrorMsg = msg
            }));
        }
Пример #2
0
        public ActionResult BindSchool(string phone)
        {
            StudentApplyBll studentApplyBll = new StudentApplyBll();
            var             result          = studentApplyBll.StudentApply(GetCurrentUser().StudentId, phone);

            if (result)
            {
                SchoolTeacherBll schoolTeacherBll = new SchoolTeacherBll();
                var school = schoolTeacherBll.GetSchoolTeacherByPhone(phone);
                return(Json(new JsonResponse <DtoSchoolTeacher>()
                {
                    State = true, ErrorMsg = "申请成功", Data = school
                }));
            }
            return(Json(new JsonSimpleResponse()
            {
                State = false, ErrorMsg = "申请失败"
            }));
        }