using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.DataAnnotations; using System.ComponentModel; namespace EMIS.ViewModel.CalendarManage { public class CoursesTimeView { /// /// 主键ID /// [DisplayName("主键ID")] public Guid? CoursesTimeID { get; set; } /// /// 节次 /// [Required] [DisplayName("开始节次")] public int? StartTimes { get; set; } [Required] [DisplayName("结束节次")] public int? EndTimes { get; set; } public string Times { get { return StartTimes.Value.ToString() + "-" + EndTimes.Value.ToString(); } } /// /// 时间段 /// [Required] [DisplayName("时间段")] public int? TimesSegment { get; set; } /// /// 时间段 /// [DisplayName("时间段")] public string TimesSegmentName { get; set; } /// /// 开始时间 /// [DisplayName("开始时间")] public string StartDate { get { return (StartHour ?? 0).ToString().PadLeft(2, '0') + ":" + (StartMinutes ?? 0).ToString().PadLeft(2, '0'); } } /// /// 开始时间 /// [Required] [DisplayName("开始时间")] [Range(0, 23, ErrorMessage = "小时数必须是0到23之间")] public int? StartHour { get; set; } /// /// 开始时间 /// [Required] [DisplayName("开始时间")] [Range(0, 59, ErrorMessage = "分钟数必须是0到59之间")] public int? StartMinutes { get; set; } /// /// 结束时间 /// [DisplayName("结束时间")] public string EndDate { get { return (EndHour ?? 0).ToString().PadLeft(2, '0') + ":" + (EndMinutes ?? 0).ToString().PadLeft(2, '0'); } } /// /// 结束时间 /// [Required] [DisplayName("结束时间")] [Range(0, 23, ErrorMessage = "小时数必须是0到23之间")] public int? EndHour { get; set; } /// /// 结束时间 /// [Required] [DisplayName("结束时间")] [Range(0, 59, ErrorMessage = "分钟数必须是0到59之间")] public int? EndMinutes { get; set; } /// /// 学时数 /// [DisplayName("学时数")] public int? Workhours { get { return this.EndTimes.Value - this.StartTimes.Value + 1; } } /// /// 上课时间 /// [DisplayName("上课时间")] public string time_starTime_endTime { get { return TimesSegmentName + "(" + StartDate + "-" + EndDate + ")"; } } /// /// 创建人 /// [DisplayName("创建人")] public Guid? CreateUserID { get; set; } /// /// 创建时间 /// [DisplayName("创建时间")] public DateTime? CreateTime { get; set; } /// /// 更新人 /// [DisplayName("更新人")] public Guid? ModifyUserID { get; set; } /// /// 更新时间 /// [DisplayName("更新时间")] public DateTime? ModifyTime { get; set; } } }