Example #1
0
        /// <summary>
        /// 添加学生账号
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="passportType"></param>
        /// <param name="passportKey"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public int AddStudentPassport(int studentId, StudentAccountSourceEnum passportType, string passportKey, string password)
        {
            if (passportType == StudentAccountSourceEnum.人脸识别)
            {
                var entity = StudentPassportRepository.GetPassportByStuIdAndType(studentId, (int)passportType);
                if (entity != null)
                {
                    if (entity.Bsp_Status == (int)StudentAccountStatusEnum.禁用)
                    {
                        entity.Bsp_PassportKey = passportKey;
                        entity.Bsp_Status      = (int)StudentAccountStatusEnum.启用;
                        StudentPassportRepository.Update(entity);
                    }
                    return(1);
                }
            }
            Bas_StudentPassport studentPassport = new Bas_StudentPassport()
            {
                Bsp_StudentId    = studentId,
                Bsp_PassportType = (int)passportType,
                Bsp_PassportKey  = passportKey,
                Bsp_Password     = password,
                Bsp_Status       = (int)StudentAccountStatusEnum.启用,
                Bsp_CreateTime   = DateTime.Now,
                Bsp_UpdateTime   = DateTime.Now
            };

            return(StudentPassportRepository.Register(studentPassport));
        }
Example #2
0
 /// <summary>
 /// 更换手机
 /// </summary>
 /// <param name="studentId"></param>
 /// <param name="phone"></param>
 public void UpdateMobile(int studentId, string phone)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         try
         {
             StudentBll studentBll = new StudentBll();
             var        student    = studentBll.StudentRepository.Get(studentId);
             if (student != null)
             {
                 student.Bst_Phone      = phone;
                 student.Bst_UpdateTime = DateTime.Now;
                 studentBll.StudentRepository.Update(student);
             }
             var studentPassport = GetPassportByStuIdAndType(studentId, StudentAccountSourceEnum.手机);
             if (studentPassport != null)
             {
                 studentPassport.Bsp_PassportKey = phone;
                 studentPassport.Bsp_UpdateTime  = DateTime.Now;
                 StudentPassportRepository.Update(studentPassport);
             }
             scope.Complete();
         }
         catch (Exception ex)
         {
             RollbackTran();
             throw ex;
         }
     }
 }
Example #3
0
        public Bas_StudentPassport GetPassportByStuIdAndType(int studentId, StudentAccountSourceEnum passportType)
        {
            StudentBll studentBll      = new StudentBll();
            var        studentPassport = StudentPassportRepository.GetPassportByStuIdAndType(studentId, (int)passportType);

            if (studentPassport != null && studentPassport.Bsp_Status == (int)StudentAccountStatusEnum.启用)
            {
                return(studentPassport);
            }
            return(null);
        }
Example #4
0
        /// <summary>
        /// 忘记密码 (个人中心)
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="newPassword"></param>
        public void FindPassword(int studentId, string newPassword)
        {
            var studentPassport = GetPassportByStuIdAndType(studentId, StudentAccountSourceEnum.手机);

            if (studentPassport != null)
            {
                studentPassport.Bsp_Password   = Encrypt.GetMD5Pwd(newPassword);
                studentPassport.Bsp_UpdateTime = DateTime.Now;
                StudentPassportRepository.Update(studentPassport);
            }
        }
Example #5
0
        /// <summary>
        /// 忘记密码 (登录)
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="newPassword"></param>
        public void UpdatePasswordByPhone(string phone, string newPassword)
        {
            var studentPassport = StudentPassportRepository.GetPassportByPassportAndType(phone, (int)StudentAccountSourceEnum.手机);

            if (studentPassport != null)
            {
                studentPassport.Bsp_Password   = Encrypt.GetMD5Pwd(newPassword);
                studentPassport.Bsp_UpdateTime = DateTime.Now;
                StudentPassportRepository.Update(studentPassport);
            }
        }
Example #6
0
        public Bas_StudentPassport MobileLogin(string phone)
        {
            var studentPassport = StudentPassportRepository.GetPassportByPassportAndType(phone, (int)StudentAccountSourceEnum.手机);

            if (studentPassport != null)
            {
                AddStudentLogin(studentPassport.Bsp_StudentId);
                UpdateSumStudent(studentPassport.Bsp_StudentId);
            }
            return(studentPassport);
        }
Example #7
0
        /// <summary>
        /// 修改人脸识别(token)
        /// </summary>
        /// <param name="studentId"></param>
        /// <returns></returns>
        public bool UpdatePassportKey(int studentId, string passportKey)
        {
            var studentPassport = StudentPassportRepository.GetPassportByStuIdAndType(studentId, (int)StudentAccountSourceEnum.人脸识别);

            if (studentPassport != null)
            {
                studentPassport.Bsp_PassportKey = passportKey;
                studentPassport.Bsp_UpdateTime  = DateTime.Now;
                return(StudentPassportRepository.Update(studentPassport));
            }
            return(false);
        }
Example #8
0
        /// <summary>
        /// 删除人脸识别
        /// </summary>
        /// <param name="studentId"></param>
        /// <returns></returns>
        public bool UpdateStatus(int studentId, StudentAccountStatusEnum status)
        {
            var studentPassport = StudentPassportRepository.GetPassportByStuIdAndType(studentId, (int)StudentAccountSourceEnum.人脸识别);

            if (studentPassport != null)
            {
                studentPassport.Bsp_Status     = (int)status;
                studentPassport.Bsp_UpdateTime = DateTime.Now;
                return(StudentPassportRepository.Update(studentPassport));
            }
            return(false);
        }
Example #9
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="studentId"></param>
        /// <param name="oldPassword"></param>
        /// <param name="newPassword"></param>
        public int UpdatePassword(int studentId, string oldPassword, string newPassword)
        {
            var studentPassport = GetPassportByStuIdAndType(studentId, StudentAccountSourceEnum.手机);

            if (studentPassport != null)
            {
                if (studentPassport.Bsp_Password != Encrypt.GetMD5Pwd(oldPassword))
                {
                    return(-1);
                }

                studentPassport.Bsp_Password   = Encrypt.GetMD5Pwd(newPassword);
                studentPassport.Bsp_UpdateTime = DateTime.Now;
                return(StudentPassportRepository.Update(studentPassport) ? 1 : 0);
            }
            return(0);
        }
Example #10
0
        public Bas_StudentPassport Login(string passportKey, string password)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    Bas_StudentPassport studentPassport = StudentPassportRepository.Login(passportKey, password);
                    if (studentPassport != null)
                    {
                        AddStudentLogin(studentPassport.Bsp_StudentId);
                        UpdateSumStudent(studentPassport.Bsp_StudentId);
                    }

                    scope.Complete();

                    return(studentPassport);
                }
                catch (Exception ex)
                {
                    RollbackTran();
                    throw ex;
                }
            }
        }
Example #11
0
 public int CheckUniqueAccount(string account)
 {
     return(StudentPassportRepository.CheckUniqueAccount(account));
 }
Example #12
0
 /// <summary>
 /// 判断是否绑定人脸识别登录
 /// </summary>
 /// <param name="studentId"></param>
 /// <returns></returns>
 public bool IsBindFaceLogin(int studentId)
 {
     return(StudentPassportRepository.IsBindFaceLogin(studentId));
 }
Example #13
0
 /// <summary>
 /// 判断手机号是否存在
 /// </summary>
 /// <param name="phone"></param>
 /// <returns></returns>
 public bool IsExistPhone(string phone)
 {
     return(StudentPassportRepository.IsExistPhone(phone));
 }