public void TestInitialize() { var people = new List<PersonIdentifier>(AttendanceCount); for (int i = 0; i < AttendanceCount; i++) people.Add(new PersonIdentifier(TestObjectCreator.CreateAlphabetString(i, i * 3))); Reference = new BusinessDay(BusinessDayIdentifier, people); }
public static string CreateHeader(BusinessDay[] days, string delimiter) { var builder = new StringBuilder(25 + days.Length * 25); // Coz excel is smelly builder.AppendLine($"sep={delimiter}"); builder.Append("Identificador"); builder.Append(delimiter); builder.Append("Nome"); builder.Append(delimiter); foreach (var d in days) { builder.Append(d.Identifier.Date.ToString(Default.DateFormat)); builder.Append(delimiter); } return builder.ToString(); }
public static string ProcessPerson(Person p, BusinessDay[] days, string delimiter) { TemporaryDismissCollection temporaryDismisses; if (!RepositoryManager.TryGet(p.Identifier, out temporaryDismisses)) temporaryDismisses = new TemporaryDismissCollection(p.Identifier, Array.Empty<TemporaryDismiss>()); DayOfWeekDismissCollection dayOfWeekDismisses; if (!RepositoryManager.TryGet(p.Identifier, out dayOfWeekDismisses)) dayOfWeekDismisses = new DayOfWeekDismissCollection(p.Identifier, Array.Empty<DayOfWeekDismiss>()); var builder = new StringBuilder(days.Length * 3); builder.Append(p.Identifier); builder.Append(delimiter); builder.Append(p.Name); builder.Append(delimiter); foreach (var day in days) { if (dayOfWeekDismisses.Any(dismiss => dismiss.GetDismissStatus(day.Identifier.Date).Dismissed) || temporaryDismisses.Any(dismiss => dismiss.GetDismissStatus(day.Identifier.Date).Dismissed)) { builder.Append(DismissedLetter); builder.Append(delimiter); continue; } else if (day.Contains(p.Identifier)) { builder.Append(AttendedLetter); builder.Append(delimiter); continue; } else { builder.Append(UnattendedLetter); builder.Append(delimiter); } } return builder.ToString(); }
public static bool TryGet(BusinessDayIdentifier id, out BusinessDay entity) => BusinessDayRepository.TryGet(id, out entity);
public static void Save(BusinessDay entity) => BusinessDayRepository.Save(entity);