示例#1
0
        public ActionResult GetSchoolName(string phone)
        {
            SchoolTeacherBll schoolTeacherBll = new SchoolTeacherBll();
            var result = schoolTeacherBll.GetSchoolTeacherByPhone(phone);

            if (result != null && result.Yoh_SchoolId > 0)
            {
                return(Json(new JsonResponse <string>()
                {
                    State = true, ErrorMsg = "查询成功", Data = result.Bsl_SchoolName
                }));
            }
            return(Json(new JsonSimpleResponse()
            {
                State = false, ErrorMsg = "查询失败"
            }));
        }
示例#2
0
        public ActionResult FindPwd(string phone, string pwd, string repwd, string code)
        {
            AccountBll       accountBll       = new AccountBll();
            SchoolTeacherBll schoolTeacherBll = new SchoolTeacherBll();
            bool             success          = false;
            string           msg        = "";
            bool             checkCode  = false;
            bool             checkPhone = false;
            bool             checkPwd   = false;
            DtoSchoolTeacher teacher    = null;

            try
            {
                checkCode = SmsCookie.GetSmsCode.Check(phone, code);
            }
            catch (Exception)
            {
                checkCode = false;
            }
            msg = checkCode ? "" : "验证码错误";
            if (checkCode)
            {
                teacher = schoolTeacherBll.GetSchoolTeacherByPhone(phone);
                if (teacher != null)
                {
                    checkPhone = true;
                    checkPwd   = !string.IsNullOrEmpty(pwd) && pwd == repwd;
                    msg        = checkPwd ? "" : "密码错误";
                }
                else
                {
                    msg        = "账号不存在";
                    checkPhone = false;
                }
            }
            if (checkCode && checkPhone && checkPwd)
            {
                success = schoolTeacherBll.UpdatePwd(teacher.Yoh_Id, Encrypt.GetMD5Pwd(pwd));
                msg     = success ? "修改成功" : "修改失败";
            }
            return(Json(new JsonSimpleResponse()
            {
                State = success, ErrorMsg = msg
            }));
        }
示例#3
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 = "申请失败"
            }));
        }
示例#4
0
        public ActionResult Login(string account, string pwd)
        {
            bool             success          = false;
            string           msg              = "";
            SchoolBll        schoolBll        = new SchoolBll();
            SchoolTeacherBll schoolTeacherBll = new SchoolTeacherBll();

            DtoSchoolTeacher schoolTeacher = schoolTeacherBll.Login(account, pwd);
            DtoSchool        school        = null;

            if (schoolTeacher != null && schoolTeacher.Yoh_Status == (int)StatusEnum.效)
            {
                school = schoolBll.GetSchoolDto(schoolTeacher.Yoh_SchoolId);
                if (schoolTeacher != null && school != null && school.Bsl_Status != (int)SchoolStatusEnum.合同到期 && school.Bsl_IsValid)
                {
                    CookieUserModel user = new CookieUserModel();
                    user.Teacher = schoolTeacher.ConvertTo <CookieTeacher>();;
                    user.School  = school.ConvertTo <CookieSchool>();
                    LoginCookieHelper.SetCurrentUser(user);
                    success = true;
                    msg     = "登录成功";
                }
                else
                {
                    msg = "当前校区不允许登录";
                }
            }
            else
            {
                msg = "登录失败";
            }
            if (!success)
            {
                LoginCookieHelper.SetCurrentUser(null);
            }

            return(Json(new JsonSimpleResponse()
            {
                State = success, ErrorMsg = msg
            }));
        }