75 lines
2.0 KiB
C#
75 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StudentProgressRecord.Entity
|
|
{
|
|
public class Statement
|
|
{
|
|
public long Id { get; set; }
|
|
|
|
[Browsable(false)]
|
|
public long SubjectId { get; set; }
|
|
|
|
[Browsable(false)]
|
|
public long TeacherId { get; set; }
|
|
|
|
[DisplayName("Дата")]
|
|
public DateTime Date { get; set; }
|
|
|
|
[DisplayName("Название предмета")]
|
|
public string SubjectName { get; set; } = string.Empty;
|
|
|
|
[DisplayName("Преподователь")]
|
|
public string TeacherName { get; set; } = string.Empty;
|
|
|
|
public IEnumerable<Marks> Marks { get;private set; } = [];
|
|
|
|
|
|
public void SetMarks(IEnumerable<Marks> marks)
|
|
{
|
|
if (marks != null && marks.Any())
|
|
{
|
|
Marks = marks;
|
|
}
|
|
}
|
|
|
|
|
|
[DisplayName("Оценки")]
|
|
public string Mark => Marks != null ? string.Join(", ", Marks.Select(x => $"{x.StudentName} {x.Mark}")) : string.Empty;
|
|
|
|
|
|
public static Statement CreateOperation(long id, long subjectId, long teacherId,
|
|
DateTime timeStamp, IEnumerable<Marks> marks)
|
|
{
|
|
return new Statement
|
|
{
|
|
Id = id,
|
|
SubjectId = subjectId,
|
|
TeacherId = teacherId,
|
|
Date = timeStamp,
|
|
Marks = marks
|
|
};
|
|
}
|
|
|
|
public static Statement CreateOperation(TempStatement statement, IEnumerable<Marks> marks)
|
|
{
|
|
return new Statement
|
|
{
|
|
Id = statement.Id,
|
|
SubjectId = statement.SubjectId,
|
|
TeacherId = statement.TeacherId,
|
|
SubjectName = statement.SubjectName,
|
|
TeacherName = statement.TeacherName,
|
|
Date = statement.Date,
|
|
Marks = marks
|
|
};
|
|
}
|
|
|
|
}
|
|
}
|