public static void TestAddSoldiers() { for (int c1 = 10; c1 >= 0; c1--) { for (int c2 = 10 - c1; c2 >= 0; c2--) { for (int c3 = 10 - c1 - c2; c3 >= 0; c3--) { for (int c4 = 10 - c1 - c2 - c3; c4 >= 0; c4--) { for (int c5 = 10 - c1 - c2 - c3 - c4; c5 >= 0; c5--) { for (int c6 = 10 - c1 - c2 - c3 - c4 - c5; c6 >= 0; c6--) { for (int c7 = 10 - c1 - c2 - c3 - c4 - c5 - c6; c7 >= 0; c7--) { for (int c8 = 10 - c1 - c2 - c3 - c4 - c5 - c6 - c7; c8 >= 0; c8--) { for (int c9 = 10 - c1 - c2 - c3 - c4 - c5 - c6 - c7 - c8; c9 >= 0; c9--) { int c10 = 10 - c1 - c2 - c3 - c4 - c5 - c6 - c7 - c8 - c9; Castles.CastlesDataTable table = new Castles.CastlesDataTable(); Castles.CastlesRow row = table.NewCastlesRow(); row.CastleOne = c1; row.CastleTwo = c2; row.CastleThree = c3; row.CastleFour = c4; row.CastleFive = c5; row.CastleSix = c6; row.CastleSeven = c7; row.CastleEight = c8; row.CastleNine = c9; row.CastleTen = c10; table.AddCastlesRow(row); CastlesTableAdapters.CastlesTableAdapter adapter = new CastlesTableAdapters.CastlesTableAdapter(); adapter.Update(table); table.AcceptChanges(); } } } } } } } } } }
public static void calculateResults() { using (CastlesTableAdapters.CastlesTableAdapter adapter = new CastlesTableAdapters.CastlesTableAdapter()) { Castles.CastlesDataTable table = new Castles.CastlesDataTable(); Castles.CastlesDataTable compareToTable = new Castles.CastlesDataTable(); //Castles.CastlesDataTable compareToTables = new Castles.CastlesDataTable(); adapter.FillByRange(table, 0, 0); adapter.Fill(compareToTable); #region ToDo stuff //Castle castleFrom = new Castle(); //castleFrom = Castle.FrontDataObject(table[0]); //adapter.FillByNotID(compareToTables, 1); List <Castle> castles = new List <Castle>(); foreach (Castles.CastlesRow row in table) { Castle castle = new Castle(); castle = Castle.FrontDataObject(row); castles.Add(castle); } List <Castle> allCastles = new List <Castle>(); foreach (Castles.CastlesRow row in compareToTable) { Castle cas = new Castle(); cas = Castle.FrontDataObject(row); allCastles.Add(cas); } addPoints(castles, allCastles); foreach (Castles.CastlesRow row in table) { Castle castle = castles.Where(x => x.ID == row.Id).FirstOrDefault(); Castle.toDataObject(castle, row); } #endregion adapter.Update(table); table.AcceptChanges(); } }