/// <summary>
        /// 毫米轉換為米分米釐米毫米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(毫米或者米分米釐米毫米)</param>
        protected virtual void MillimeterConvertToMeterDecimetreCentimeterExt(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得米數量級
            int meter = CommonUtil.GetRandomNumber(1, 9);
            // 隨機取得分米數量級
            int decimetre = CommonUtil.GetRandomNumber(1, 9);
            // 隨機取得釐米數量級
            int centimeter = CommonUtil.GetRandomNumber(1, 9);
            // 隨機取得釐米數量級
            int remainderMillimeter = CommonUtil.GetRandomNumber(1, 9);
            // 隨機編排填空項目(是毫米還是米分米釐米毫米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 毫米單位
                Millimeter = meter * 1000 + decimetre * 100 + centimeter * 10 + remainderMillimeter,
                // 米單位
                Meter = meter,
                // 分米單位
                Decimetre = decimetre,
                // 釐米單位
                Centimeter = centimeter
            };
            // 剩餘的毫米
            formula.RemainderMillimeter = remainderMillimeter;
            // 填空項目(毫米或者米分米釐米毫米)
            formula.Gap = gap;
        }
示例#2
0
        /// <summary>
        /// 開始時間計算式
        /// </summary>
        /// <param name="startTime">時間計算式</param>
        /// <param name="gap">填空項目</param>
        /// <param name="index">控件索引ID</param>
        /// <returns>HTML模板信息</returns>
        private string GetStartTimeHtml(TimeType startTime, GapFilling gap, int index)
        {
            var html = string.Empty;

            html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, "现在是");
            // 如果是填空項目
            if (gap == GapFilling.Left)
            {
                // 小時
                html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "0", Consts.HR_UNIT);
                html += SPAN_COLON_HTML;
                // 分鐘
                html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "1", Consts.MIN_UNIT);
                html += SPAN_COLON_HTML;
                // 秒
                html += string.Format(INPUT_HTML_ON_SCRIPT_FORMAT, index.ToString().PadLeft(2, '0'), "2", Consts.SEC_UNIT);
                // 題型答案
                html += string.Format(INPUT_ANSWER_HTML_FORMAT, index.ToString().PadLeft(2, '0'), Base64.EncodeBase64(startTime.HMSValue));
            }
            else
            {
                // 時間顯示(eg: 09:23:03)
                html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, startTime.HMSValue);
            }
            return(html);
        }
示例#3
0
        /// <summary>
        /// 角轉換為元(有剩餘)
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(元或者角)</param>
        protected virtual void JiaoConvertToYuanExt(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得角數量級
            int jiao = CommonUtil.GetRandomNumber(10, 100);

            // 如果沒有產生角的餘量,那麼變換題型為角轉元
            if (jiao % 10 == 0)
            {
                // 題型變換
                formula.CurrencyTransType = CurrencyTransformType.J2Y;
                // 角轉換為元
                JiaoConvertToYuan(formula, type);
                return;
            }

            // 轉換為元的換算
            int yuan = jiao / 10;
            // 隨機編排填空項目(是角還是元)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 角單位
                Jiao = jiao
            };
            // 剩餘的角
            formula.RemainderJiao = jiao % 10;
            // 填空項目(角或者元、角)
            formula.Gap = gap;
        }
        /// <summary>
        /// 隨機編排填空項目
        /// </summary>
        /// <param name="type">是否隨機填空</param>
        /// <returns>填空項目類型</returns>
        private GapFilling GetRandomGapFilling(QuestionType type)
        {
            GapFilling gap = GapFilling.Right;

            if (type == QuestionType.GapFilling)
            {
                // 隨機編排填空項目(是分還是元)
                gap = CommonUtil.GetRandomNumber(GapFilling.Left, GapFilling.Right);
            }
            return(gap);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="parameter"></param>
        /// <param name="gap"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        private string GetHtml(GapFilling item, int parameter, GapFilling gap, int index)
        {
            var html = string.Empty;

            if (item == gap)
            {
                html += string.Format("<input id=\"inputEc{0}\" type = \"text\" placeholder=\" ?? \" class=\"form-control\" style=\"width: 50px; text-align:center;\" disabled=\"disabled\" onkeyup=\"if(!/^\\d+$/.test(this.value)) this.value='';\" />", index);
            }
            else
            {
                html = string.Format("<span class=\"label\">{0}</span>", parameter);
            }
            return(html);
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item">当前处理项的位置</param>
        /// <param name="parameter">算是值</param>
        /// <param name="gap">填空项位置</param>
        /// <param name="pIndex">上一级控件索引</param>
        /// <param name="index">当前控件索引</param>
        /// <returns></returns>
        private string GetHtml(GapFilling item, int parameter, GapFilling gap, int pIndex, int index)
        {
            var html = string.Empty;

            if (item == gap)
            {
                html += string.Format("<input id=\"inputCc{0}{1}\" type = \"text\" placeholder=\" ?? \" class=\"form-control input-addBorder\" disabled=\"disabled\" onkeyup=\"if(!/^\\d+$/.test(this.value)) this.value='';\" />", pIndex, index);
                html += string.Format("<input id=\"hiddenCc{0}{1}\" type=\"hidden\" value=\"{2}\"/>", pIndex, index, Base64.EncodeBase64(parameter.ToString()));
            }
            else
            {
                html = string.Format("<span class=\"label\">{0}</span>", parameter);
            }
            return(html);
        }
示例#7
0
        /// <summary>
        /// 計算式HTML作成
        /// </summary>
        /// <param name="item">填空項目</param>
        /// <param name="parameter">計算式中的數值</param>
        /// <param name="gap">當前顯示項目所在計算式中的位置</param>
        /// <param name="parentIndex">控件索引號</param>
        /// <param name="controlIndex">子控件索引號</param>
        /// <returns>HTML模板信息</returns>
        private string GetHtml(GapFilling item, int parameter, GapFilling gap, int parentIndex, int controlIndex)
        {
            StringBuilder html = new StringBuilder();

            if (item == gap)
            {
                html.AppendFormat(INPUT_HTML_FORMAT, parentIndex.ToString().PadLeft(2, '0'), controlIndex.ToString());
            }
            else
            {
                html.AppendFormat(LABEL_HTML_FORMAT, parameter);
            }

            return(html.ToString());
        }
示例#8
0
        /// <summary>
        /// 分轉換為元角(有剩餘)
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分或者元角)</param>
        protected virtual void FenConvertToYuanJiaoExt(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得分數量級
            int fen = CommonUtil.GetRandomNumber(1, 1000);

            // 如果沒有產生分的餘量,那麼變換題型為分轉元角
            if (fen % 10 == 0)
            {
                // 題型變換
                formula.CurrencyTransType = CurrencyTransformType.F2YJ;
                // 分轉換為元角
                FenConvertToYuanJiao(formula, type);
                return;
            }
            else if (fen % 100 == 0)
            {
                // 題型變換
                formula.CurrencyTransType = CurrencyTransformType.F2Y;
                // 分轉換為元
                FenConvertToYuan(formula, type);
                return;
            }

            // 轉換為元的換算
            int yuan = fen / 100;
            // 轉換為角的換算
            int jiao = fen % 100 / 10;
            // 隨機編排填空項目(是角還是分)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 角單位
                Jiao = jiao,
                // 分單位
                Fen = fen
            };
            // 剩餘的分
            formula.RemainderFen = fen % 10;
            // 填空項目(分或者角)
            formula.Gap = gap;
        }
        /// <summary>
        /// 毫米轉換為釐米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(毫米或者釐米)</param>
        protected virtual void MillimeterConvertToCentimeter(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得釐米數量級
            int centimeter = CommonUtil.GetRandomNumber(1, 10);
            // 隨機編排填空項目(是毫米還是釐米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 毫米單位
                Millimeter = centimeter * 10,
                // 釐米單位
                Centimeter = centimeter
            };
            // 填空項目(毫米或者釐米)
            formula.Gap = gap;
        }
        /// <summary>
        /// 毫米轉換為分米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(毫米或者分米)</param>
        protected virtual void MillimeterConvertToDecimetre(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得分米數量級
            int decimetre = CommonUtil.GetRandomNumber(1, 10);
            // 隨機編排填空項目(是毫米還是分米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 毫米單位
                Millimeter = decimetre * 100,
                // 分米單位
                Decimetre = decimetre
            };
            // 填空項目(毫米或者分米)
            formula.Gap = gap;
        }
示例#11
0
        /// <summary>
        /// 經過時間計算式
        /// </summary>
        /// <param name="elapsedTime">時間計算式</param>
        /// <param name="gap">填空項目</param>
        /// <param name="sign">運算符(之前\之後)</param>
        /// <param name="index">控件索引ID</param>
        /// <returns>HTML模板信息</returns>
        private string GetElapsedTimeHtml(TimeType elapsedTime, GapFilling gap, SignOfOperation sign, int index)
        {
            var html = string.Empty;

            html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, "在");
            // 如果是填空項目
            if (gap == GapFilling.Right)
            {
                // 小時
                html += string.Format(INPUT_HTML_FORMAT, index.ToString().PadLeft(2, '0'), "0");
                html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, Consts.HOUR_UNIT);
                // 分鐘
                html += string.Format(INPUT_HTML_FORMAT, index.ToString().PadLeft(2, '0'), "1");
                html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, Consts.MINUTE_UNIT);
                // 秒
                html += string.Format(INPUT_HTML_FORMAT, index.ToString().PadLeft(2, '0'), "2");
                html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, Consts.SEC_UNIT);

                // 題型答案
                html += string.Format(INPUT_ANSWER_HTML_FORMAT, index.ToString().PadLeft(2, '0'), Base64.EncodeBase64(elapsedTime.HMSValue));
            }
            else
            {
                // 時間顯示(eg: 9小時23分鐘3秒)
                // 小時
                if (elapsedTime.Hours.Value != 0)
                {
                    html += string.Format(SPAN_TIME_CN_HTML_FORMAT, elapsedTime.Hours, Consts.HOUR_UNIT);
                }
                // 分鐘
                if (elapsedTime.Minutes.Value != 0)
                {
                    html += string.Format(SPAN_TIME_CN_HTML_FORMAT, elapsedTime.Minutes, Consts.MINUTE_UNIT);
                }
                // 秒
                if (elapsedTime.Seconds.Value != 0)
                {
                    html += string.Format(SPAN_TIME_CN_HTML_FORMAT, elapsedTime.Seconds, Consts.SEC_UNIT);
                }
            }
            html += string.Format(SPAN_TIME_NUM_HTML_FORMAT, sign.ToOperationUnicode());
            return(html);
        }
示例#12
0
        /// <summary>
        /// 角轉換為分
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分或者角)</param>
        protected virtual void JiaoConvertToFen(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得角數量級
            int jiao = CommonUtil.GetRandomNumber(1, 10);
            // 轉換為分的換算
            int fen = jiao * 10;
            // 隨機編排填空項目(是角還是分)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 角單位
                Jiao = jiao,
                // 分單位
                Fen = fen
            };
            // 填空項目(分或者角)
            formula.Gap = gap;
        }
示例#13
0
        /// <summary>
        /// 元轉換為角
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(元或者角)</param>
        protected virtual void YuanConvertToJiao(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得元數量級
            int yuan = CommonUtil.GetRandomNumber(1, 10);
            // 轉換為角的換算
            int jiao = yuan * 10;
            // 隨機編排填空項目(是角還是元)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 角單位
                Jiao = jiao
            };
            // 填空項目(元或者角)
            formula.Gap = gap;
        }
        /// <summary>
        /// 釐米轉換為分米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(釐米或者分米)</param>
        protected virtual void CentimeterConvertToDecimetre(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得釐米數量級
            int centimeter = CommonUtil.GetRandomNumber(1, 10) * 10;
            // 轉換為分米的換算
            int decimetre = centimeter / 10;
            // 隨機編排填空項目(是釐米還是分米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 釐米單位
                Centimeter = centimeter,
                // 分米單位
                Decimetre = decimetre
            };
            // 填空項目(釐米或者分米)
            formula.Gap = gap;
        }
        /// <summary>
        /// 分米轉換為毫米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分米或者毫米)</param>
        protected virtual void DecimetreConvertToMillimeter(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得分米數量級
            int decimetre = CommonUtil.GetRandomNumber(1, 10);
            // 轉換為毫米的換算
            int millimeter = decimetre * 100;
            // 隨機編排填空項目(是分米還是毫米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 分米單位
                Decimetre = decimetre,
                // 毫米單位
                Millimeter = millimeter
            };
            // 填空項目(分米或者毫米)
            formula.Gap = gap;
        }
        /// <summary>
        /// 分米到釐米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(米或者釐米)</param>
        protected virtual void DecimetreConvertToCentimeter(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得分米數量級
            int decimetre = CommonUtil.GetRandomNumber(1, 10);
            // 轉換為釐米的換算
            int entimeter = decimetre * 10;
            // 隨機編排填空項目(是釐米還是分米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 分米單位
                Decimetre = decimetre,
                // 釐米單位
                Centimeter = entimeter
            };
            // 填空項目(米或者釐米)
            formula.Gap = gap;
        }
示例#17
0
        /// <summary>
        /// 元轉換為分
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(元或者分)</param>
        protected virtual void YuanConvertToFen(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得元數量級
            int yuan = CommonUtil.GetRandomNumber(1, 10);
            // 轉換為分的換算
            int fen = yuan * 100;
            // 隨機編排填空項目(是分還是元)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 分單位
                Fen = fen
            };
            // 填空項目(元或者分)
            formula.Gap = gap;
        }
示例#18
0
        /// <summary>
        /// 分轉換為元
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分或者元)</param>
        protected virtual void FenConvertToYuan(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得分數量級
            int fen = CommonUtil.GetRandomNumber(1, 10) * 100;
            // 轉換為元的換算
            int yuan = fen / 100;
            // 隨機編排填空項目(是角還是分)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 分單位
                Fen = fen
            };
            // 填空項目(分或者元)
            formula.Gap = gap;
        }
        /// <summary>
        /// 分米到米分米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分米或者米分米)</param>
        protected virtual void DecimetreConvertToMeterExt(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得米數量級
            int meter = CommonUtil.GetRandomNumber(1, 9);
            // 隨機取得分米數量級
            int remainderDecimetre = CommonUtil.GetRandomNumber(1, 9);
            // 隨機編排填空項目(是分米還是米分米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 分米單位
                Decimetre = meter * 10 + remainderDecimetre,
                // 米單位
                Meter = meter
            };
            // 剩餘的分米
            formula.RemainderDecimetre = remainderDecimetre;
            // 填空項目(分米或者米、分米)
            formula.Gap = gap;
        }
		/// <summary>
		/// 計算式HTML作成
		/// </summary>
		/// <param name="item">填空項目</param>
		/// <param name="parameter">計算式中的數值</param>
		/// <param name="gap">當前顯示項目所在計算式中的位置</param>
		/// <param name="index">控件索引號</param>
		/// <returns>HTML模板信息</returns>
		private string GetHtml(GapFilling item, int parameter, GapFilling gap, int index)
		{
			StringBuilder html = new StringBuilder();
			if (item == gap)
			{
				if (BrainpowerHint.FormulaIndex.Count > _brainpowerIndex && BrainpowerHint.FormulaIndex[_brainpowerIndex] == index)
				{
					html.AppendFormat(INPUT_HTML_FORMAT, index.ToString().PadLeft(2, '0'), string.Format(DIALOGUE_JS_HTML_FORMAT, _brainpowerIndex++));
				}
				else
				{
					html.AppendFormat(INPUT_HTML_FORMAT, index.ToString().PadLeft(2, '0'), string.Empty);
				}
				html.AppendFormat(ANSWER_HTML_FORMAT, index.ToString().PadLeft(2, '0'), Base64.EncodeBase64(parameter.ToString()));
			}
			else
			{
				html.AppendFormat(LABEL_HTML_FORMAT, parameter);
			}

			return html.ToString();
		}
示例#21
0
        /// <summary>
        /// 角轉換為元分
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(元分或者角)</param>
        protected virtual void JiaoConvertToYuanFen(LearnCurrencyFormula formula, QuestionType type)
        {
            // 隨機取得角數量級
            int jiao = CommonUtil.GetRandomNumber(1, 100);
            // 轉換為元的換算
            int yuan = Convert.ToInt32(Math.Floor(Convert.ToDecimal(jiao) / 10.0m));
            // 轉換為分的換算
            int fen = (jiao % 10) * 10;
            // 隨機編排填空項目(是角還是分)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.CurrencyUnit = new Currency()
            {
                // 元單位
                Yuan = yuan,
                // 角單位
                Jiao = jiao,
                // 分單位
                Fen = fen
            };
            // 填空項目(分或者角)
            formula.Gap = gap;
        }
        /// <summary>
        /// 分米到米釐米
        /// </summary>
        /// <param name="formula">計算式作成</param>
        /// <param name="type">填空項目選擇(分米或者米釐米)</param>
        protected virtual void DecimetreConvertToMeterCentimeter(LearnLengthUnitFormula formula, QuestionType type)
        {
            // 隨機取得分米數量級
            int decimetre = CommonUtil.GetRandomNumber(11, 99);
            // 轉換為米的換算
            int meter = decimetre / 10;
            // 轉換為釐米的換算
            int centimeter = decimetre % 10 * 10;
            // 隨機編排填空項目(是分米還是米分米)
            GapFilling gap = GetRandomGapFilling(type);

            // 結果對象設置并返回
            formula.LengthUnitItme = new LengthUnit()
            {
                // 分米單位
                Decimetre = decimetre,
                // 米單位
                Meter = meter,
                // 釐米單位
                Centimeter = centimeter
            };
            // 填空項目(分米或者米、釐米)
            formula.Gap = gap;
        }
        /// <summary>
        /// 題型HTML模板作成
        /// </summary>
        /// <param name="p">題型參數</param>
        /// <returns>HTML上下文內容</returns>
        public override string MakeHtmlContent(CurrencyOperationParameter p)
        {
            if (p.Formulas.Count == 0)
            {
                return(string.Empty);
            }

            int  numberOfColumns = 0;
            bool isRowHtmlClosed = false;

            int           controlIndex = 0;
            StringBuilder html         = new StringBuilder();
            StringBuilder rowHtml      = new StringBuilder();
            StringBuilder colHtml      = new StringBuilder();

            foreach (CurrencyOperationFormula item in p.Formulas)
            {
                isRowHtmlClosed = false;
                colHtml.AppendLine("<div class=\"col-md-6 form-inline\">");
                colHtml.AppendLine("<h6>");

                string     pIndex = controlIndex.ToString().PadLeft(2, '0');
                GapFilling gap    = item.CurrencyArithmetic.Gap;
                // 方程式左右是否互換位置
                if (item.AnswerIsRight)
                {
                    // 加數、被減數
                    colHtml.Append(GetHtml(gap == GapFilling.Left, item.CurrencyArithmetic.LeftParameter, pIndex));
                    // 算式運算符
                    colHtml.AppendLine(string.Format(LABEL_HTML_FORMAT, item.CurrencyArithmetic.Sign.ToOperationUnicode()));
                    // 加數、減數
                    colHtml.Append(GetHtml(gap == GapFilling.Right, item.CurrencyArithmetic.RightParameter, pIndex));
                    // 等號
                    colHtml.AppendLine(CALCULATOR_HTML);
                    // 和、差
                    colHtml.Append(GetHtml(gap == GapFilling.Answer, item.CurrencyArithmetic.Answer, pIndex));
                }
                else
                {
                    // 和、差
                    colHtml.Append(GetHtml(gap == GapFilling.Answer, item.CurrencyArithmetic.Answer, pIndex));
                    // 等號
                    colHtml.AppendLine(CALCULATOR_HTML);
                    // 加數、被減數
                    colHtml.Append(GetHtml(gap == GapFilling.Left, item.CurrencyArithmetic.LeftParameter, pIndex));
                    // 算式運算符
                    colHtml.AppendLine(string.Format(LABEL_HTML_FORMAT, item.CurrencyArithmetic.Sign.ToOperationUnicode()));
                    // 加數、減數
                    colHtml.Append(GetHtml(gap == GapFilling.Right, item.CurrencyArithmetic.RightParameter, pIndex));
                }

                colHtml.AppendLine("</h6>");
                colHtml.AppendLine("<div class=\"divCorrectOrFault-1\">");
                colHtml.AppendLine(string.Format(IMG_CURRENCY_OPERATION_HTML_FORMAT, "OK", pIndex, "correct", "imgCorrect-1"));
                colHtml.AppendLine(string.Format(IMG_CURRENCY_OPERATION_HTML_FORMAT, "No", pIndex, "fault", "imgFault-1"));
                colHtml.AppendLine("</div>");
                colHtml.AppendLine("</div>");

                controlIndex++;
                numberOfColumns++;
                if (numberOfColumns == 2)
                {
                    rowHtml.AppendLine("<div class=\"row text-center row-margin-top\">");
                    rowHtml.Append(colHtml.ToString());
                    rowHtml.AppendLine("</div>");

                    html.Append(rowHtml);

                    isRowHtmlClosed = true;
                    numberOfColumns = 0;
                    rowHtml.Length  = 0;
                    colHtml.Length  = 0;
                }
            }

            if (!isRowHtmlClosed)
            {
                rowHtml.AppendLine("<div class=\"row text-center row-margin-top\">");
                rowHtml.Append(colHtml.ToString());
                rowHtml.AppendLine("</div>");

                html.Append(rowHtml);
            }

            if (html.Length != 0)
            {
                html.Insert(0, "<div class=\"div-page-content\">").AppendLine();
                html.AppendLine().Append("</div>");
                html.Insert(0, string.Format(PAGE_HEADER_HTML_FORMAT, "CurrencyOperation", "貨幣運算"));
            }

            return(html.ToString());
        }
示例#24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <param name="parameter"></param>
 /// <param name="gap"></param>
 /// <returns></returns>
 public static string GetValue <T>(GapFilling item, T parameter, GapFilling gap)
 {
     return(item == gap?string.Format("[{0}]", parameter) : parameter.ToString());
 }