Exemple #1
0
        public static async Task <string> GetEachsTemplateStringAsync(string templateString, NameValueCollection selectedItems, NameValueCollection selectedValues, string containerClientId, IParseManager parseManager, ParseType contextType)
        {
            var context = parseManager.ContextInfo;

            var pageInfo      = parseManager.PageInfo;
            var itemContainer = DbItemContainer.GetItemContainer(pageInfo);

            parseManager.ContextInfo                   = parseManager.ContextInfo.Clone();
            parseManager.ContextInfo.ContextType       = contextType;
            parseManager.ContextInfo.ContainerClientId = containerClientId;
            parseManager.ContextInfo.ItemContainer     = itemContainer;

            if (selectedItems != null && selectedItems.Count > 0)
            {
                foreach (var itemType in selectedItems.AllKeys)
                {
                    if (IsNumberInRange(itemContainer.SqlItem.Key + 1, itemType))
                    {
                        templateString = selectedItems.Get(itemType);
                        break;
                    }
                }
            }

            var innerBuilder = new StringBuilder(templateString);
            await parseManager.ParseInnerContentAsync(innerBuilder);

            DbItemContainer.PopEachItem(pageInfo);

            parseManager.ContextInfo = context;

            return(innerBuilder.ToString());
        }
        public static string GetEachsTemplateString(string templateString, NameValueCollection selectedItems, NameValueCollection selectedValues, string containerClientId, PageInfo pageInfo, EContextType contextType, ContextInfo contextInfoRef)
        {
            var itemContainer = DbItemContainer.GetItemContainer(pageInfo);

            var contextInfo = contextInfoRef.Clone();

            contextInfo.ContextType       = contextType;
            contextInfo.ContainerClientId = containerClientId;
            contextInfo.ItemContainer     = itemContainer;

            if (selectedItems != null && selectedItems.Count > 0)
            {
                foreach (var itemType in selectedItems.AllKeys)
                {
                    if (IsNumberInRange(itemContainer.SqlItem.ItemIndex + 1, itemType))
                    {
                        templateString = selectedItems.Get(itemType);
                        break;
                    }
                }
            }

            var innerBuilder = new StringBuilder(templateString);

            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);

            DbItemContainer.PopEachItem(pageInfo);

            return(innerBuilder.ToString());
        }