private string GetClassificationNameById(string classificationId)
        {
            var topLovelCategories = SitefinityHelper.GetTopLevelCategories();

            foreach (var taxon in topLovelCategories)
            {
                JobFilterRoot filterRoot = new JobFilterRoot()
                {
                    Filters = new List <JobFilter>()
                };
                filterRoot.ID   = taxon.Id.ToString().ToUpper();
                filterRoot.Name = taxon.Title;
                if (classificationId == filterRoot.ID)
                {
                    return(filterRoot.Name);
                }
                var hierarchicalTaxon = taxon as HierarchicalTaxon;
                if (hierarchicalTaxon != null)
                {
                    foreach (var childTaxon in hierarchicalTaxon.Subtaxa)
                    {
                        var jobFilter = new JobFilter()
                        {
                            Filters = new List <JobFilter>()
                        };
                        ProcessCategories(childTaxon, jobFilter);
                        filterRoot.Filters.Add(jobFilter);
                    }
                }
            }
            return(null);
        }
 public JobFiltersDesignerViewModel()
 {
     if (string.IsNullOrWhiteSpace(this.SerializedJobFilterModel))
     {
         var filterModel        = new List <JobFiltersModel>();
         var topLovelCategories = SitefinityHelper.GetTopLevelCategories();
         int index = 1;
         foreach (var taxon in topLovelCategories)
         {
             filterModel.Add(new JobFiltersModel()
             {
                 TaxonamyName = taxon.Title, TaxonomyId = taxon.Id.ToString(), Selected = false, TrackId = index
             });
             index++;
         }
         filterModel.Add(new JobFiltersModel()
         {
             TaxonamyName = "CompanyName", Selected = false, TrackId = index
         });
         this.SerializedJobFilterModel = JsonConvert.SerializeObject(filterModel);
     }
 }
Exemplo n.º 3
0
        public static JobFiltersData GetFiltersData()
        {
            JobFiltersData filtersData = new JobFiltersData()
            {
                Data = new List <JobFilterRoot>()
            };
            var topLovelCategories = SitefinityHelper.GetTopLevelCategories();

            foreach (var taxon in topLovelCategories)
            {
                JobFilterRoot filterRoot = new JobFilterRoot()
                {
                    Filters = new List <JobFilter>()
                };
                filterRoot.ID   = taxon.Id.ToString().ToUpper();
                filterRoot.Name = taxon.Title;

                var hierarchicalTaxon = taxon as HierarchicalTaxon;
                if (hierarchicalTaxon != null)
                {
                    foreach (var childTaxon in hierarchicalTaxon.Subtaxa)
                    {
                        var jobFilter = new JobFilter()
                        {
                            Filters = new List <JobFilter>()
                        };
                        ProcessCategories(childTaxon, jobFilter);
                        filterRoot.Filters.Add(jobFilter);
                    }
                }

                filtersData.Data.Add(filterRoot);
            }

            return(filtersData);
        }