private static DateTime OutAuto(DateTime date) { //the school day model var schoolDay = DataSourceBackend.Instance.SchoolCalendarBackend.ReadDate(date); var defaultOut = date.Add(schoolDay.TimeEnd); return(UTCConversionsBackend.KioskTimeToUtc(defaultOut)); // out auto }
/// <summary> /// Sets the student to be logged In /// </summary> /// <param name="id">The Student ID</param> public void SetLogIn(StudentModel data) { if (data == null) { return; } data.Status = StudentStatusEnum.In; var currentTime = DateTimeHelper.Instance.GetDateTimeNowUTC(); // Update the Attendance Log var temp = new AttendanceModel { In = currentTime, Emotion = data.EmotionCurrent, StudentId = data.Id }; var currentKioskDate = UTCConversionsBackend.UtcToKioskTime(currentTime).Date; //the school day model var schoolDay = DataSourceBackend.Instance.SchoolCalendarBackend.ReadDate(currentKioskDate); //set auto punch-out time if (schoolDay == null) //if today is not a school day, use the default dismissal time as punch out time { var defaultEndTime = SchoolDismissalSettingsBackend.Instance.GetDefault().EndNormal; temp.Out = UTCConversionsBackend.KioskTimeToUtc(currentKioskDate.Add(defaultEndTime)); } else { temp.Out = UTCConversionsBackend.KioskTimeToUtc(currentKioskDate.Add(schoolDay.TimeEnd)); schoolDay.HasAttendance = true; //Save the school calendar change DataSourceBackend.Instance.SchoolCalendarBackend.Update(schoolDay); } data.Attendance.Add(temp); Update(data); }
/// <summary> /// Check-out time is early, return a random time between 10:00am - 3:00pm /// </summary> /// <param name="date"></param> /// <param name="r"></param> /// <returns></returns> private static DateTime OutEarly(DateTime date, Random r) { return(UTCConversionsBackend.KioskTimeToUtc(date.AddMinutes(r.Next(600, 900)))); // out 10:00am - 3:00pm }
/// <summary> /// Check-out time is auto, return 15:45pm /// </summary> /// <param name="date"></param> /// <param name="r"></param> /// <returns></returns> private static DateTime OutLate(DateTime date) { return(UTCConversionsBackend.KioskTimeToUtc(date.AddMinutes(1000))); // out 15:45pm }
/// <summary> /// Check-in time is very late, return a random time between 10:00am - 2:00pm /// </summary> /// <param name="date"></param> /// <param name="r"></param> /// <returns></returns> private static DateTime InVeryLate(DateTime date, Random r) { return(UTCConversionsBackend.KioskTimeToUtc(date.AddMinutes(r.Next(600, 840)))); // in 10:00am - 2:00pm }
/// <summary> /// Check-in time is late, return a random time between 8:55am - 10:00am /// </summary> /// <param name="date"></param> /// <param name="r"></param> /// <returns></returns> private static DateTime InLate(DateTime date, Random r) { return(UTCConversionsBackend.KioskTimeToUtc(date.AddMinutes(r.Next(535, 600)))); // in 8:55am - 10:00am }
/// <summary> /// Check-in time is good, return a random time between 8:00am - 8:54am /// </summary> /// <param name="date"></param> /// <param name="r"></param> /// <returns></returns> private static DateTime InGood(DateTime date, Random r) { return(UTCConversionsBackend.KioskTimeToUtc(date.AddMinutes(r.Next(480, 535)))); // in 8:00am - 8:54am }