// note : file is read preliminary only, extracting description and train information // all other information is read only when activity is started internal TimetableInfo(string filePath) { try { string extension = System.IO.Path.GetExtension(filePath); if (extension.IndexOf("list", StringComparison.OrdinalIgnoreCase) >= 0) { TimetableGroupFile groupFile = new TimetableGroupFile(filePath); TimeTables = groupFile.TimeTables; FileName = filePath; Description = groupFile.Description; } else { TimetableFile timeTableFile = new TimetableFile(filePath); TimeTables.Add(timeTableFile); FileName = filePath; Description = timeTableFile.Description; } } #pragma warning disable CA1031 // Do not catch general exception types catch #pragma warning restore CA1031 // Do not catch general exception types { Description = $"<{catalog.GetString("load error:")} {System.IO.Path.GetFileNameWithoutExtension(filePath)}>"; } }
public FrmSelectTimeTableViewModelBase() { this.TimeTables.Clear(); TimeTables.Add(new TimeTableViewModel() { TimeTableId = -1, TimeTableName = "不操作", TimeDesc = "不执行开灯与关灯操作" }); foreach (var t in Sr.TimeTableSystem.Services.WeekTimeTableInfoService.GeteekTimeTableInfoList) { bool bolfind = false; foreach (var tt in this.TimeTables) { if (tt.TimeTableId == t.TimeId) { tt.ReloadLux(); bolfind = true; break; } } if (!bolfind) { this.TimeTables.Add(new TimeTableViewModel(t)); } } }
// note : file is read preliminary only, extracting description and train information // all other information is read only when activity is started internal TimetableInfo(string filePath) { try { string extension = System.IO.Path.GetExtension(filePath).ToLowerInvariant(); if (extension.Contains("list")) { TimetableGroupFile groupFile = new TimetableGroupFile(filePath); TimeTables = groupFile.TimeTables; FileName = filePath; Description = groupFile.Description; } else { TimetableFile timeTableFile = new TimetableFile(filePath); TimeTables.Add(timeTableFile); FileName = filePath; Description = timeTableFile.Description; } } catch { Description = $"<{catalog.GetString("load error:")} {System.IO.Path.GetFileNameWithoutExtension(filePath)}>"; } }
public TimeTableSelectWindow() { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; AreaName.Clear(); if (Cr.CoreMims.Services.UserInfo.UserLoginInfo.D) { foreach (var t in Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo) { string area = t.Value.AreaName; AreaName.Add(new AreaInt() { Value = area, Key = t.Value.AreaId }); } } else { foreach (var t in Cr.CoreMims.Services.UserInfo.UserLoginInfo.AreaR) { if (Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo.ContainsKey(t)) { string area = Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.AreaInfo[t].AreaName; AreaName.Add(new AreaInt() { Value = area, Key = t }); } } } var av = false; if (AreaName.Count > 1) { av = true; } TimeTables.Clear(); foreach (var t in AreaName) { foreach (var itemTable in WeekTimeTableInfoService.GeteekTimeTableInfoList(t.Key)) { TimeTables.Add(new TimeTable() { IsChecked = false, Area = t.Key + "-" + t.Value, Id = itemTable.TimeId, Name = itemTable.TimeName, NameDesc = itemTable.TimeDesc, AreaId = t.Key, AreaView = av }); } } time.ItemsSource = TimeTables; }
public ObservableCollection <TimeTable> GetByWeek(string week, int id) { TimeTables.Clear(); foreach (TimeTable tt in getTimeTable()) { if (tt.idGroup == id && tt.Week == week) { TimeTables.Add(tt); } } return(TimeTables); }
public ObservableCollection <TimeTable> GetByWeekAdmin(string week, int course, int group, int subgroup) { TimeTables.Clear(); foreach (TimeTable tt in getTimeTable()) { gr = eFGroup.GetGroupById((int)tt.idGroup); if (gr.Course == course && tt.Week == week && gr.GroupNumber == group && gr.Subgroup == subgroup) { TimeTables.Add(tt); } } return(TimeTables); }
public void Add(TimeClasses timeClasses, DateTime begin, DateTime end) { var act = TimeClasses.SingleOrDefault(a => a.NameClasses == timeClasses.NameClasses); if (act == null) { TimeClasses.Add(timeClasses); var timeTable = new TimeTable(begin, end, timeClasses, user); TimeTables.Add(timeTable); } else { var timeTable = new TimeTable(begin, end, timeClasses, user); TimeTables.Add(timeTable); } Save(); }
private void TimeTableGroupFileRead(string fileName, StreamReader scrStream) { // read first line - first character is separator, rest is train info string readLine = scrStream.ReadLine(); while (!string.IsNullOrEmpty(readLine)) { if (readLine[0] == '#') { if (string.IsNullOrEmpty(Description)) { Description = readLine.Substring(1); } } else { TimeTables.Add(new TimetableFile(Path.Combine(Path.GetDirectoryName(fileName), readLine))); } readLine = scrStream.ReadLine(); } }
public void LoadTT() { if (eFTimeTable.CheckTimeTableByIdGroup(stud)) { for (int i = 1; i < 7; i++) { for (int j = 1; j < 5; j++) { TimeTable t1 = new TimeTable { Day = i, LessonNumber = j, idGroup = stud.idGroup, Week = "First", Auditorium = "", LessonName = "", LessonType = "" }; TimeTable t2 = new TimeTable { Day = i, LessonNumber = j, idGroup = stud.idGroup, Week = "Second", Auditorium = "", LessonName = "", LessonType = "" }; eFTimeTable.addTimeTable(t1); eFTimeTable.addTimeTable(t2); TimeTables.Add(t1); TimeTables.Add(t2); } } } }
public FrmSelectTimeTableViewModel(ObservableCollection <TimeTableInfomationItem> items, bool has3005) { this.TimeTables.Clear(); TimeTables.Add(new IdNameDesc() { Id = -1, Name = "不操作", NameDesc = "不执行开灯与关灯操作" }); foreach (var t in items) { bool bolfind = false; foreach (var tt in this.TimeTables) { if (tt.Id == t.TimeId) { bolfind = true; break; } else if (t.MainIsOverOne[0] && has3005 && Sr.EquipmentInfoHolding.Services.Others.IsOldUseTwoOpenLightSection == false) { bolfind = true; break; } } if (!bolfind) { this.TimeTables.Add(new IdNameDesc() { Id = t.TimeId, Name = t.TimeName, NameDesc = t.TimeDesc }); } } }
public void Add(TimeTable timeTable) { _timeTables.Add(timeTable); }
public TimetableGroupFile(TimetableFile singleTimetableFile) { Description = singleTimetableFile.Description; TimeTables.Add(singleTimetableFile); }
public FrmSelectTimeTableViewModel(ObservableCollection <TimeTableInfomationItem> items, List <int> lsttimetable, bool has3005) { this.TimeTables.Clear(); string idname = ""; Mris = new ObservableCollection <TimeTableInfomationItem.MainRuleItemsStyle>(); if (items.Count > 0) { for (int i = 0; i < 7; i++) { Mris.Add(new TimeTableInfomationItem.MainRuleItemsStyle() { MainWeek = items[0].MainRuleItems[i].MainWeek, MainDate = items[0].MainRuleItems[i].MainDate, MainTimeOnOne = " -", MainTimeOnTwo = " -", MainTimeOffTwo = " -", MainTimeOffOne = " -", MainSunRise = items[0].MainRuleItems[i].MainSunRise, MainSunSet = items[0].MainRuleItems[i].MainSunSet }); } } TimeTables.Add(new IdNameDesc() { Id = -1, Name = "不操作", NameDesc = "不执行开灯与关灯操作", MainRuleItems = Mris, IdName = "不操作", MainIsOverOne = new ObservableCollection <bool>() { false, false, false }, MainType = new ObservableCollection <int>() { 55, 75, 160, 30, 50, 160 } }); foreach (var t in items) { bool bolfind = false; foreach (var tt in this.TimeTables) { if (tt.Id == t.TimeId) { bolfind = true; break; } else if (t.MainIsOverOne[0] && has3005 && Sr.EquipmentInfoHolding.Services.Others.IsOldUseTwoOpenLightSection == false) { bolfind = true; break; } } if (!bolfind) { idname = t.TimeId.ToString("d4") + " " + t.TimeName; //var miot = new ObservableCollection<Visibility>() { Visibility.Collapsed, Visibility.Collapsed }; //if (t.MainIsOverOne[1]==true) //{ // miot[0] = Visibility.Visible; //} //else //{ // miot[1] = Visibility.Visible; //} this.TimeTables.Add(new IdNameDesc() { Id = t.TimeId, Name = t.TimeName, NameDesc = t.TimeDesc, MainRuleItems = t.MainRuleItems, IdName = idname, MainIsOverOne = t.MainIsOverOne, MainType = t.MainType }); } } TimeTableComboBoxSelected = new ObservableCollection <IdNameDesc>(); for (int i = 0; i < 8; i++) { TimeTableComboBoxSelected.Add(new IdNameDesc() { Id = -1, Name = "不操作", NameDesc = "不执行开灯与关灯操作", MainRuleItems = Mris }); for (int t = 0; t < TimeTables.Count; t++) { if (TimeTables[t].Id == lsttimetable[i]) { TimeTableComboBoxSelected[i] = TimeTables[t]; } } } }