コード例 #1
0
        /// <summary>
        /// Le nombre D'heure que ce Staff a enseigner
        /// </summary>
        /// <param name="staffGuid"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="removeAbsencesAndRetards"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        protected internal static TimeSpan StaticGetHoursTaught(Guid staffGuid, DateTime?startDate, DateTime?endDate, bool removeAbsencesAndRetards = false)
        {
            var hoursTaught = new TimeSpan();

            if (!removeAbsencesAndRetards)
            {
                return(GetStaffCoursBetween(staffGuid, startDate, endDate)
                       .Aggregate(hoursTaught, (current1, cours) => StaticGetCoursEvents(cours.StudyGuid, startDate, endDate)
                                  .Aggregate(current1, (current, cEvent) => current + (cEvent.EndTime - cEvent.StartTime).Duration())));
            }
            foreach (var cours in GetStaffCoursBetween(staffGuid, startDate, endDate))
            {
                foreach (var cEvent in StaticGetCoursEvents(cours.StudyGuid, startDate, endDate))
                {
                    hoursTaught += (cEvent.EndTime - cEvent.StartTime);
                }
            }
            return(hoursTaught - AbsenceManager.GetTotalAbsences(staffGuid, startDate, endDate));
        }
コード例 #2
0
        /// <summary>
        /// Le nombre d'heure dont ce cours a ete enseigner
        /// </summary>
        /// <param name="staffGuid"></param>
        /// <param name="coursGuid"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="removeAbsencesAndRetards"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        protected internal static TimeSpan StaticGetHoursTaught(Guid staffGuid, Guid coursGuid, DateTime?startDate, DateTime?endDate, bool removeAbsencesAndRetards = false)
        {
            var hoursTaught = new TimeSpan();

            if (!removeAbsencesAndRetards)
            {
                foreach (var cEvent in StaticGetCoursEvents(coursGuid, startDate, endDate))
                {
                    hoursTaught += (cEvent.EndTime - cEvent.StartTime).Duration();
                }
                return(hoursTaught);
            }

            foreach (var cEvent in StaticGetCoursEvents(coursGuid, startDate, endDate))
            {
                hoursTaught += (cEvent.EndTime - cEvent.StartTime).Duration();
            }
            return(hoursTaught - AbsenceManager.GetTotalAbsences(staffGuid, coursGuid, startDate, endDate));
        }