public static void RecordHandler(IDataRecord record, TrackLayout layout)
 {
     var number = record.GetString(record.GetOrdinal("Number"));
     var fromStationSignature = record.GetString(record.GetOrdinal("FromStation"));
     var toStationSignature = record.GetString(record.GetOrdinal("ToStation"));
     if (!layout.HasTimetableStretch(number)) layout.Add(new TimetableStretch(number));
     var currentTimetableStretch = layout.TimetableStretch(number);
     var trackStretch = layout.TrackStretch(fromStationSignature, toStationSignature);
     currentTimetableStretch.Add(trackStretch);
 }
Пример #2
0
 public static void RecordHandler(IDataRecord record, TrackLayout layout)
 {
     var result = new Station(record.GetString(record.GetOrdinal("FullName")), record.GetString(record.GetOrdinal("Signature")));
     layout.Add(result);
 }
        private static void GetStretches(TrackLayout layout, Excel.Workbook book) {
            Excel.Worksheet sheet = book.Worksheets["Routes"];
            var r = 2;
            while (true) {
                var row = (Array)sheet.get_Range(Cell("A", r), Cell("I", r)).Cells.Value;
                if (row.GetValue(1, 1) == null) {
                    break;
                }
                else {
                    var timetableStretchNumber = row.Value(1);
                    var tracksCount = int.Parse(row.Value(8), CultureInfo.InvariantCulture);
                    var fromName = row.Value(3);
                    var toName = row.Value(5);
                    var distance = double.Parse(row.Value(9), CultureInfo.InvariantCulture);

                    var fromStation = layout.Station(fromName);
                    var fromExit = new StationExit(toName);
                    fromStation.Add(fromExit);
                    var toStation = layout.Station(toName);
                    var toExit = new StationExit(fromName);
                    toStation.Add(toExit);
                    var addedStretch = layout.Add(fromExit, toExit, distance, tracksCount);
                    if (! layout.HasTimetableStretch(timetableStretchNumber)) {
                        layout.Add(new TimetableStretch(timetableStretchNumber));
                    }
                    layout.TimetableStretch(timetableStretchNumber).Add(addedStretch);
                }
                r++;
            }
        }
 private static void GetStations(TrackLayout layout, Excel.Workbook book) {
     Excel.Worksheet sheet = book.Worksheets["StationTrack"];
     var r = 2;
     Station current = null;
     var loop = true;
     while (loop) {
         var row = (Array)sheet.get_Range(Cell("A", r), Cell("G", r)).Cells.Value;
         if (row.GetValue(1, 1) == null) {
             break;
         }
         else {
             var rowType = row.Value(6);
             switch (rowType) {
                 case "Station":
                     if (current != null) layout.Add(current);
                     current = new Station( row.Value(5), row.Value(1));
                    break;
                 case "Track":
                     current.Add(new StationTrack(row.Value(3)));
                     break;
                 default:
                     loop = false;
                     break;
             }
             r++;
         }
     }
     if (current != null) layout.Add(current);
 }
Пример #5
0
 public static void RecordHandler(IDataRecord record, TrackLayout layout)
 {
     var fromExit = CreateStationExit(layout, record.GetString(record.GetOrdinal("FromStation")));
     var toExit = CreateStationExit(layout, record.GetString(record.GetOrdinal("ToStation")));
     layout.Add(fromExit, toExit, record.GetDouble(record.GetOrdinal("Distance")), record.GetInt32(record.GetOrdinal("TracksCount")));
 }