65 lines
1.9 KiB
C#
Raw Normal View History

2024-10-28 19:18:57 +04:00
using System;
using System.Collections.Generic;
2024-12-02 20:25:45 +04:00
using System.ComponentModel;
2024-10-28 19:18:57 +04:00
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; }
2024-10-28 19:18:57 +04:00
2024-12-02 20:25:45 +04:00
[Browsable(false)]
2024-10-28 19:18:57 +04:00
public long SubjectId { get; set; }
2024-12-02 20:25:45 +04:00
[Browsable(false)]
2024-10-28 19:18:57 +04:00
public long TeacherId { get; set; }
2024-12-02 20:25:45 +04:00
[DisplayName("Дата")]
2024-10-28 21:38:22 +04:00
public DateTime Date { get; set; }
2024-10-28 19:18:57 +04:00
2024-12-02 20:25:45 +04:00
[DisplayName("Название предмета")]
public string SubjectName { get; set; } = string.Empty;
[DisplayName("Преподователь")]
public string TeacherName { get; set; } = string.Empty;
[Browsable(false)]
2024-11-18 14:55:50 +04:00
public IEnumerable<Marks> Marks { get; set; } = [];
2024-10-28 19:18:57 +04:00
2024-12-02 20:25:45 +04:00
[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)
2024-10-28 19:18:57 +04:00
{
return new Statement
{
Id = id,
SubjectId = subjectId,
2024-10-28 19:18:57 +04:00
TeacherId = teacherId,
2024-10-28 21:38:22 +04:00
Date = timeStamp,
Marks = marks
};
2024-10-28 19:18:57 +04:00
}
2024-11-25 18:18:53 +04:00
public static Statement CreateOperation(TempStatement statement, IEnumerable<Marks> marks)
{
return new Statement
{
Id = statement.Id,
SubjectId = statement.SubjectId,
TeacherId = statement.TeacherId,
2024-12-02 20:25:45 +04:00
SubjectName = statement.SubjectName,
TeacherName = statement.TeacherName,
2024-11-25 18:18:53 +04:00
Date = statement.Date,
Marks = marks
};
}
2024-10-28 19:18:57 +04:00
}
}