Bananadminka(2)
This commit is contained in:
parent
075b68b589
commit
ec800e2f5a
@ -18,28 +18,6 @@ namespace Demo.Domain.UseCase
|
|||||||
_repositoryPresenceImpl = repositoryPresenceImpl;
|
_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){
|
public bool ExcelExport(int groupID){
|
||||||
var users = _repositoryUserImpl.GetUsersByGroupID(groupID);
|
var users = _repositoryUserImpl.GetUsersByGroupID(groupID);
|
||||||
var groupPresences = GetPresenceByGroup(groupID);
|
var groupPresences = GetPresenceByGroup(groupID);
|
||||||
@ -54,10 +32,10 @@ namespace Demo.Domain.UseCase
|
|||||||
worksheet.Cell(1, 1).Value = "FIO";
|
worksheet.Cell(1, 1).Value = "FIO";
|
||||||
worksheet.Range(1, 1, 2, 1).Merge();
|
worksheet.Range(1, 1, 2, 1).Merge();
|
||||||
|
|
||||||
var colIndex = 2; // Начинаем с 2-го столбца
|
var colIndex = 2;
|
||||||
foreach (var date in dates) {
|
foreach (var date in dates) {
|
||||||
worksheet.Cell(1, colIndex).Value = date.ToString("dd.MM.yy");
|
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;
|
colIndex += 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,25 +46,6 @@ namespace Demo.Domain.UseCase
|
|||||||
k++;
|
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 lessonColIndex = 2;
|
||||||
var rowIndex = 3;
|
var rowIndex = 3;
|
||||||
@ -100,13 +59,15 @@ namespace Demo.Domain.UseCase
|
|||||||
var presence = userPresences.FirstOrDefault(p => p.Date == date && p.LessonNumber == lesson);
|
var presence = userPresences.FirstOrDefault(p => p.Date == date && p.LessonNumber == lesson);
|
||||||
if (presence != null){
|
if (presence != null){
|
||||||
worksheet.Cell(rowIndex, lessonColIndex).Value = presence.IsAttedance ? "Истина" : "Ложь";
|
worksheet.Cell(rowIndex, lessonColIndex).Value = presence.IsAttedance ? "Истина" : "Ложь";
|
||||||
|
} else{
|
||||||
|
worksheet.Cell(rowIndex, lessonColIndex).Value = "-";
|
||||||
}
|
}
|
||||||
lessonColIndex++;
|
lessonColIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
lessonColIndex = 2; // Сбрасываем начальную позицию столбца для следующего пользователя
|
lessonColIndex = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
workbook.SaveAs($"gruop_{groupID}.xlsx");
|
workbook.SaveAs($"gruop_{groupID}.xlsx");
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
|
||||||
namespace Demo.Domain.UseCase
|
namespace Demo.Domain.UseCase
|
||||||
{
|
{
|
||||||
public interface IAdminUseCase{
|
public interface IAdminUseCase{
|
||||||
bool ExcelExport(int groupID);
|
bool ExcelExport(int groupID);
|
||||||
|
List<Presence> GetPresenceByUser(Guid userGuid);
|
||||||
|
List<Presence> GetPresenceByGroup(int groupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
BIN
gruop_4.xlsx
BIN
gruop_4.xlsx
Binary file not shown.
BIN
gruop_5.xlsx
BIN
gruop_5.xlsx
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Demo")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Demo")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("Demo")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Demo")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Demo")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
72151ed5b0a8b23ba8153fcb08592b07d5ecd3ca936d8def01b884ed9d06c64b
|
490c15506a77536dff3223c909b1321df324da3142b863642251015a86a70e06
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user