71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using NPOI.SS.Formula.Functions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace _2021_backend.Models
|
|
{
|
|
public class Session
|
|
{
|
|
|
|
public Session()
|
|
{
|
|
Guid = Guid.NewGuid();
|
|
}
|
|
[Key]
|
|
[Required()]
|
|
[Display(Name = "场次GUID")]
|
|
public Guid Guid { get; set; }
|
|
[Required()]
|
|
[Display(Name = "活动日期")]
|
|
[DataType(DataType.Date)]
|
|
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
|
|
public DateTime Day { get; set; }
|
|
[Display(Name = "开始时间")]
|
|
[DataType(DataType.Time)]
|
|
[DisplayFormat(DataFormatString = "{0:t}", ApplyFormatInEditMode = true)]
|
|
[Required()]
|
|
public DateTime BeginTime { get; set; }
|
|
[RegularExpression(@"^20[04]$", ErrorMessage = "200或204")]
|
|
[Display(Name = "地点")]
|
|
[Required()]
|
|
public string Place { get; set; }
|
|
[Display(Name = "主活动官")]
|
|
public List<Guid> Chiefs { get; set; }
|
|
|
|
[Display(Name = "可容纳人数")]
|
|
public int Capacity { get; set; }
|
|
|
|
[Display(Name = "短信通知")]
|
|
public bool SendSMS { get; set; }
|
|
[Display(Name = "活动的人")]
|
|
public List<Guid> Students { get; set; }
|
|
|
|
}
|
|
public class SessionDto
|
|
{
|
|
|
|
public DateTime Day { get; set; }
|
|
public DateTime BeginTime { get; set; }
|
|
}
|
|
|
|
|
|
public class SessionDtoComparer : IEqualityComparer<SessionDto>
|
|
{
|
|
#region IEqualityComparer<user> Members
|
|
public bool Equals(SessionDto a,SessionDto b)
|
|
{
|
|
return a.Day == b.Day && a.BeginTime == b.BeginTime;
|
|
}
|
|
public int GetHashCode(SessionDto a)
|
|
{
|
|
return a.Day.GetHashCode() + a.BeginTime.GetHashCode();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|