コード例 #1
0
        public static MergedBusinessDay Create(IEnumerable<IBusinessDay> businessDays)
        {
            if (businessDays == null)
                throw new ArgumentNullException(nameof(businessDays));

            var dayArray = businessDays.ToArray();
            if (dayArray.Length == 0)
                throw new ArgumentException(nameof(businessDays) + " is empty.");
            var firstBusinessDayDate = dayArray[0].Identifier.Date;
            if (dayArray.Any(day => !day.Identifier.Date.Equals(firstBusinessDayDate)))
                throw new ArgumentException(nameof(businessDays) + " contains objects with different dates.");

            var allAttendances = businessDays.SelectMany(x => x.Attendances);
            var groupedAttendances = allAttendances.GroupBy(x => x.Attendee).OrderBy(x => x.Key.Identifier).ToArray();
            var documents = groupedAttendances.Select(x => x.Key.Identifier.Document).ToArray();
            var attendedTimes = groupedAttendances.Select(group => group.SelectMany(attendance => attendance.AttendedTimes).ToArray()).ToArray();

            var sameDateBusinessDay = new MergedBusinessDay(firstBusinessDayDate, documents, attendedTimes);
            return sameDateBusinessDay;
        }
コード例 #2
0
ファイル: Report.cs プロジェクト: Mirandatz/Bentham
 public Report(DateTime[] sortedDays, MergedBusinessDay[] sortedBusinessDays)
 {
     SortedDays = sortedDays;
     SortedBusinessDays = sortedBusinessDays;
 }