using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.EducationManagement; using EMIS.ViewModel.CacheManage; using Bowin.Common.Utility; using System.ComponentModel; namespace EMIS.ViewModel.EducationManage { public class EducationMissionImportClassView : EducationMissionClassView { public Guid? ClassmajorCollegeID { get; set; } /// /// 教师姓名 /// [DisplayName("教师姓名")] public string TeacherNames { get { string name = string.Empty; if (MissionClassTeacherView != null) name = string.Join("\\", MissionClassTeacherView.Select(s => s.Name)); if (string.IsNullOrEmpty(name)) { return ""; } else { return name; } } } /// /// 开始时间 /// [DisplayName("开始时间")] public string StartDate { get { return (StartHour ?? 0).ToString().PadLeft(2, '0') + ":" + (StartMinutes ?? 0).ToString().PadLeft(2, '0'); } } /// /// 开始时间 /// [DisplayName("开始时间")] public int? StartHour { get; set; } /// /// 开始时间 /// [DisplayName("开始时间")] public int? StartMinutes { get; set; } /// /// 结束时间 /// [DisplayName("结束时间")] public string EndDate { get { return (EndHour ?? 0).ToString().PadLeft(2, '0') + ":" + (EndMinutes ?? 0).ToString().PadLeft(2, '0'); } } /// /// 结束时间 /// [DisplayName("结束时间")] public int? EndHour { get; set; } /// /// 结束时间 /// [DisplayName("结束时间")] public int? EndMinutes { get; set; } /// /// 转换学时数 /// public int? Hours { get; set; } public string TheoryCourseStr { get; set; } public string PracticehoursStr { get; set; } public string TotalhoursStr { get; set; } public string ClassNumStr { get; set; } public string scheduleClassroomName { get; set; } public int? Totalhour { get; set; } public string TeacherNameString { get; set; } public int? EducationID { get; set; } /// ///培养层次 /// public string Education { get; set; } /// ///培养层次 /// public string EducationName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Education.ToString()) .Where(x => x.Value == EducationID) .Select(x => x.Name).FirstOrDefault(); } } /// ///学习形式 /// public int? LearningformID { get; set; } /// ///学习形式 /// public string LearningformName { get { return IdNameExt.GetDictionaryItem(DictionaryItem.CF_Learningform.ToString()) .Where(x => x.Value == LearningformID) .Select(x => x.Name).FirstOrDefault(); } } /// ///学习形式 /// public string Learningform { get; set; } /// ///年级专业 /// public string StandardName { get; set; } /// ///班主任 /// public string Assistant { get; set; } /// ///参考天数 /// public int? ExamDay{ get { if (Hours != null) { return (TheoryCourse + Practicehours) / Hours; } else { return 0; } } } public string TeachingTime{get;set;} /// /// 执行天数 /// public string TeachingDay { get; set; } /// /// 执行学时 /// public string TeachingHours { get; set; } /// /// 参考天数 /// public string ReferenceDays { get; set; } /// /// 考试周次 /// [DisplayName("考试周次")] public string ExamWeek { get; set; } /// /// 考试周次 /// public List ExaWeek { get; set; } /// /// 考试周次 /// [DisplayName("考试周次")] public string ExamWeekShow { get { string week = null; if(ExaWeek!=null){ foreach(var w in ExaWeek){ if(w!=null){ week += w.ToString()+"\\"; } } if(week!=null){ week = week.TrimEnd('\\'); } } return week; } } public string ExamTime { get; set; } /// /// 考试日期 /// public DateTime ExamDate { get; set; } /// /// 开始时间 /// public TimeSpan StarTime { get; set; } /// /// 结束时间 /// public TimeSpan EndTime { get; set; } public List Time { get; set; } /// ///上课时间 /// public List TDate { get; set; } /// ///课时类别 /// public string CourseTimeShow { get { if (CourseTimeDesc != null) { return CourseTimeDesc + "(" + StartDate + "-" + EndDate + ")"; } else { return null; } } } /// /// 课室 /// public string showClassRoom { get { if (scheduleClassroomName != null && scheduleClassroomName != "") { return scheduleClassroomName; } else { return ClassroomName; } } } /// /// 考试时间 /// [DisplayName("考试时间")] public string Examedate_time { get { string date=ExamDate.ToLongDateString().ToString()+" "+StarTime.ToString(@"hh\:mm")+"-"+EndTime.ToString(@"hh\:mm"); if (date == "0001年1月1日 00:00-00:00") { return null; } else { return date; } } } /// /// 上课时间 /// public DateTime? Dates { get; set; } /// ///上课时间 /// public string date { get { if (TDate != null) { List t = TDate.OrderBy(x => x.Value.Date).ToList(); string da = ""; string dates = ""; foreach (var d in t) { da += d.Value.Month + "月" + d.Value.Day + ","; } string[] m = da.TrimEnd(',').Split(','); for (int i = 0; i < m.Count(); i++) { if (i == 0) { if (i + 1 < m.Count()) { string[] lastm = m[i].TrimEnd('日').Split('月'); dates += lastm[0] + "月" + lastm[1]; string[] nextm = m[i + 1].TrimEnd('日').Split('月'); if (lastm[0] == nextm[0]) { dates += "、" + nextm[1]; } else { dates += "," + nextm[0] + "月" + nextm[1] + ","; } } else if(m[i]!=""){ string[] lastm = m[i].TrimEnd('日').Split('月'); dates += lastm[0] + "月" + lastm[1]; } } else if (i + 1 < m.Count()) { string[] lastm = m[i].TrimEnd('日').Split('月'); //dates += lastm[0] + "月" + lastm[1]; string[] nextm = m[i + 1].TrimEnd('日').Split('月'); if (lastm[0] == nextm[0]) { dates += "、" + nextm[1]; } else { dates += "," + nextm[0] + "月" + nextm[1]; } } } dates = dates.TrimEnd(','); return dates; } else { return null; } } } } }