private static void HandleUsefulFaqLinks(DataMap resultObject, List <UsefulFaqLinksUtils> templateFaQs)
        {
            var usefulFaqLinks = FaqUtils.GetUsefulFaqLinks(templateFaQs);

            if (CollectionExtensions.IsNullOrEmpty(usefulFaqLinks))
            {
                return;
            }
            resultObject.Attributes.Add("usefulFaqLinks", usefulFaqLinks);
        }
Пример #2
0
        private static object GetTree(IEnumerable <FaqUtils.FaqData> treeDataList, string lang, string search)
        {
            object returnTree;

            var language = FaqUtils.GetLanguageToFilter(lang);

            var classificationNodes = BuildClassificationNodes(treeDataList, language);

            if (!string.IsNullOrEmpty(search))
            {
                returnTree = classificationNodes.FindAll(x => x.SolutionId != null && x.Name.IndexOf(search, 0, StringComparison.CurrentCultureIgnoreCase) != -1);
            }
            else
            {
                returnTree = BuildLeafNodes(classificationNodes);
            }
            return(returnTree);
        }
        private static List <UsefulFaqLinksUtils> GetUsefulFaqLinksUtils(ApplicationSchemaDefinition applicationSchemaDefinition)
        {
            var list = new List <UsefulFaqLinksUtils>();

            try {
                var schemaId = applicationSchemaDefinition.SchemaId;
                if (!FaqUsefulLinks.ContainsKey(schemaId))
                {
                    FaqUsefulLinks.Add(schemaId, GetFaqUsefulLinksFromConfigFile(schemaId));
                }
                if (FaqUsefulLinks[schemaId].Count <= 0)
                {
                    return(list);
                }
                var language = FaqUtils.GetLanguageToFilter(SecurityFacade.CurrentUser().Language);
                list.AddRange(FaqUsefulLinks[schemaId].Select(id => new UsefulFaqLinksUtils(id, language, schemaId)));
                Log.DebugFormat("useful faq list size {0}", list.Count());
                return(list);
            } catch {
                return(list);
            }
        }
Пример #4
0
        public IGenericResponseResult Index(string lang = null, string search = null)
        {
            /*
             * var lstFromMetadata = (ApplicationConfiguration.IsProd) ? GetList() : GetMockedList();
             * if (lstFromMetadata.Any(treeData => treeData.SolutionId != Convert.ToInt32(treeData.Description.Substring(1, 4))))
             * {
             *  throw new NotImplementedException();
             * }
             */
            var listToUse = ApplicationConfiguration.IsProd() ? new FaqUtils().GetList() : FaqUtils.GetMockedList();
            //var listToUse = ApplicationConfiguration.IsProd() ? new FaqUtils().GetList() : new FaqUtils().GetList();
            var tree  = GetTree(listToUse, lang, search);
            var model = new FaqModel(tree)
            {
                Lang = lang, Search = search
            };

            return(new GenericResponseResult <FaqModel>(model, null));
        }