Ejemplo n.º 1
0
 private void CheckAllTransitStatesInEU()
 {
     if (TransitStates.All(ts => ts.Country.IsEuropeanUnionMember))
     {
         RaiseEvent(new AllTransitStatesInEUEvent(this));
     }
 }
Ejemplo n.º 2
0
        public void Add(TransitState transitState)
        {
            ReorderTransitStates();

            transitState.OrdinalPosition = TransitStates.Count > 0 ?
                                           TransitStates.Select(ts => ts.OrdinalPosition).Max() + 1
                : 1;

            TransitStates.Add(transitState);
        }
Ejemplo n.º 3
0
        public void Delete(Guid id)
        {
            if (TransitStates == null || TransitStates.Count <= 0)
            {
                return;
            }

            TransitStates.RemoveAll(ts => ts.Id == id);

            ReorderTransitStates();
        }
Ejemplo n.º 4
0
        private void ReorderTransitStates()
        {
            // Where the list contains 1, 2, 3 and 2 is removed, the positions should reorder to 1, 2.
            var orderedStates = TransitStates.OrderBy(ts => ts.OrdinalPosition).ToList();

            for (int i = 0; i < orderedStates.Count; i++)
            {
                orderedStates[i].OrdinalPosition = i + 1;
            }

            TransitStates = orderedStates;
        }