Esempio n. 1
0
        public void DeleteLineStationsBy(Predicate <BO.LineStation> predicate)
        {
            var allLS = from ls in GetAllLineStationsNoCondition()
                        where predicate(ls)
                        select ls;

            foreach (var toDelete in allLS.ToArray())
            {
                dl.DeleteLineStationByStation(toDelete.Station.Code);

                var doLine = dl.GetLine(toDelete.LineId);
                for (int i = toDelete.IndexInLine + 1; i < doLine.RouteLength; i++)
                {
                    var doLs = dl.GetLineStationByIndex(toDelete.LineId, i);
                    doLs.IndexInLine -= 1;
                    dl.UpdateLineStationByIndex(doLs);
                }
                doLine.RouteLength -= 1;
                dl.UpdateLine(doLine);
            }
        }