JPHD-2021-backend/Models/Student.cs

146 lines
3.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace _2021_backend.Models
{
public enum status
{
,
,
,
,
,
,
,
}
public enum yard
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
}
public enum sex
{
Boy = 1,
Girl = 0,
Unknown = 2
}
public enum grade
{
= 0,
= 1,
= 2,
= 3,
= 4,
}
public enum experience
{
= 0,
= 1,
= 2,
= 3,
= 4
}
public class Student
{
public void Update(Submission sub)
{
Name = sub.Name;
Email = sub.Email;
Tel = sub.Tel;
Stuid = sub.Stuid;
Sex = sub.Sex;
Grade = sub.Grade;
Major = sub.Major;
Yard = sub.Yard;
Exp = sub.Exp;
Timelist = sub.Timelist;
Submissions.Add(sub.Guid);
}
public Student()
{
Guid = Guid.NewGuid();
Comments = new List<Guid>();
Messages = new List<Guid>();
Submissions = new List<Guid>();
Timelist = new List<Guid>();
}
public static Student create(Submission sub)
{
Student student = new Student();
student.Guid = Guid.NewGuid();
student.Name = sub.Name;
student.Email = sub.Email;
student.Tel = sub.Tel;
student.Stuid = sub.Stuid;
student.Sex = sub.Sex;
student.Grade = sub.Grade;
student.Major = sub.Major;
student.Yard = sub.Yard;
student.Exp = sub.Exp;
student.Timelist = sub.Timelist;
student.Submissions.Add(sub.Guid);
student.RegisterTime = sub.SubmitTime;
return student;
}
[Key]
[Display(Name = "ID")]
public Guid Guid { get; set; }
[Display(Name = "姓名")]
public string Name { get; set; }
[Display(Name = "学号")]
public string Stuid { get; set; }
[Display(Name = "性别")]
public sex Sex { get; set; }
[Display(Name = "年级")]
public grade Grade { get; set; }
[Display(Name = "学园")]
public yard Yard { get; set; }
[Display(Name = "专业")]
public string Major { get; set; }
[Display(Name = "电子邮件")]
public string Email { get; set; }
[Display(Name = "电话")]
public string Tel { get; set; }
[Display(Name = "经验程度")]
public experience Exp { get; set; }
[Display(Name = "最终场次")]
public Guid InterviewTime { get; set; }
[Display(Name = "提交记录")]
public List<Guid> Submissions { get; set; }
[Display(Name = "短信记录")]
public List<Guid> Messages { get; set; }
[Display(Name = "可选场次")]
public List<Guid> Timelist { get; set; }
[Display(Name = "评论")]
public List<Guid> Comments { get; set; }
[Display(Name = "打分")]
public int Score { get; set; }
[Display(Name = "状态")]
public status Status { get; set; }
[Display(Name = "最近一次提交时间")]
[DataType(DataType.DateTime)]
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
public DateTime LastSubmission { get; set; }
[Display(Name = "报名时间")]
[DataType(DataType.DateTime)]
public DateTime RegisterTime { get; set; }
}
}