/// <summary> /// Set species fact information about this taxon. /// </summary> /// <param name="speciesFact">Species fact with red list information.</param> public void SetSpeciesFact(ISpeciesFact speciesFact) { if (LandscapeTypeManager.LandscapeTypeFactors.IsNotNull() && LandscapeTypeManager.LandscapeTypeFactors.Exists(speciesFact.Factor)) { if (speciesFact.IsLandscapeTypeOccurrenceSpecified()) { string landscapeTypeOccurrence = speciesFact.Factor.Label; landscapeTypeOccurrence = landscapeTypeOccurrence.Substring(landscapeTypeOccurrence.Length - 2, 1); switch (speciesFact.MainField.EnumValue.KeyInt) { case (int)LandscapeTypeImportanceEnum.HasImportance: LandscapeTypeOccurrence += landscapeTypeOccurrence.ToLower(); break; case (int)LandscapeTypeImportanceEnum.VeryImportant: LandscapeTypeOccurrence += landscapeTypeOccurrence.ToUpper(); break; } } } else { switch (speciesFact.Factor.Id) { case (int)FactorId.RedlistCategory: if (speciesFact.IsRedlistCategorySpecified()) { RedListCategory = speciesFact.Field1.EnumValue.OriginalLabel.Substring(0, speciesFact.Field1.EnumValue.OriginalLabel.Length - 4) + "(" + speciesFact.MainField.StringValue + ")"; var category = (RedListCategory)Enum.Parse(typeof(RedListCategory), RedListCategory.Substring(RedListCategory.IndexOf("(", StringComparison.Ordinal) + 1, 2)); IsRedListed = RedListedHelper.IsRedListedDdToNt((int)category); IsRedListedEnsured = RedListedHelper.IsRedListedDdToNe((int)category); RedListCategoryId = Convert.ToInt32(speciesFact.Field1.EnumValue.KeyInt); } break; case (int)FactorId.RedlistCriteriaString: if (speciesFact.IsRedlistCriteriaSpecified()) { RedListCriteria = speciesFact.MainField.StringValue; } break; case (int)FactorId.Redlist_OrganismLabel1: if (speciesFact.IsOrganismGroupSpecified()) { if (OrganismGroup.IsEmpty()) { OrganismGroup = speciesFact.MainField.EnumValue.OriginalLabel; } else { if (OrganismGroup != speciesFact.MainField.EnumValue.OriginalLabel) { OrganismGroup = speciesFact.MainField.EnumValue.OriginalLabel + ", " + OrganismGroup; } } } break; case (int)FactorId.SwedishOccurrence: if (speciesFact.IsSwedishOccurrenceSpecified()) { SwedishOccurrence = speciesFact.MainField.EnumValue.OriginalLabel; SwedishOccurrenceId = Convert.ToInt32(speciesFact.MainField.EnumValue.KeyInt); } break; } } }