Ejemplo n.º 1
0
 public void UpdateConnection(Connection connection)
 {
     this.connectionRepository.UpdateConnection(connection);
     this.connectionRepository.Save();
 }
Ejemplo n.º 2
0
 public void CreateConnection(int fromID, int toID, double distance)
 {
     var connection = new Connection { FromID = fromID, ToID = toID, Distance = distance };
     this.connectionRepository.InsertConnection(connection);
     this.connectionRepository.Save();
 }
Ejemplo n.º 3
0
        public void ReadConnections()
        {
            string connections = @".\..\..\connections.xml";
            //string connections = @"C:\Users\ki\VisualStudioWorkspace\GraphTest03Dict\GraphTest03Dict\bin\Debug\connections.xml";
            reader = XmlReader.Create(connections);

            Connection con = null;
            this.connectionList = new List<Connection>();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    string switchCase = reader.Name;
                    switch (switchCase)
                    {
                        case "RECORD":
                            con = new Connection();
                            connectionList.Add(con);
                            break;

                        case "location1":
                            reader.Read();
                            con.From = new Location(Convert.ToInt16(reader.Value));
                            break;

                        case "location2":
                            reader.Read();
                            con.To = new Location(Convert.ToInt16(reader.Value));
                            break;

                        case "distance":
                            reader.Read();
                            con.Distance = Convert.ToDouble(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
                            break;
                    }
                }
            }
        }
 public void UpdateConnection(Connection connection)
 {
     this.context.Entry(connection).State = EntityState.Modified;
 }
 public void InsertConnection(Connection connection)
 {
     this.context.Connections.Add(connection);
 }
Ejemplo n.º 6
0
 public bool RemoveConnection(Connection connection)
 {
     Location from = connection.From;
     return from.Adjacents.Remove(connection.To.ID);
 }
 public void UpdateConnection(Connection connection)
 {
     controller.UpdateConnection(connection);
 }