using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.SystemView; using EMIS.ViewModel.UniversityManage.TeacherManage; using EMIS.Entities; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using EMIS.ViewModel.CacheManage; namespace EMIS.ViewModel.SelectCourse { public class OptionalCourseSettingView { /// /// 任选设定ID /// public System.Guid? OptionalCourseID { get; set; } /// /// 限选计划ID /// public Guid? ExecutableOptionalCourseID { get; set; } /// /// 选课编号 /// [DisplayName("选课编号")] public string No { get; set; } /// /// 学年学期ID /// [Required] [DisplayName("学年学期ID")] public Guid? SchoolyearID { get; set; } /// /// 学年学期 /// public string SchoolyearDesc { get; set; } /// /// 学年学期 /// [DisplayName("学年学期")] public string SchoolYearCode { get; set; } /// /// 学年(学年学期对应学年) /// [DisplayName("学年")] public int? YearID { get; set; } /// /// 学年 /// [DisplayName("学年")] public int? Years { get; set; } [DisplayName("入学学年学期")] public string GSchoolYearCode { get; set; } /// /// 校区ID /// [Display(ResourceType = typeof(EMIS.Resources.DataAnnotations.Label), Name = "CampusID")] public Nullable CampusID { get; set; } /// /// 院系所ID /// [Display(ResourceType = typeof(EMIS.Resources.DataAnnotations.Label), Name = "CollegeID")] public Nullable CollegeID { get; set; } /// /// 院系所 /// [Display(ResourceType = typeof(EMIS.Resources.DataAnnotations.Label), Name = "College")] public string CollegeName { get; set; } /// /// 开课教研室 /// [DisplayName("开课教研室")] [Required] public Guid? DepartmentID { get; set; } /// /// 开课教研室 /// [DisplayName("开课教研室")] public string DepartmentName { get; set; } /// /// 年级专业 /// [Required] [DisplayName("年级专业")] public Guid? GrademajorID { get; set; } /// /// 年级专业代码 /// [DisplayName("年级专业代码")] public string GrademajorCode { get; set; } /// /// 年级专业名称 /// [DisplayName("年级专业名称")] public string GrademajorName { get; set; } /// /// 年级(年级专业对应的年级) /// [DisplayName("年级")] public int? GradeID { get; set; } /// /// 年级(年级专业对应的年级) /// [DisplayName("年级")] public string Grade { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Grade.ToString()).Where(x => x.Value == GradeID).Select(x => x.Name).FirstOrDefault(); } } /// /// 班级信息ID /// [DisplayName("班级信息ID")] [Required] public Guid? ClassmajorID { get; set; } /// /// 选修任务班名称 /// [DisplayName("选修任务班名称")] public string DefaultClassName { get; set; } /// /// 专业课程ID /// [DisplayName("专业课程ID")] public Nullable SpecialtyCourseID { get; set; } /// /// 专业信息ID /// [DisplayName("专业信息ID")] public Nullable SpecialtyID { get; set; } /// /// 院系专业 /// [Required] public int? StandardID { get; set; } /// /// 专业代码 /// [DisplayName("专业代码")] public string StandardCode { get { var inistStandardCode = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Standard.ToString()) .Where(x => x.Value == StandardID) .Select(x => x.Code).FirstOrDefault(); return (inistStandardCode != null ? inistStandardCode.PadLeft(6, '0') : ""); } } /// /// 专业名称 /// [DisplayName("专业名称")] public string StandardDesc { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Standard.ToString()) .Where(x => x.Value == StandardID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 课程信息ID /// [Required] public Guid? CoursematerialID { get; set; } /// /// 课程代码 /// [DisplayName("课程代码")] public string CourseCode { get; set; } /// /// 课程名称 /// [DisplayName("课程名称")] public string CourseName { get; set; } /// /// 课程类型 /// [Required] [DisplayName("课程类型")] public int? CourseTypeID { get; set; } /// /// 课程类型 /// [DisplayName("课程类型")] public string CourseTypeName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseType.ToString()) .Where(x => x.Value == CourseTypeID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 课程结构 /// //[Required] [DisplayName("课程结构")] public int? CourseStructureID { get; set; } /// /// 课程结构 /// [DisplayName("课程结构")] public string CourseStructureName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseStructure.ToString()) .Where(x => x.Value == CourseStructureID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 课程属性 /// //[Required] [DisplayName("课程属性")] public int? CourseCategoryID { get; set; } /// /// 课程属性 /// [DisplayName("课程属性")] public string CourseCategoryName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseCategory.ToString()) .Where(x => x.Value == CourseCategoryID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 课程性质 /// //[Required] [DisplayName("课程性质")] public int? CourseQualityID { get; set; } /// /// 课程性质 /// [DisplayName("课程性质")] public string CourseQualityName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_CourseQuality.ToString()) .Where(x => x.Value == CourseQualityID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 授课语言 /// [DisplayName("授课语言")] public int? TeachinglanguageID { get; set; } /// /// 授课语言 /// [DisplayName("授课语言")] public string TeachinglanguageName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Teachinglanguage.ToString()) .Where(x => x.Value == TeachinglanguageID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 是否学位或主干课 /// [DisplayName("是否学位或主干课")] public bool IsMainCourse { get; set; } /// /// 是否学位或主干课 /// [DisplayName("是否学位或主干课")] public string IsMainCourseName { get { return this.IsMainCourse == true ? "是" : "否"; } } /// /// 开课学年 /// [DisplayName("开课学年")] public int? Schoolyear { get; set; } /// /// 开课学年 /// [DisplayName("开课学年")] public int? SchoolyearNumID { get; set; } /// /// 开课学年 /// [DisplayName("开课学年")] public string SchoolyearNumName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_SchoolyearNum.ToString()) .Where(x => x.Value == SchoolyearNumID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 学期 /// [DisplayName("学期")] public int? SchoolcodeID { get; set; } /// /// 学期 /// [DisplayName("学期")] public string SchoolcodeName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Semester.ToString()).Where(x => x.Value == SchoolcodeID).Select(x => x.Name).FirstOrDefault(); } } /// /// 开课学期 /// [DisplayName("开课学期")] public int? StarttermID { get; set; } /// /// 开课学期 /// [DisplayName("开课学期")] public string StarttermName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Startterm.ToString()) .Where(x => x.Value == StarttermID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 学分 /// [Required] [DisplayName("学分")] [DisplayFormat(DataFormatString = "{0:#.0}")] [RegularExpression(@"^\d+(\.\d{1,1})?$", ErrorMessage = "请输整数或保留1位小数")] public decimal? Credit { get; set; } /// /// 总学时 /// [DisplayName("总学时")] public int? Totalhours { get { if (TheoryCourse == null) TheoryCourse = 0; if (Practicehours == null) Practicehours = 0; return (TheoryCourse + Practicehours); } } /// /// 上课周次 /// [DisplayName("上课周次")] public int? SchoolweeksNum { get { if (TheoryWeeklyNum == null) TheoryWeeklyNum = 0; if (PracticeWeeklyNum == null) PracticeWeeklyNum = 0; return (TheoryCourse + Practicehours); } //get { return (this.TheoryWeeklyNum ?? 0 + this.PracticeWeeklyNum ?? 0) ; } } /// /// 理论学时 /// [DisplayName("理论学时")] public int? TheoryCourse { get; set; } /// /// 实践学时 /// [DisplayName("实践学时")] public int? Practicehours { get; set; } /// /// 实验学时 /// [DisplayName("实验学时")] public int? Trialhours { get; set; } /// /// 每周次数 /// [DisplayName("每周次数")] public int? WeeklyNum { get; set; } /// /// 周学时 /// [DisplayName("周学时")] public int? WeeklyHours { get; set; } /// /// 理论周数 /// [DisplayName("理论周数")] public int? TheoryWeeklyNum { get; set; } /// /// 实践周数 /// [DisplayName("实践周数")] public int? PracticeWeeklyNum { get; set; } /// /// 实验周数 /// [DisplayName("实验周数")] public int? TrialWeeklyNum { get; set; } /// /// 开始周次 /// [DisplayName("开始周次")] public int? StartWeeklyNum { get; set; } /// /// 结束周次 /// [DisplayName("结束周次")] public int? EndWeeklyNum { get; set; } /// /// 起止周次 /// public string StartEndWeeklyNum { get { return (this.StartWeeklyNum.HasValue && this.EndWeeklyNum.HasValue) ? (this.StartWeeklyNum.Value.ToString() + "-" + this.EndWeeklyNum.Value.ToString()) : ""; } } /// /// 实践类型 /// [DisplayName("实践类型")] public int? PracticeTypeID { get; set; } [DisplayName("实践类型")] public string PracticeTypeNameStr { get; set; } /// /// 实践类型 /// [DisplayName("实践类型")] public string PracticeTypeName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.EM_PracticeType.ToString()) .Where(x => x.Value == PracticeTypeID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 限选设定授课方式ID /// [DisplayName("限选设定授课方式ID")] public Guid? ExecutableOptionalCourseTeachingModeID { get; set; } /// /// 授课方式 /// public virtual HashSet TeachingMode { get; set; } /// /// 授课方式 /// [DisplayName("授课方式")] [Required] public List TeachingModeID { get; set; } /// /// 授课方式 /// [DisplayName("授课方式")] public List TeachingModeName { get; set; } /// /// 考试方式 /// [Required] [DisplayName("考试方式")] public int? ExaminationModeID { get; set; } /// /// 考试方式 /// public string ExaminationModeDesc { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_ExaminationMode.ToString()) .Where(x => x.Value == ExaminationModeID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 是否需要教材 /// [DisplayName("是否需要教材")] public bool IsNeedMaterial { get; set; } /// /// 是否需要教材 /// public string IsNeedMaterialDesc { get { return this.IsNeedMaterial == true ? "是" : "否"; } } /// /// 人数下限 /// [Required] [DisplayName("人数下限")] public Nullable PeopleNumlower { get; set; } /// /// 人数上限 /// [Required] [DisplayName("人数上限")] public Nullable PeopleNumlimit { get; set; } /// /// 处理方式 /// [DisplayName("处理方式")] public int? HandleModeID { get; set; } /// /// 处理方式 /// public string HandleModeDesc { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_HandleMode.ToString()) .Where(x => x.Value == HandleModeID) .Select(x => x.Name).FirstOrDefault(); } } /// /// 限选任课老师设定ID /// public Guid? ExecutableOptionalCourseTeacherID { get; set; } /// /// 授课教师 /// public virtual HashSet Teachers { get; set; } /// /// 限选设定任课老师ID /// [DisplayName("任课老师ID")] public Guid TeacherID { get; set; } /// /// 任课类型 /// [DisplayName("任课类型")] public int? TeachingMethod { get; set; } /// /// 教师名称 /// public string TeacherName { get { var teacherNames = string.Join(",", Teachers.Select(x => x.Name).ToList()); if (string.IsNullOrEmpty(teacherNames)) { return "请选择教师"; } else { return teacherNames; } } } /// /// 教师名称 /// public string TeacherNames { get; set; } /// /// 成绩类型 /// [Required] [DisplayName("成绩类型")] public int? ResultTypeID { get; set; } /// /// 是否启用 /// [Required] [DisplayName("是否启用")] public bool IsEnable { get; set; } /// /// 是否启用 /// public string IsEnableDesc { get { return this.IsEnable == true ? "是" : "否"; } } /// /// 开放状态 /// [Required] [DisplayName("开放状态")] public bool IsOpened { get; set; } /// /// 开放状态 /// public string IsOpenedDesc { get { return this.IsOpened == true ? "是" : "否"; } } /// /// RecordStatus /// public Nullable RecordStatus { get; set; } /// /// 选课结果状态代码 /// public string RecordStatusCode { get { return IdNameExt.GetDictionaryItem(DictionaryItem.EM_SelectCourseResultStatus.ToString()) .Where(x => x.Value == RecordStatus) .Select(x => x.Code).FirstOrDefault(); } } /// /// 选课结果状态 /// [DisplayName("状态")] public string RecordStatusName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.EM_SelectCourseResultStatus.ToString()) .Where(x => x.Value == RecordStatus) .Select(x => x.Name).FirstOrDefault(); } } /// /// /// public virtual IEnumerable Sys_User { get; set; } /// /// 学生ID /// [DisplayName("学生ID")] public Guid? StudentUserID { get; set; } /// /// 开放范围 /// public int? ClassCount { get; set; } /// /// 已选人数 /// [DisplayName("已选人数")] public Nullable EnterPeopleNum { get; set; } /// /// 教室ID /// [DisplayName("教室ID")] public Guid? ClassroomID { get; set; } /// /// 教室名称 /// [DisplayName("教室名称")] public string ClassroomName { get; set; } /// /// 备注 /// [DisplayName("备注")] public string Remarks { get; set; } /// /// /// public OptionalCourseSettingView() { this.TeachingMode = new HashSet(); this.Teachers = new HashSet(); } /// /// CreateTime /// public Nullable CreateTime { get; set; } /// /// CreateUserID /// public Nullable CreateUserID { get; set; } /// /// ModifyUserID /// public Nullable ModifyUserID { get; set; } /// /// ModifyTime /// public Nullable ModifyTime { get; set; } } }