示例#1
0
        public AttendanceDetailResult AttendanceRecordForRooms(string building, string floor, string room, string time, string teacher, string section)
        {
            AttendanceDetailResult result = new AttendanceDetailResult();

            // 获取该楼栋下的所有房间
            var           classrooms = RoomService.GetRoomsForBuildingName(building, floor, room);
            SchollTime    schollTime = CourseService.GetSchollTime(time);
            List <Course> courses    = null;

            // 筛选出在该房间下的所有课程
            courses = FilterForCondition(time: schollTime, teacher: teacher, section: section, building: building, floor: floor, room: room, courses: courses);

            if (courses == null || courses.Count == 0)
            {
                result.Message    = "查询不到符合该条件的课程";
                result.ResultCode = ResultCode.Error;
                return(result);
            }
            // 获取该课程的签到详情
            AttendanceDetails[] attendanceDetails = GetAttendanceDetailsForCourses(courses, schollTime);
            if (attendanceDetails == null || attendanceDetails.Count() == 0)
            {
                result.Message    = "有课,并未发起签到";
                result.ResultCode = ResultCode.Error;
            }
            else
            {
                result.Data       = attendanceDetails;
                result.ResultCode = ResultCode.Ok;
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// 获取签到详情
        /// </summary>
        /// <param name="teacher">教师</param>
        /// <param name="time">时间</param>
        /// <param name="section">节次</param>
        /// <returns></returns>
        public AttendanceDetailResult AttendanceRecord(string teacher, string time, string section)
        {
            Sys_User user = null;

            if (teacher != null)
            {
                user = UserService.GetEntity(u => u.F_Account == teacher || u.F_RealName == teacher).FirstOrDefault();
            }
            SchollTime schollTime = CourseService.GetSchollTime(time);
            var        courses    = FilterForCondition(schollTime, teacher, section);
            var        result     = new AttendanceDetailResult();

            if (courses == null || courses.Count() == 0)
            {
                result.Message = "查询不到符合该条件的课程";
                return(result);
            }
            var attendanceDetails = GetAttendanceDetailsForCourses(courses, schollTime, user);

            if (attendanceDetails == null || attendanceDetails.Count() == 0)
            {
                result.Message    = "该教师今天有课程,但并没有发起签到";
                result.ResultCode = ResultCode.Error;
            }
            else
            {
                result.Data       = attendanceDetails;
                result.ResultCode = ResultCode.Ok;
            }
            return(result);
        }