示例#1
0
        public void AddDestinations(Destination[] dests)
        {
            if (dests.Length < 1)
                return;

            int idx = 0;
            var values = dests.SelectMany(d => new object[] { d.Name, d.Start, d.End });
            var inserts = dests.Select(route => string.Format("(@{0}, @{1}, @{2})", idx++, idx++, idx++));
            var query = string.Format(c_InsertDestinationQuery, string.Join(",", inserts));
            m_Connection.Query(query, values.ToArray());
        }
示例#2
0
        public void AddRoutes(Destination dest, List<Route> routes)
        {
            if (routes.Count < 1)
                return;

            int idx = 0;
            var values = routes.SelectMany(r => new object[] {dest.Name, r.Name, r.Time, r.CurrentTime, r.Distance, r.Color});
            var inserts = routes.Select(route => string.Format("((SELECT `id` FROM `destinationnames` WHERE `name`=@{0}), @{1}, @{2}, @{3}, @{4}, @{5})", idx++, idx++, idx++, idx++, idx++, idx++));
            var query = string.Format(c_InsertRoutesQuery, string.Join(",", inserts));
            m_Connection.Query(query, values.ToArray());
        }