Exemplo n.º 1
0
        private List <TaxonNameViewModel> GetMisappliedNames(ITaxon taxon)
        {
            List <TaxonNameViewModel> misappliedNamesList = new List <TaxonNameViewModel>();
            List <ITaxonName>         misappliedNames     = taxon.GetMisappliedNames(_userContext);

            foreach (ITaxonName taxonName in misappliedNames)
            {
                misappliedNamesList.Add(new TaxonNameViewModel(taxonName, taxon));
            }

            return(misappliedNamesList);
        }
        /// <summary>
        /// Gets the misapplied names that is ok to show to the user.
        /// </summary>
        /// <param name="isInRevision">if set to <c>true</c> the session is in revision mode.</param>
        /// <param name="isEditorUser">if set to <c>true</c> the user is taxon editor.</param>
        /// <returns>List of misapplied names.</returns>
        public static List <TaxonNameViewModel> GetMisappliedNamesViewModel(this ITaxon taxon, bool isInRevision, bool isEditorUser)
        {
            List <ITaxonName> misappliedNames = taxon.GetMisappliedNames(CoreData.UserManager.GetCurrentUser());

            misappliedNames = misappliedNames.OrderBy(t => t.Category.Id).ThenBy(t => t.Status.SortOrder()).ToList();
            List <TaxonNameViewModel> resultList = new List <TaxonNameViewModel>();

            foreach (ITaxonName taxonName in misappliedNames)
            {
                if (IsNameOkToShow(taxonName, isInRevision, isEditorUser))
                {
                    resultList.Add(new TaxonNameViewModel(taxonName, taxon));
                }
            }

            return(resultList);
        }