/// <summary>
        /// HTML模板屬性信息採集並返回
        /// </summary>
        /// <param name="parameter">計算式參數</param>
        /// <returns>HTML模板屬性信息集合</returns>
        /// <exception cref="ArgumentNullException"><paramref name="parameter"/>為NULL的情況</exception>
        public virtual ConcurrentDictionary <SubstituteType, string> MakeHtmlMaps(TopicParameterBase parameter)
        {
            Guard.ArgumentNotNull(parameter, "parameter");
            if (!typeof(T).IsAssignableFrom(parameter.GetType()))
            {
                throw CreateInvalidParameterException(typeof(T));
            }

            var p        = (T)parameter;
            var htmlMaps = new ConcurrentDictionary <SubstituteType, string>();

            try
            {
                // 題型HTML信息作成并對指定的HTML模板標識進行替換
                htmlMaps.GetOrAdd(SubstituteType.Content, (s) =>
                {
                    var content = MakeHtmlContent(p);
                    LogUtil.LogDebug(MessageUtil.GetMessage(() => MsgResources.I0043L, SubstituteType.Content));
                    return(content);
                });

                // JS模板標籤內容採集
                MarkJavaScriptReplaceContent(htmlMaps);
            }
            catch
            {
                throw;
            }
            finally
            {
                LogUtil.LogDebug(MessageUtil.GetMessage(() => MsgResources.I0010L));
            }
            return(htmlMaps);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 題型測試結果輸出
        /// </summary>
        /// <param name="topicIdentifier">題型識別ID</param>
        /// <param name="args">調試用參數</param>
        public static void ConsoleFormulas(string topicIdentifier, string args)
        {
            TopicParameterBase parameter = PolicyHelper.Instance.Structure(topicIdentifier, args);

            FormulasConsolerFactory formulasConsoler = new FormulasConsolerFactory();
            var writer = formulasConsoler.CreateConsoleWriter(topicIdentifier);

            writer.Do(parameter);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取得HTML和JS的替換內容
        /// </summary>
        /// <returns>替換內容</returns>
        private void GetHtmlReplaceContentMaps()
        {
            TopicManagementList.ForEach(d =>
            {
                // 構造題型并取得結果
                TopicParameterBase parameter = PolicyHelper.Instance.Structure(d.TopicIdentifier, d.Number);
                // 題型HTML信息作成并對指定的HTML模板標識進行替換
                ConcurrentDictionary <SubstituteType, string> htmlMaps = MakeHtml.GetHtmlReplaceTagDict(d.TopicIdentifier, parameter);

                _htmlMaps.Add(d.TopicIdentifier, htmlMaps);
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// 取得HTML和JS的替換內容
        /// </summary>
        /// <param name="topicIdentifier">題型種類</param>
        /// <returns>替換內容</returns>
        private ConcurrentDictionary <SubstituteType, string> GetHtmlReplaceContentMaps(string topicIdentifier)
        {
            // 題型編號取得
            string identifier = TopicManagementList.Where(d => topicIdentifier.Equals(d.TopicIdentifier, StringComparison.CurrentCultureIgnoreCase)).First().Number;

            // 構造題型并取得結果
            TopicParameterBase parameter = PolicyHelper.Instance.Structure(topicIdentifier, identifier);

            // 題型HTML信息作成并對指定的HTML模板標識進行替換
            ConcurrentDictionary <SubstituteType, string> htmlMaps = MakeHtml.GetHtmlReplaceTagDict(topicIdentifier, parameter);

            return(htmlMaps);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 策略作成
        /// </summary>
        /// <param name="param">参数对象</param>
        public virtual void Do(TopicParameterBase param)
        {
            Guard.ArgumentNotNull(param, "param");

            ConsoleFormulas((T)param);
        }