/// <summary> /// 签退 /// </summary> /// <param name="signIds"></param> /// <param name="timeOut"></param> /// <returns></returns> public static async Task Signout(Guid[] signIds, DateTime?timeOut = null) { using (var stuSignSvc = new StudentSignedService()) { await stuSignSvc.Signout(signIds, timeOut); } }
/// <summary> /// 修改签到信息 /// </summary> /// <param name="signId"></param> /// <param name="stateName"></param> /// <returns></returns> public static async Task CreateSigned(Guid signId, string stateName) { using (var signSvc = new StudentSignedService()) { await signSvc.ChangeSignedType(signId, stateName); } }
/// <summary> /// 获取所有学生的签到信息 /// </summary> /// <param name="clsId"></param> /// <returns></returns> public static async Task <List <StudentSignedDto> > GetStudentSigneds(Guid clsId) { using (var stuSignedSvc = new StudentSignedService()) { return(await stuSignedSvc.GetAll(m => m.ClassId == clsId) .Include(m => m.Student.Class) .Select(m => new StudentSignedDto() { ClassId = m.ClassId, ClassName = m.Student.Class.Name, ImagePath = m.Student.ImagePath, StudentId = m.StudentId, Name = m.Student.Name }).ToListAsync()); } }
/// <summary> /// 创建签到 /// </summary> /// <param name="clsId"></param> /// <param name="inTime"></param> /// <returns></returns> public static async Task CreateSigned(Guid clsId, DateTime?inTime = null) { var stus = await GetStudentSigneds(clsId); using (var stuSignedSvc = new StudentSignedService()) { foreach (var studentSignedDto in stus) { await stuSignedSvc.CreateAsync(new StudentSigned() { ClassId = clsId, InTime = inTime == null ? DateTime.Now : inTime.Value, SignedType = "正常", StudentId = studentSignedDto.StudentId }, false); } await stuSignedSvc.SaveAsync(false); } }