Exemple #1
0
        public List<Human> Fill()
        {
            List<Human> humansList = new List<Human>();

            try
            {
                command.CommandText = "SELECT * FROM tname";

                command.CommandType = CommandType.Text;
                connection.Open();

                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Human human = new Human();

                    human.id = Convert.ToInt32(reader["id"].ToString());
                    human.Name = reader["name"].ToString();

                    humansList.Add(human);
                }
                return humansList;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Exemple #2
0
        public void Insert(Human human)
        {
            try
            {
                command.CommandText = "INSERT INTO tname (Name) VALUES('" + human.Name + "')";
                command.CommandType = CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Exemple #3
0
        public void FirsTest()
        {
            for (int i = 0; i < 1; i++)
            {
                var start = new Human
                    {
                        LocX = 1,
                        LocY = 5
                    };
                var end = new Zombie
                    {
                        LocX = 5,
                        LocY = 5
                    };

                var wall = new WorldObject
                    {
                        Height = 7,
                        LocX = 3,
                        LocY = 0,
                        Width = 1
                    };

                var map = new Map();
                map.WorldObjects.Add(wall);

                map.LivingEntities.Add(start);
                map.LivingEntities.Add(end);

                var patherFinder = new PathFinder();
                var currentPath = patherFinder.CreatePath(map, start, end);

                var mapPrineter = new MapPrinter();
                mapPrineter.PrintMap(map, currentPath);
            }
        }
 public void DeepClone()
 {
     var human = new Human();
     Human clone = human.DeepClone();
 }