public void Execute() { try { var defaultDeserialize = new JsonDeserialize <AbsoluteCategory>(JsonDeserialize <AbsoluteCategory> .DefaultCategoriesFilename); List = defaultDeserialize.ListJson(); //using (SQLiteCommand command = new SQLiteCommand(Logic.Db.Properties.Resources.SQL_SELECT_ALL_CATEGORIES, _conn.DbConnection)) //using (SQLiteDataReader reader = command.ExecuteReader()) //{ // while (reader.Read()) // { // CategoryDto cat = new CategoryDto() // { // Name = reader.GetString(0), // //Min_Age = reader.GetInt16(1), // //Max_Age = reader.GetInt16(1) // }; // list.Add(cat); // } //} } catch (SQLiteException) { _conn.DbConnection?.Close(); throw; } }
public void GeneratorDefaultCategoriesTest() { var json = new JsonDeserialize <AbsoluteCategory>("DefaultCategories.json"); string[] categorias = { "JUNIOR", "SENIOR", "VETERAN_A", "VETERAN_B", "VETERAN_C" }; int[] agem = { 18, 19, 35, 45, 55 }; int[] ageM = { 18, 34, 44, 54, int.MaxValue }; var categories = new AbsoluteCategory[categorias.Length]; for (var i = 0; i < categories.Length; i++) { var str = categorias[i]; var absoluteCategory = new AbsoluteCategory { Id = 1, Name = str, CategoryM = new CategoryDto { Id = 1, Name = $"{str}_M", MinAge = agem[i], MaxAge = ageM[i], Gender = "M" }, CategoryF = new CategoryDto { Id = 1, Name = $"{str}_F", MinAge = agem[i], MaxAge = ageM[i], Gender = "F" } }; categories[i] = absoluteCategory; } json.Serialize(categories); foreach (var category in json.ListJson()) { if (category != null) { Console.WriteLine($@"{category.Name} {category.CategoryF.Name} {category.CategoryM.Name}"); } } }