// 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)); } } }
public FerryAvailabilityService(Ports ports, Ferries ferries, TimeTables timeTables, PortManager portManager) { _ports = ports; _ferries = ferries; _timeTables = timeTables; _portManager = portManager; }
//private ICommand _cmdDeleteTimeTable; //public ICommand CmdDeleteTimeTable //{ // get // { // if (_cmdDeleteTimeTable == null) _cmdDeleteTimeTable = new RelayCommand(ExCmdDeleteTimeTable); // return _cmdDeleteTimeTable; // } //} private void ExCmdDeleteTimeTable() { if (this.TimeTables.Contains(CurrentSelectItem)) { TimeTables.Remove(CurrentSelectItem); } }
private void DeleteTimeTable(object obj) { if (MessageBox.Show("Are you Sure You want to Delete this Record?", "Pinna Fitness", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes) { try { SelectedTimeTable.Enabled = false; var stat = _timeTableService.Disable(SelectedTimeTable); if (stat == string.Empty) { TimeTables.Remove(SelectedTimeTable); } else { MessageBox.Show("Can't Delete, may be the data is already in use..." + Environment.NewLine + stat, "Can't Delete", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MessageBox.Show("Can't Delete, may be the data is already in use..." + Environment.NewLine + ex.Message + Environment.NewLine + ex.InnerException, "Can't Delete", MessageBoxButton.OK, MessageBoxImage.Error); } } }
// 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 TimeTable(Frame fr, int doc_ID) { InitializeComponent(); frame = fr; this.doc_ID = doc_ID; sp = new TimeTables(doc_ID); DataContext = sp; }
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 new void GetTimeTables(IGetTimeTablesHandler handler) { var timeTables = handler.GetUrlData($"{BaseUri}/{Abbreviation}/{GroupListUri}", Node, Attribute); foreach (var timeTable in timeTables) { var key = ExtractingPdfFromAttributeValue(timeTable.Key); foreach (var timeTableStoreEntry in TimeTables.Where(timeTableStoreEntry => key.Contains(timeTableStoreEntry.GroupUri))) { timeTableStoreEntry.TimeTables.Add(key, timeTable.Value); break; } } }
public void Update(DateTime dt, double tm) { var timeTable = TimeTables.Where(t => t.Date == dt).FirstOrDefault(); if (timeTable == null) { timeTable = new TimeTable(); timeTable.Date = dt; //throw new ArgumentNullException("timeTable"); } timeTable.PlanningTime = tm; ChangeTracker.DetectChanges(); TimeTables.AddOrUpdate(timeTable); SaveChanges(); }
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); } } } }
private void OnTimeTableUpdateEvent() //52503事件 { for (int i = 0; i < TimeTables.Count - 1; i++) { if ( Sr .TimeTableSystem .Services .WeekTimeTableInfoService .WeekTimeTableInfoDictionary.ContainsKey( TimeTables[i].TimeTableId)) { if ( !TimeTables[i].Compar( WeekTimeTableInfoService.WeekTimeTableInfoDictionary[TimeTables[i].TimeTableId])) { TimeTables[i].Update( WeekTimeTableInfoService.WeekTimeTableInfoDictionary[TimeTables[i].TimeTableId]); } } else { TimeTables.RemoveAt(i); } } foreach (var t in WeekTimeTableInfoService.WeekTimeTableInfoDictionary) { bool bolfind = false; foreach (var tt in this.TimeTables) { if (t.Value.time_id == tt.TimeTableId) { bolfind = true; break; } } if (!bolfind) { this.TimeTables.Add(new TimeTableViewModel(t.Value)); } } }
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 double Read_TimeByDate(DateTime dt) { var planTime = TimeTables.Where(t => t.Date == dt).Select(t => t.PlanningTime).FirstOrDefault(); return(planTime); }
private static void WireUp() { var timeTables = new TimeTables(); var ferries = new Ferries(); var bookings = new Bookings(); _ports = new Ports(); _ferryService = new FerryAvailabilityService(_ports, ferries, timeTables, new PortManager(_ports, ferries)); _bookingService = new JourneyBookingService(timeTables, bookings, _ferryService); _timeTableService = new TimeTableService(timeTables, bookings, _ferryService); }
/// ------------------------------------------------------------------------------------------------------------------------ /// <summary> /// XML Writer /// </summary> public void Writer(string path) { TimeTables.WriteXml(path); }
/// ------------------------------------------------------------------------------------------------------------------------ /// <summary> /// XML Reader /// </summary> public void Reader(string path) { TimeTables.ReadXml(path); }
private static void AddNewRowToTimetable(TeachersBookEntities2 ctx, int rowCounter, TimeTables timetabelDb, TtSubjectsRow timetablerow) { try { TimeTableRows newRowDb = new TimeTableRows(); newRowDb.id = Guid.NewGuid(); newRowDb.rowNo = rowCounter; newRowDb.timetable = timetabelDb.id; var startEnd = timetablerow.subjects[0].description.Split('-'); newRowDb.start = startEnd[0].Trim(); newRowDb.end = startEnd.Length > 1 ? startEnd[1].Trim() : ""; ctx.TimeTableRows.Add(newRowDb); } catch (Exception ex) { Console.WriteLine("Error"); } }
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]; } } } }
public TimetableGroupFile(TimetableFile singleTimetableFile) { Description = singleTimetableFile.Description; TimeTables.Add(singleTimetableFile); }
public List <TimeTable> GetTimeForAMonth(int year, int month) { return(TimeTables.Where(t => t.Date.Year == year && t.Date.Month == month).ToList()); }
public JourneyBookingService(TimeTables timeTables, Bookings bookings, FerryAvailabilityService ferryService) { _timeTables = timeTables; _bookings = bookings; _ferryService = ferryService; }