diff --git a/Domain/UseCase/AdminUseCase.cs b/Domain/UseCase/AdminUseCase.cs index 1c109c5..c24f2e7 100644 --- a/Domain/UseCase/AdminUseCase.cs +++ b/Domain/UseCase/AdminUseCase.cs @@ -18,28 +18,6 @@ namespace Demo.Domain.UseCase _repositoryPresenceImpl = repositoryPresenceImpl; } - public bool ExcelExport2(int groupID){ - var users = _repositoryUserImpl.GetUsersByGroupID(groupID); - var i = 2; - using (var workbook = new XLWorkbook()){ - var worksheet = workbook.Worksheets.Add(groupID); - worksheet.Cell(1, 1).Value = "FIO"; - foreach(var user in users){ - worksheet.Cell(i, 1).Value = user.FIO; - i++; - var userPresences = GetPresenceByUser(user.Guid); - var k = 2; - foreach(var presence in userPresences){ - worksheet.Cell(1, k).Value = presence.Date.ToDateTime(new TimeOnly(0, 0)); - worksheet.Cell(i-1, k).Value = presence.IsAttedance; - k++; - } - } - workbook.SaveAs($"gruop.xlsx"); - } - return true; - } - public bool ExcelExport(int groupID){ var users = _repositoryUserImpl.GetUsersByGroupID(groupID); var groupPresences = GetPresenceByGroup(groupID); @@ -54,10 +32,10 @@ namespace Demo.Domain.UseCase worksheet.Cell(1, 1).Value = "FIO"; worksheet.Range(1, 1, 2, 1).Merge(); - var colIndex = 2; // Начинаем с 2-го столбца + var colIndex = 2; foreach (var date in dates) { worksheet.Cell(1, colIndex).Value = date.ToString("dd.MM.yy"); - worksheet.Range(1, colIndex, 1, colIndex + 8).Merge(); // Объединяем ячейки для даты (9 уроков) + worksheet.Range(1, colIndex, 1, colIndex + 8).Merge(); colIndex += 9; } @@ -68,25 +46,6 @@ namespace Demo.Domain.UseCase k++; } } - - // var uNum = 3; - // var numLes = 1; - // var respCol = 2; - // var respRow = 3; - // foreach(var user in users){ - // worksheet.Cell(uNum, 1).Value = user.FIO; - // uNum++; - // var userPresences = GetPresenceByUser(user.Guid); - // foreach(var presence in userPresences){ - // if (presence.LessonNumber == numLes){ - // worksheet.Cell(respRow, respCol).Value = presence.IsAttedance; - // respCol++; - // } - // } - // respCol++; - // // respRow++; - // numLes = 1; - // } var lessonColIndex = 2; var rowIndex = 3; @@ -100,13 +59,15 @@ namespace Demo.Domain.UseCase var presence = userPresences.FirstOrDefault(p => p.Date == date && p.LessonNumber == lesson); if (presence != null){ worksheet.Cell(rowIndex, lessonColIndex).Value = presence.IsAttedance ? "Истина" : "Ложь"; + } else{ + worksheet.Cell(rowIndex, lessonColIndex).Value = "-"; } lessonColIndex++; } } rowIndex++; - lessonColIndex = 2; // Сбрасываем начальную позицию столбца для следующего пользователя + lessonColIndex = 2; } workbook.SaveAs($"gruop_{groupID}.xlsx"); diff --git a/Domain/UseCase/IAdminUseCase.cs b/Domain/UseCase/IAdminUseCase.cs index 5b19f15..fadf483 100644 --- a/Domain/UseCase/IAdminUseCase.cs +++ b/Domain/UseCase/IAdminUseCase.cs @@ -1,6 +1,10 @@ +using Demo.Domain.Models; + namespace Demo.Domain.UseCase { public interface IAdminUseCase{ bool ExcelExport(int groupID); + List GetPresenceByUser(Guid userGuid); + List GetPresenceByGroup(int groupID); } } \ No newline at end of file diff --git a/bin/Debug/net8.0/Demo.dll b/bin/Debug/net8.0/Demo.dll index a72d2ea..87b09a0 100644 Binary files a/bin/Debug/net8.0/Demo.dll and b/bin/Debug/net8.0/Demo.dll differ diff --git a/bin/Debug/net8.0/Demo.pdb b/bin/Debug/net8.0/Demo.pdb index fbe901c..f47751e 100644 Binary files a/bin/Debug/net8.0/Demo.pdb and b/bin/Debug/net8.0/Demo.pdb differ diff --git a/gruop_4.xlsx b/gruop_4.xlsx deleted file mode 100644 index 8df2fd3..0000000 Binary files a/gruop_4.xlsx and /dev/null differ diff --git a/gruop_5.xlsx b/gruop_5.xlsx index 54b9f8b..767f728 100644 Binary files a/gruop_5.xlsx and b/gruop_5.xlsx differ diff --git a/obj/Debug/net8.0/Demo.AssemblyInfo.cs b/obj/Debug/net8.0/Demo.AssemblyInfo.cs index 8aa94e0..5efd2cf 100644 --- a/obj/Debug/net8.0/Demo.AssemblyInfo.cs +++ b/obj/Debug/net8.0/Demo.AssemblyInfo.cs @@ -13,7 +13,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+de2cdcb08b649f5a185c4222ca47e18a960de4d2")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+075b68b5891faabfe12ab29a304675e9eb84baf8")] [assembly: System.Reflection.AssemblyProductAttribute("Demo")] [assembly: System.Reflection.AssemblyTitleAttribute("Demo")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache b/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache index 9f5c7f9..ebab44c 100644 --- a/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache +++ b/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache @@ -1 +1 @@ -72151ed5b0a8b23ba8153fcb08592b07d5ecd3ca936d8def01b884ed9d06c64b +490c15506a77536dff3223c909b1321df324da3142b863642251015a86a70e06 diff --git a/obj/Debug/net8.0/Demo.dll b/obj/Debug/net8.0/Demo.dll index a72d2ea..87b09a0 100644 Binary files a/obj/Debug/net8.0/Demo.dll and b/obj/Debug/net8.0/Demo.dll differ diff --git a/obj/Debug/net8.0/Demo.pdb b/obj/Debug/net8.0/Demo.pdb index fbe901c..f47751e 100644 Binary files a/obj/Debug/net8.0/Demo.pdb and b/obj/Debug/net8.0/Demo.pdb differ diff --git a/obj/Debug/net8.0/ref/Demo.dll b/obj/Debug/net8.0/ref/Demo.dll index 89aa664..e2768c4 100644 Binary files a/obj/Debug/net8.0/ref/Demo.dll and b/obj/Debug/net8.0/ref/Demo.dll differ diff --git a/obj/Debug/net8.0/refint/Demo.dll b/obj/Debug/net8.0/refint/Demo.dll index 89aa664..e2768c4 100644 Binary files a/obj/Debug/net8.0/refint/Demo.dll and b/obj/Debug/net8.0/refint/Demo.dll differ