/// <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)); }
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); }
public Bas_StudentPassport GetStudentPassport(int studentId, StudentAccountSourceEnum passportType) { var passport = GetPassportByStuIdAndType(studentId, passportType); if (passport != null) { AddStudentLogin(studentId); UpdateSumStudent(studentId); } return(passport); }