public static System.Web.WebPages.HelperResult Block(AbstractQuestionBlock block, BlockRenderContext context)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var mark = "";
	var style = "";
	QuizBlockData model = context.GetBlockData(block);
	if (model.QuizState != QuizState.NotPassed)
	{
		if (model.QuizModel != null && model.QuizModel.ResultsForQuizes != null)
		{
			bool res;
			res = model.QuizModel.ResultsForQuizes.TryGetValue(block.Id, out res) && res;
			mark = "glyphicon " + (res ? "glyphicon-ok" : "glyphicon-remove");
			style = "color: " + (res ? "green" : "red");
		}
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<h4><i class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, mark);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" style=\"");


WebViewPage.WriteTo(@__razor_helper_writer, style);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i> ");


WebViewPage.WriteTo(@__razor_helper_writer, block.QuestionIndex);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". ");


                     WebViewPage.WriteTo(@__razor_helper_writer, block.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n");


	
WebViewPage.WriteTo(@__razor_helper_writer, QuizBlock((dynamic)block, context));

                                    

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<hr class=\"quiz-block-delimiter\"/>\r\n");



});

}
Example #2
0
public static System.Web.WebPages.HelperResult Block(AbstractQuestionBlock block, BlockRenderContext context, HtmlHelper Html)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {


 
	var mark = "";
	var style = "";
	var blockScore = -1;
	QuizBlockData model = context.GetBlockData(block);
	if (model.QuizState != QuizState.NotPassed && model.QuizState != QuizState.WaitForCheck && model.QuizState != QuizState.IsChecking)
	{
		if (model.QuizModel != null && model.QuizModel.ResultsForQuizes != null)
		{
			var res = model.QuizModel.ResultsForQuizes.TryGetValue(block.Id, out blockScore) && blockScore == block.MaxScore;
			mark = "glyphicon " + (res ? "glyphicon-ok" : "glyphicon-remove");
			style = "color: " + (res ? "green" : "red");
		}
	}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<h4>\r\n\t\t<i class=\"");


WebViewPage.WriteTo(@__razor_helper_writer, mark);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" style=\"");


WebViewPage.WriteTo(@__razor_helper_writer, style);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\"></i> ");


WebViewPage.WriteTo(@__razor_helper_writer, block.QuestionIndex);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, ". ");


                  WebViewPage.WriteTo(@__razor_helper_writer, block.Text.RenderTex());

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t<sup class=\"text-muted\">\r\n");


 			if (blockScore >= 0)
			{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t\t<span>\r\n\t\t\t\t\t");


WebViewPage.WriteTo(@__razor_helper_writer, blockScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " из ");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, " балл");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore == 1 ? "а" : "ов");

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t</span>\r\n");


			}
			else
			{
				
WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore.PluralizeInRussian(new RussianPluralizationOptions
					{
						One = "балл",
						Two = "балла",
						Five = "баллов",
						smallNumbersAreWords = false,
						hideNumberOne = false
					}
				));

     
			}

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t</sup>\r\n\t</h4>\r\n");



	
WebViewPage.WriteTo(@__razor_helper_writer, QuizBlock((dynamic)block, context));

                                    
	if (context.ManualChecking != null)
	{

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<h4>Оцените от 0 до ");


WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</h4>\r\n");



WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t<div>\r\n\t\t\t<input type=\"number\" class=\"form-control\" min=\"0\" max=\"");


               WebViewPage.WriteTo(@__razor_helper_writer, block.MaxScore);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" name=\"quiz__score__");


                                                    WebViewPage.WriteTo(@__razor_helper_writer, block.Id);

WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" />\r\n\t\t</div>\r\n");


	}


WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<div class=\"quiz-block-delimiter\"></div>\r\n");



});

}