Пример #1
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;
         }
     }
 }
Пример #2
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));
        }
Пример #3
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);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }