Егор репорт в ворд

This commit is contained in:
GokaPek 2024-05-29 17:55:47 +04:00
parent 84f56090f2
commit ec9b192a82
5 changed files with 8 additions and 10 deletions

View File

@ -70,7 +70,7 @@ public class ReportLogic : IReportLogic
}); });
// Получаем список студентов, связанных с дисциплинами // Получаем список студентов, связанных с дисциплинами
var students = new List<(string Student, string PhoneNumber)>(); var students = new List<string>();
foreach (var discipline in disciplines) foreach (var discipline in disciplines)
{ {
var studentDisciplines = _disciplineStorage.GetStudentsForDiscipline(new DisciplineSearchModel var studentDisciplines = _disciplineStorage.GetStudentsForDiscipline(new DisciplineSearchModel
@ -85,7 +85,7 @@ public class ReportLogic : IReportLogic
Id = studentDiscipline.Id, Id = studentDiscipline.Id,
}); });
foreach(var st in studentList){ foreach(var st in studentList){
students.Add((st.Name, st.PhoneNumber)); students.Add(st.Name + " " + st.PhoneNumber);
} }
} }
} }

View File

@ -40,13 +40,12 @@ namespace UniversityBusinessLogic.OfficePackage
}); });
foreach (var student in discipline.Students) foreach (var student in discipline.Students)
{ {
if (!string.IsNullOrEmpty(student.Name) && !string.IsNullOrEmpty(student.PhoneNumber)) if (!string.IsNullOrEmpty(student))
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {
(student.Name + " - ", new WordTextProperties { Size = "24" }), (student, new WordTextProperties { Size = "24" })
(student.PhoneNumber + " - ", new WordTextProperties { Size = "24" })
}, },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {

View File

@ -44,10 +44,9 @@
@item.TeacherName @item.TeacherName
</td> </td>
<td> <td>
@foreach (var (Name, PhoneNumber) in item.Students) @foreach (var st in item.Students)
{ {
<div>@Name</div> <div>@st</div>
<div>@PhoneNumber</div>
} }
</td> </td>
</tr> </tr>

View File

@ -10,6 +10,6 @@ namespace UniversityContracts.ViewModels
{ {
public int TeacherId { get; set; } public int TeacherId { get; set; }
public string TeacherName { get; set; } = string.Empty; public string TeacherName { get; set; } = string.Empty;
public List<(string Name, string PhoneNumber)> Students { get; set; } = new(); public List<string> Students { get; set; } = new();
} }
} }

View File

@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR //Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR
optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-N8BRIPR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }