using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using EMIS.Entities;
using EMIS.ViewModel.CacheManage;
namespace EMIS.ViewModel.ExaminationManage
{
public class ExaminationPlanView
{
///
/// ExaminationPlanID
///
public System.Guid ExaminationPlanID { get; set; }
[Required]
[DisplayName("学年学期")]
public Nullable SchoolyearID { get; set; }
public string SchoolyearCode { get; set; }
[Display(ResourceType = typeof(EMIS.Resources.DataAnnotations.Label), Name = "Campus")]
public Nullable CampusID { get; set; }
public string CampusName { get; set; }
[Required]
[Display(ResourceType = typeof(EMIS.Resources.DataAnnotations.Label), Name = "College")]
public Nullable CollegeID { get; set; }
public string CollegeName { get; set; }
[Required]
[DisplayName("考试科目")]
public Nullable CoursematerialID { get; set; }
public string CoursematerialName { get; set; }
[Required]
[DisplayName("考试方式")]
public Nullable ExaminationModeID { get; set; }
public string ExaminationModeName
{
get
{
return IdNameExt.GetDictionaryItem(DictionaryItem.CF_ExaminationMode.ToString())
.Where(x => x.Value == ExaminationModeID)
.Select(x => x.Name).FirstOrDefault();
}
}
[Required]
[DisplayName("考试形式")]
public Nullable ExaminationStyleID { get; set; }
public string ExaminationStyleName
{
get
{
return IdNameExt.GetDictionaryItem(DictionaryItem.EX_ExaminationStyle.ToString())
.Where(x => x.Value == ExaminationStyleID)
.Select(x => x.Name).FirstOrDefault();
}
}
[Required]
[DisplayName("考试性质")]
public Nullable ExamsCategoryID { get; set; }
public string ExamsCategoryName
{
get
{
return IdNameExt.GetDictionaryItem(DictionaryItem.CF_ExamsCategory.ToString())
.Where(x => x.Value == ExamsCategoryID)
.Select(x => x.Name).FirstOrDefault();
}
}
public Nullable EducationMissionID { get; set; }
public Guid? ClassmajorID { get; set; }
[Required]
[DisplayName("班级名称")]
public string ClassName { get; set; }
[Required]
[DisplayName("考试日期")]
public Nullable ExaminationDate { get; set; }
[Required]
[DisplayName("开始时间")]
public Nullable StartTime { get; set; }
public string StartTimeStr
{
get
{
if (StartTime.HasValue)
{
if (StartTime.Value.Minutes == 0)
{
return StartTime.Value.Hours + ":00" ;
}
else
{
return StartTime.Value.Hours + ":" + StartTime.Value.Minutes;
}
}
else
{
return null;
}
}
}
[Required]
[DisplayName("结束时间")]
public Nullable EndTime { get; set; }
public string EndTimeStr
{
get
{
if (EndTime.HasValue)
{
if (EndTime.Value.Minutes == 0)
{
return EndTime.Value.Hours + ":00";
}
else
{
return EndTime.Value.Hours + ":" + EndTime.Value.Minutes;
}
}
else
{
return null;
}
}
}
public string ExaminationTime
{
get
{
return (StartTime.HasValue && EndTime.HasValue) ? StartTime.Value.ToString("hh\\:mm") + "-" + EndTime.Value.ToString("hh\\:mm") : "";
}
}
public int? ClassroomNum
{
get
{
return CF_Classroom.Count();
}
}
public IEnumerable CF_Classroom { get; set; }
public string ClassroomNames
{
get
{
return string.Join(",", CF_Classroom.Select(x => x.Name).ToList());
}
}
public IEnumerable Students { get; set; }
[DisplayName("学生人数")]
public int? MissionStudentCount { get; set; }
[DisplayName("排考人数")]
public int? StudentCount { get; set; }
///
/// 课程结束周次
///
public int? CourseEndWeekNum { get; set; }
///
/// 最大排考周次,主要用于排序,不能直接从WeekNum算出……
///
public int? MaxWeekNum { get; set; }
public HashSet WeekNum { get; set; }
public string WeekNumString
{
get
{
if (WeekNum != null)
{
return string.Join(@"\", WeekNum.Where(x => x.WeeklyNum.HasValue).Select(x => x.WeeklyNum.ToString()));
}
return "";
}
}
///
/// RecordStatus
///
public Nullable RecordStatus { get; set; }
public string RecordStatusDesc
{
get
{
return IdNameExt.GetDictionaryItem(DictionaryItem.EX_ExaminationPlanStatus.ToString())
.Where(x => x.Value == RecordStatus)
.Select(x => x.Name).FirstOrDefault();
}
}
public IEnumerable staffUser { get; set; }
public string staffNames {
get
{
if (staffUser != null)
{
return string.Join("/", staffUser.Select(x => x.Name));
}
return "";
}
}
public IEnumerable ExaminationRoomLayoutView { get; set; }
///
/// 教师姓名
///
[DisplayName("教师姓名")]
public string TeacherName
{
get
{
string name = string.Empty;
if (ExaminationRoomLayoutView != null)
name = string.Join(",", ExaminationRoomLayoutView.Select(s => s.TeacherNames));
if (string.IsNullOrEmpty(name))
{
return "";
}
else
{
return name;
}
}
}
///
/// CreateTime
///
public Nullable CreateTime { get; set; }
///
/// CreateUserID
///
public Nullable CreateUserID { get; set; }
///
/// ModifyUserID
///
public Nullable ModifyUserID { get; set; }
///
/// ModifyTime
///
public Nullable ModifyTime { get; set; }
}
}