Exemple #1
0
        public void RemoveStation(JourneyStation station)
        {
            foreach (JourneyStation journeyStation in JourneyStations)
            {
                if (journeyStation.SortOrder > station.SortOrder)
                {
                    journeyStation.SortOrder--;
                }
            }
            if (station.JourneyStationId == 0)
            {
                journeyStations.Remove(station);
            }
            else
            {
                station.SortOrder = -1;
//				station.JourneyStationId = -1;
            }
        }
Exemple #2
0
        public void ReOrderStations(JourneyStation station, bool moveUp)
        {
            if (station.SortOrder == 1 && moveUp)
            {
                throw new EventSiteException("Dieser Routenpunkt ist bereits zuoberst!", -1);
            }
            if (station.SortOrder == JourneyStations.Count && !moveUp)
            {
                throw new EventSiteException("Dieser Routenpunkt ist bereits zuunterst!", -1);
            }

            int stationSortOrder = station.SortOrder;

            foreach (JourneyStation journeyStation in journeyStations)
            {
                if (moveUp)
                {
                    if (journeyStation.SortOrder == stationSortOrder - 1)
                    {
                        journeyStation.SortOrder++;
                    }
                    else if (journeyStation.SortOrder == stationSortOrder)
                    {
                        journeyStation.SortOrder--;
                    }
                }
                else
                {
                    if (journeyStation.SortOrder == stationSortOrder + 1)
                    {
                        journeyStation.SortOrder--;
                    }
                    else if (journeyStation.SortOrder == stationSortOrder)
                    {
                        journeyStation.SortOrder++;
                    }
                }
            }
        }
Exemple #3
0
 public void AddStation(JourneyStation station)
 {
     journeyStations.Add(station);
 }
Exemple #4
0
        public int CompareTo(object obj)
        {
            JourneyStation js = (JourneyStation)obj;

            return(this.SortOrder.CompareTo(js.SortOrder));
        }