/// <summary> /// Update species fact fields with latest red list values. /// </summary> protected override void SetReadListValues() { if (AllowAutomaticUpdate) { if (RedListCalculator.IsEvaluationStatusSet) { Field5.SetValueAutomatic(CriteriaDocumentation); } else { // Reset values to nothing. Field5.SetValueAutomatic(null); } } }
/// <summary> /// Update species fact fields from Dyntaxa. /// </summary> public void SetTaxonNameValues() { if (AllowAutomaticUpdate) { StringBuilder summary = new StringBuilder(); summary.Append(this.Taxon.ScientificNameAndAuthor); summary.Append("."); TaxonNameList scientificNames = new TaxonNameList(); TaxonNameList swedishNames = new TaxonNameList(); //TaxonName originalName; foreach (TaxonName name in this.Taxon.TaxonNames) { if (name.TaxonNameType.Id == 0 && name.TaxonNameUseType.Id == 0 && !name.IsRecommended) { scientificNames.Add(name); } if (name.TaxonNameType.Id == 1 && name.TaxonNameUseType.Id == 0 && !name.IsRecommended) { swedishNames.Add(name); } } if (scientificNames.IsNotEmpty()) { if (scientificNames.Count == 1) { summary.Append(" Synonym: "); summary.Append(scientificNames[0].Name); if (scientificNames[0].Author.IsNotEmpty()) { summary.Append(" "); summary.Append(scientificNames[0].Author); summary.Append("."); } } else { summary.Append(" Synonymer: "); for (int i = 0; i < scientificNames.Count - 1; i++) { summary.Append(scientificNames[i].Name); if (scientificNames[i].Author.IsNotEmpty()) { summary.Append(" "); summary.Append(scientificNames[i].Author); } if (i < (scientificNames.Count - 2)) { summary.Append(", "); } } summary.Append(" och "); summary.Append(scientificNames[scientificNames.Count - 1].Name); if (scientificNames[scientificNames.Count - 1].Author.IsNotEmpty()) { summary.Append(" "); summary.Append(scientificNames[scientificNames.Count - 1].Author); } summary.Append("."); } } if (swedishNames.IsNotEmpty()) { if (swedishNames.Count == 1) { summary.Append(" Svensk synonym: "); summary.Append(swedishNames[0].Name); summary.Append("."); } else { summary.Append(" Svenska synonymer: "); for (int i = 0; i < swedishNames.Count - 1; i++) { summary.Append(scientificNames[i].Name); if (i < (swedishNames.Count - 2)) { summary.Append(", "); } } summary.Append(" och "); summary.Append(swedishNames[swedishNames.Count - 1].Name); summary.Append("."); } } Field5.SetValueAutomatic(summary.ToString()); } }