private TaxonCategoryList GetTaxonCategories(Boolean refresh) { if (_taxonCategoryList.IsNull() || refresh) { _taxonCategoryList = new TaxonCategoryList(); _taxonCategoryList.Add(TaxonCategoryTest.GetTaxonCategory(GetUserContext())); } return(_taxonCategoryList); }
/// <summary> /// Get all output taxon categories that are checked. /// </summary> /// <returns>All output taxon categories that are checked.</returns> public TaxonCategoryList GetOutputTaxonCategories() { if (_outputTaxonCategories.IsNull()) { _outputTaxonCategories = new TaxonCategoryList(); foreach (ExportTaxonCategory outputTaxonCategory in OutputAllTaxonCategories) { if (outputTaxonCategory.IsChecked) { _outputTaxonCategories.Add(TaxonCategories.Get(outputTaxonCategory.CategoryId)); } } } return(_outputTaxonCategories); }
/// <summary> /// Get all filter taxon categories that are checked. /// </summary> /// <returns>All filter taxon categories that are checked.</returns> public TaxonCategoryList GetFilteredTaxonCategories() { if (_filteredTaxonCategories.IsNull()) { _filteredTaxonCategories = new TaxonCategoryList(); foreach (ExportTaxonCategory filterTaxonCategory in FilterAllTaxonCategories) { if (filterTaxonCategory.IsChecked) { _filteredTaxonCategories.Add(TaxonCategories.Get(filterTaxonCategory.CategoryId)); } } } return(_filteredTaxonCategories); }
public void SquareBracketOperator() { TaxonCategoryList newTaxonCategoryList, oldTaxonCategoryList; Int32 taxonCategoryIndex; oldTaxonCategoryList = GetTaxonCategories(true); newTaxonCategoryList = new TaxonCategoryList(); for (taxonCategoryIndex = 0; taxonCategoryIndex < oldTaxonCategoryList.Count; taxonCategoryIndex++) { newTaxonCategoryList.Add(oldTaxonCategoryList[oldTaxonCategoryList.Count - taxonCategoryIndex - 1]); } for (taxonCategoryIndex = 0; taxonCategoryIndex < oldTaxonCategoryList.Count; taxonCategoryIndex++) { Assert.AreEqual(newTaxonCategoryList[taxonCategoryIndex], oldTaxonCategoryList[oldTaxonCategoryList.Count - taxonCategoryIndex - 1]); } }
public TaxonCategoryList GetTaxonCategories(IUserContext userContext) { TaxonCategoryList taxonCategories = new TaxonCategoryList(); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = -2, Name = "Grupp", IsMainCategory = false, ParentId = -2, SortOrder = -2, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = -1, Name = "Lavgrupp", IsMainCategory = false, ParentId = -2, SortOrder = -1, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 1, Name = "Rike", IsMainCategory = true, ParentId = 0, SortOrder = 0, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 2, Name = "Stam", IsMainCategory = true, ParentId = 1, SortOrder = 1, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 3, Name = "Understam", IsMainCategory = false, ParentId = 2, SortOrder = 2, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 4, Name = "Överklass", IsMainCategory = false, ParentId = 2, SortOrder = 3, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 5, Name = "Klass", IsMainCategory = true, ParentId = 2, SortOrder = 4, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 6, Name = "Underklass", IsMainCategory = false, ParentId = 5, SortOrder = 5, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 7, Name = "Överordning", IsMainCategory = false, ParentId = 5, SortOrder = 10, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 8, Name = "Ordning", IsMainCategory = true, ParentId = 5, SortOrder = 11, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 9, Name = "Underordning", IsMainCategory = false, ParentId = 8, SortOrder = 12, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 10, Name = "Överfamilj", IsMainCategory = false, ParentId = 8, SortOrder = 15, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 11, Name = "Familj", IsMainCategory = true, ParentId = 8, SortOrder = 16, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 12, Name = "Underfamilj", IsMainCategory = false, ParentId = 11, SortOrder = 17, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 13, Name = "Tribus", IsMainCategory = false, ParentId = 11, SortOrder = 18, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 14, Name = "Släkte", IsMainCategory = true, ParentId = 11, SortOrder = 19, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 15, Name = "Undersläkte", IsMainCategory = false, ParentId = 14, SortOrder = 20, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 16, Name = "Sektion", IsMainCategory = false, ParentId = 14, SortOrder = 23, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 17, Name = "Art", IsMainCategory = true, ParentId = 14, SortOrder = 24, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 18, Name = "Underart", IsMainCategory = false, ParentId = 17, SortOrder = 25, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 19, Name = "Varietet", IsMainCategory = false, ParentId = 17, SortOrder = 26, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 20, Name = "Form", IsMainCategory = false, ParentId = 17, SortOrder = 27, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 21, Name = "Hybrid", IsMainCategory = false, ParentId = 17, SortOrder = 28, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 22, Name = "Kulturvarietet", IsMainCategory = false, ParentId = 17, SortOrder = 29, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 23, Name = "Population", IsMainCategory = false, ParentId = 17, SortOrder = 30, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 24, Name = "Grupp av familjer", IsMainCategory = false, ParentId = 8, SortOrder = 14, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 25, Name = "Infraklass", IsMainCategory = false, ParentId = 5, SortOrder = 6, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 26, Name = "Parvklass", IsMainCategory = false, ParentId = 5, SortOrder = 7, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 27, Name = "Sensu lato", IsMainCategory = false, ParentId = 14, SortOrder = 22, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 28, Name = "Svårbestämt artpar", IsMainCategory = false, ParentId = 14, SortOrder = 21, IsTaxonomic = false }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 29, Name = "Infraordning", IsMainCategory = false, ParentId = 8, SortOrder = 13, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 30, Name = "Avdelning", IsMainCategory = false, ParentId = 5, SortOrder = 8, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 31, Name = "Underavdelning", IsMainCategory = false, ParentId = 5, SortOrder = 9, IsTaxonomic = true }); taxonCategories.Add(new TaxonCategory() { DataContext = new DataContext(userContext), Id = 32, Name = "Morfotyp", IsMainCategory = false, ParentId = 17, SortOrder = 31, IsTaxonomic = false }); return(taxonCategories); //var s = CoreData.TaxonManager.GetTaxonCategories(CoreData.UserManager.GetCurrentUser()); //foreach (ITaxonCategory taxonCategory in s) //{ // Debug.WriteLine( // "taxonCategories.Add(new TaxonCategory(userContext) {{ Id = {0}, Name = \"{1}\", MainCategory = {2}, ParentCategory = {3}, SortOrder = {4}, Taxonomic = {5}}});", // taxonCategory.Id, taxonCategory.Name, taxonCategory.MainCategory, taxonCategory.ParentCategory, taxonCategory.SortOrder, // taxonCategory.Taxonomic); // ; //} }