예제 #1
0
        public static TestQuestionType toTestQuestionType(this string text)
        {
            TestQuestionType str = TestQuestionType.Custom;

            switch (text)
            {
            case "กำหนดเอง":
                str = TestQuestionType.Custom;
                break;

            case "สุ่ม":
                str = TestQuestionType.Random;
                break;

            case "0":
                str = TestQuestionType.Custom;
                break;

            case "1":
                str = TestQuestionType.Random;
                break;

            default:
                break;
            }
            return(str);
        }
예제 #2
0
        public override object Get()
        {
            var typeControl = H.l(LabelFor(x => x.Type), SelectFor(x => x.Type,
                                                                   NamedIdCache <TestQuestionType> .List, x => x.Name, x => x.Id));

            if (Model.Id > 0)
            {
                typeControl = H.l(LabelFor(x => x.Type), div.Class("editor-div")[
                                      TestQuestionType.GetName(Model.Type)], HiddenFor(x => x.Type));
            }
            return(l(
                       Tabs(_.List("Вопрос", "Файл"),
                            AjaxForm(Url.Action <TestEditController>(x => x.EditQuestion(null)))[
                                HiddenFor(x => x.Id),
                                HiddenFor(x => x.TestId),
                                ControlFor(x => x.Description),
                                typeControl,
                                Select2For(Model.TestModule.GetOrDefault(x => x.Name), x => x.ModuleId,
                                           Url.Action <TestEditController>(c => c.GetModulesAuto(Model.TestId, null))),
                                SaveButton()
                            ], TestControls.TestFileUpload(TestControls.QuestionFileView(Model.Id, true),
                                                           Url.Action <TestEditController>(c => c.UploadQuestionFile(Model.Id, null)),
                                                           Url.Action <TestEditController>(c => c.DeleteQuestionFile(Model.Id)),
                                                           Url.Action <TestEditController>(c => c.GetQuestionFileControl(Model.Id)),
                                                           Model.Id == 0
                                                           ))));
        }
예제 #3
0
        public static string toTestQuestionType(this TestQuestionType statusType)
        {
            string str = "";

            switch (statusType)
            {
            case TestQuestionType.Custom:
                str = "กำหนดเอง";
                break;

            case TestQuestionType.Random:
                str = "สุ่ม";
                break;

            default:
                break;
            }
            return(str);
        }