コード例 #1
0
        // 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)}>";
            }
        }
コード例 #2
0
 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;
 }
コード例 #4
0
        //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);
            }
        }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
0
ファイル: Timetables.cs プロジェクト: Reve/ORTS-MG
        // 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)}>";
            }
        }
コード例 #7
0
        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;
        }
コード例 #8
0
ファイル: TimeTable.xaml.cs プロジェクト: Kostyamba228/bubsen
 public TimeTable(Frame fr, int doc_ID)
 {
     InitializeComponent();
     frame       = fr;
     this.doc_ID = doc_ID;
     sp          = new TimeTables(doc_ID);
     DataContext = sp;
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 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);
 }
コード例 #11
0
        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;
                }
            }
        }
コード例 #12
0
        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();
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        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();
            }
        }
コード例 #15
0
 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);
             }
         }
     }
 }
コード例 #16
0
 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));
         }
     }
    
 }
コード例 #17
0
 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
             });
         }
     }
 }
コード例 #18
0
        public double Read_TimeByDate(DateTime dt)
        {
            var planTime = TimeTables.Where(t => t.Date == dt).Select(t => t.PlanningTime).FirstOrDefault();

            return(planTime);
        }
コード例 #19
0
 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);
 }
コード例 #20
0
 /// ------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// XML Writer
 /// </summary>
 public void Writer(string path)
 {
     TimeTables.WriteXml(path);
 }
コード例 #21
0
 /// ------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// XML Reader
 /// </summary>
 public void Reader(string path)
 {
     TimeTables.ReadXml(path);
 }
コード例 #22
0
 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");
     }
 }
コード例 #23
0
        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];
                    }
                }
            }
        }
コード例 #24
0
 public TimetableGroupFile(TimetableFile singleTimetableFile)
 {
     Description = singleTimetableFile.Description;
     TimeTables.Add(singleTimetableFile);
 }
コード例 #25
0
 public List <TimeTable> GetTimeForAMonth(int year, int month)
 {
     return(TimeTables.Where(t => t.Date.Year == year && t.Date.Month == month).ToList());
 }
コード例 #26
0
 public JourneyBookingService(TimeTables timeTables, Bookings bookings, FerryAvailabilityService ferryService)
 {
     _timeTables = timeTables;
     _bookings = bookings;
     _ferryService = ferryService;
 }