diff --git a/presence_new/Data/Repository/IGroupRepository.cs b/presence_new/Data/Repository/IGroupRepository.cs index fc1196c..ab0d643 100644 --- a/presence_new/Data/Repository/IGroupRepository.cs +++ b/presence_new/Data/Repository/IGroupRepository.cs @@ -15,5 +15,6 @@ namespace Demo.Data.Repository bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup); GroupLocalEntity GetGroupById(int groupID); bool AddGroup(GroupLocalEntity newGroup); + } } \ No newline at end of file diff --git a/presence_new/Domain/UseCase/UseCaseGeneratePresence.cs b/presence_new/Domain/UseCase/UseCaseGeneratePresence.cs index aaded7b..574ef33 100644 --- a/presence_new/Domain/UseCase/UseCaseGeneratePresence.cs +++ b/presence_new/Domain/UseCase/UseCaseGeneratePresence.cs @@ -94,20 +94,18 @@ namespace Demo.Domain.UseCase foreach (var group in allGroups) { - // Получаем все записи посещаемости для группы var groupAttendance = _presenceRepository.GetAttendanceByGroup(group.Id); var attendanceRecords = new List(); foreach (var record in groupAttendance) { - // Подбираем имена пользователей и добавляем все записи для всех занятий - var user = _userRepository.GetUserNames().FirstOrDefault(u => u.Guid == record.UserGuid); - if (user != null) + var names = _userRepository.GetUserNames().Where(u => u.Guid == record.UserGuid); + foreach (var name in names) { attendanceRecords.Add(new Excel { - UserName = user.FIO, - UserGuid = user.Guid, + UserName = name.FIO, + UserGuid = name.Guid, Date = record.Date, IsAttedance = record.IsAttedance, LessonNumber = record.LessonNumber, @@ -129,11 +127,11 @@ namespace Demo.Domain.UseCase string reportsFolderPath = Path.Combine(projectDirectory, "Reports"); string filePath = Path.Combine(reportsFolderPath, "AttendanceReport.xlsx"); + // Создаем папку, если она не существует if (!Directory.Exists(reportsFolderPath)) { Directory.CreateDirectory(reportsFolderPath); } - using (var workbook = new XLWorkbook()) { foreach (var group in attendanceByGroup) @@ -146,15 +144,23 @@ namespace Demo.Domain.UseCase worksheet.Cell(1, 5).Value = "Статус"; int row = 2; - - foreach (var record in group.Value.OrderBy(r => r.Date).ThenBy(r => r.LessonNumber)) + int lesNum = 1; + foreach (var record in group.Value.OrderBy(r => r.Date).ThenBy(r => r.LessonNumber).ThenBy(r => r.UserGuid)) { + if (lesNum != record.LessonNumber) + { + row++; + } worksheet.Cell(row, 1).Value = record.UserName; worksheet.Cell(row, 2).Value = record.GroupName; worksheet.Cell(row, 3).Value = record.Date.ToString("dd.MM.yyyy"); worksheet.Cell(row, 4).Value = record.LessonNumber; worksheet.Cell(row, 5).Value = record.IsAttedance ? "Присутствует" : "Отсутствует"; row++; + + + + lesNum = record.LessonNumber; } worksheet.Columns().AdjustToContents(); diff --git a/presence_new/bin/Debug/net8.0/Demo.dll b/presence_new/bin/Debug/net8.0/Demo.dll index 82a360a..38af37b 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.dll and b/presence_new/bin/Debug/net8.0/Demo.dll differ diff --git a/presence_new/bin/Debug/net8.0/Demo.exe b/presence_new/bin/Debug/net8.0/Demo.exe index 1076195..114f44a 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.exe and b/presence_new/bin/Debug/net8.0/Demo.exe differ diff --git a/presence_new/bin/Debug/net8.0/Demo.pdb b/presence_new/bin/Debug/net8.0/Demo.pdb index be0f620..d2bd609 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.pdb and b/presence_new/bin/Debug/net8.0/Demo.pdb differ diff --git a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs index 4074b28..14c7959 100644 --- a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs +++ b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Demo")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+121b311f6ca5ffccb7311256bf0d59b9e67c5a90")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+55715f945aa5c1203cf2737829b38f2a99b70d80")] [assembly: System.Reflection.AssemblyProductAttribute("Demo")] [assembly: System.Reflection.AssemblyTitleAttribute("Demo")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache index 9ea5f40..1a98ebd 100644 --- a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache +++ b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache @@ -1 +1 @@ -cc574df25988491af8b762013ccd289442d6889574bcaf8a1b45bac2d2668432 +53cb790fd140c3e85d741460a98394d38c0120abb8a366167b54662ab0eda961 diff --git a/presence_new/obj/Debug/net8.0/Demo.dll b/presence_new/obj/Debug/net8.0/Demo.dll index 82a360a..38af37b 100644 Binary files a/presence_new/obj/Debug/net8.0/Demo.dll and b/presence_new/obj/Debug/net8.0/Demo.dll differ diff --git a/presence_new/obj/Debug/net8.0/Demo.pdb b/presence_new/obj/Debug/net8.0/Demo.pdb index be0f620..d2bd609 100644 Binary files a/presence_new/obj/Debug/net8.0/Demo.pdb and b/presence_new/obj/Debug/net8.0/Demo.pdb differ diff --git a/presence_new/obj/Debug/net8.0/apphost.exe b/presence_new/obj/Debug/net8.0/apphost.exe index 1076195..114f44a 100644 Binary files a/presence_new/obj/Debug/net8.0/apphost.exe and b/presence_new/obj/Debug/net8.0/apphost.exe differ diff --git a/presence_new/obj/Debug/net8.0/ref/Demo.dll b/presence_new/obj/Debug/net8.0/ref/Demo.dll index cb7ae57..468ee6c 100644 Binary files a/presence_new/obj/Debug/net8.0/ref/Demo.dll and b/presence_new/obj/Debug/net8.0/ref/Demo.dll differ diff --git a/presence_new/obj/Debug/net8.0/refint/Demo.dll b/presence_new/obj/Debug/net8.0/refint/Demo.dll index cb7ae57..468ee6c 100644 Binary files a/presence_new/obj/Debug/net8.0/refint/Demo.dll and b/presence_new/obj/Debug/net8.0/refint/Demo.dll differ