Exemplo n.º 1
0
        /// <summary>Generates and returns a new list with all of this list's items added to it.</summary>
        public ListOfIDObjects <TYPE> GetDeepCopy()
        {
            ListOfIDObjects <TYPE> result = new ListOfIDObjects <TYPE>();

            foreach (TYPE item in this)
            {
                result.Add(item);
            }
            return(result);
        }
Exemplo n.º 2
0
        public static HalfRoute Parse(XmlNode node, ListOfIDObjects <Stop> stops)
        {
            HalfRoute   result         = new HalfRoute(node.Attributes["name"].Value);
            XmlNodeList routeStopNodes = node.SelectNodes("RouteStop");

            foreach (XmlNode routeStopNode in routeStopNodes)
            {
                result.Add(RouteStop.Parse(routeStopNode, stops));
            }
            return(result);
        }
Exemplo n.º 3
0
        public static RouteStop Parse(XmlNode node, ListOfIDObjects <Stop> stops)
        {
            Stop stop = stops.GetItemByID(node.Attributes["stopID"].Value);
            List <WeekDayCategory> weekDayCategories    = new List <WeekDayCategory>();
            XmlNodeList            weekDayCategoryNodes = node.SelectNodes("WeekDayCategory");

            foreach (XmlNode weekDayCategoryNode in weekDayCategoryNodes)
            {
                weekDayCategories.Add(WeekDayCategory.Parse(weekDayCategoryNode));
            }
            return(new RouteStop(stop, weekDayCategories));
        }
Exemplo n.º 4
0
        /// <summary>Searches the current list for an item whose type is based in ObjectWithName and which name is the same as the one given, and returns it if it is found, or null otherwise.</summary>
        public ListOfIDObjects <TYPE> GetItemsByName(string name)
        {
            ListOfIDObjects <TYPE> result = new ListOfIDObjects <TYPE>();

            foreach (TYPE item in this)
            {
                if (item is ObjectWithName && (item as ObjectWithName).Name.Equals(name))
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        public static Route Parse(XmlNode node, ListOfIDObjects <Stop> stops)
        {
            string    id       = node.Attributes["ID"].Value;
            string    name     = node.Attributes["name"].Value;
            Color     color    = ColorTranslator.FromHtml(node.Attributes["color"].Value);
            HalfRoute outgoing = HalfRoute.Parse(node.SelectSingleNode("Outgoing"), stops);
            HalfRoute incoming = HalfRoute.Parse(node.SelectSingleNode("Incoming"), stops);
            Route     result   = new Route(id, name, color, outgoing, incoming);

            result.Outgoing.Route = result;
            result.Incoming.Route = result;
            return(result);
        }
Exemplo n.º 6
0
        private void FilterAndSetStops(TextBox filterTB, StopViewManager manager, InfoView infoView)
        {
            ListOfIDObjects <Stop> stops = new ListOfIDObjects <Stop>();
            string query = filterTB.Text.Trim().ToUpperInvariant();

            foreach (Stop stop in this.Database.Stops)
            {
                if ((query.Equals(string.Empty) || stop.Name.ToUpperInvariant().Contains(query)) && stops.GetItemByName(stop.Name) == null)
                {
                    stops.Add(stop);
                }
            }
            manager.SetStops(stops);
            infoView.TextDescription = string.Format("Ai filtrat {0} / {1} stații", stops.Count, this.Database.Stops.Count);
        }
Exemplo n.º 7
0
 public Database()
 {
     this.Stops  = new ListOfIDObjects <Stop>();
     this.Routes = new ListOfIDObjects <Route>();
 }