Ejemplo n.º 1
0
        protected override QuestionInputModel ConvertToDerived2(
            Yw_SubjectContent content)
        {
            var inputModel = new MultipleChoice();

            if (content != null)
            {
                var c = content as Yw_SubjectSelectContent;
                inputModel.StemType    = (UeditorType)c.Ysc_Content_Obj.StemType;
                inputModel.ContentType = (UeditorType)c.Ysc_Content_Obj.ContentType;
                inputModel.Display     = c.Ysc_Content_Obj.Display;
                UeditorType contentType = (UeditorType)c.Ysc_Content_Obj.ContentType;
                inputModel.Options = c.Ysc_Content_Obj.Options
                                     .Select(o => UeditorContentFactory.RestoreContent(o.Text, contentType)).ToList();
                inputModel.Random = c.Ysc_Content_Obj.Random;
                UeditorType t    = (UeditorType)c.Ysc_Content_Obj.StemType;
                string      name = UeditorContentFactory.RestoreContent(c.Ysc_Content_Obj.Stem, t);
                inputModel.Name    = name;
                inputModel.Answers = c.Ysc_Answer_Obj.Answers;
            }
            else
            {
                inputModel.StemType    = UeditorType.Text;
                inputModel.ContentType = UeditorType.Text;
                inputModel.Display     = 1;
                inputModel.Options     = new List <string>();
                inputModel.Random      = 1;
                inputModel.Name        = string.Empty;
                inputModel.Answers     = new List <int>();
            }

            return(inputModel);
        }
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            TrueFalse           subject        = sub as TrueFalse;
            Yw_TrueFalseContent derivedContent = null;

            if (content == null)
            {
                derivedContent = new Yw_TrueFalseContent();
                derivedContent.Ysc_CreateTime  = DateTime.Now;
                derivedContent.Ysc_Creator     = currentUser;
                derivedContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                derivedContent = content as Yw_TrueFalseContent;
            }
            derivedContent.Ysc_Editor      = currentUser;
            derivedContent.Ysc_Explain     = subject.Explain;
            derivedContent.Ysc_Content_Obj = new TrueFalseContentObj
            {
                StemType = (int)subject.StemType,
                Stem     = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType)
            };
            derivedContent.Ysc_Answer_Obj = new TrueFalseAnswerObj
            {
                Answer = subject.Answer
            };
            derivedContent.Ysc_UpdateTime = DateTime.Now;

            return(derivedContent);
        }
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            FillInBlank           subject        = sub as FillInBlank;
            Yw_FillInBlankContent derivedContent = null;

            if (content == null)
            {
                derivedContent = new Yw_FillInBlankContent();
                derivedContent.Ysc_CreateTime  = DateTime.Now;
                derivedContent.Ysc_Creator     = currentUser;
                derivedContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                derivedContent = content as Yw_FillInBlankContent;
            }
            derivedContent.Ysc_Editor      = currentUser;
            derivedContent.Ysc_Explain     = subject.Explain;
            derivedContent.Ysc_Content_Obj = new FillInBlankContentObj
            {
                Stem = UeditorContentFactory.Blank(subject.Name)
            };
            derivedContent.Ysc_Answer_Obj = new FillInBlankAnswerObj
            {
                Correct = subject.Correct.Blanks,
                Other   = subject.Other.Blanks,
                Perfect = subject.Perfect.Blanks
            };
            derivedContent.Ysc_UpdateTime = DateTime.Now;
            return(derivedContent);
        }
Ejemplo n.º 4
0
 private static void RestoreUrl(List <SubjectOption> options, UeditorType type)
 {
     options.ForEach((o) =>
     {
         o.Text = UeditorContentFactory.RestoreUrl(o.Text, type);
     });
 }
        public void UeditorContentFactory_RestoreContent_ReturnFullPath()
        {
            string name    = "<p><img src=\"http://abhstest.oss-cn-beijing.aliyuncs.com/QuestionDatabase/298e6150c1174043b655967dd4430099.jpg\" /></p>";
            string content = "/QuestionDatabase/298e6150c1174043b655967dd4430099.jpg";
            string url     = UeditorContentFactory.RestoreContent(content, Domain.Enum.UeditorType.Image);

            Assert.AreEqual(name, url);
        }
Ejemplo n.º 6
0
        public void UeditorContentFactory_RestoreBlank_ShouldReturnCorrect2()
        {
            string content = "<p>{:}{:}{:}{:}{:}</p>";
            string result  = UeditorContentFactory.RestoreBlank(content);

            Assert.IsNotNull(result);
            Console.WriteLine(result);
        }
        public ActionResult AddCoverImage(CoverImageInputModel input)
        {
            CourseBll bll    = new CourseBll();
            string    imgUrl = UeditorContentFactory.FetchUrl(
                input.CoverImage, UeditorType.Image);

            bll.AddCoverImage(input.CourseId, imgUrl);
            return(Json(new SuccessJsonResponse()));
        }
Ejemplo n.º 8
0
        public void UeditorContentFactory_Blank_ReturnVirtualPath()
        {
            string name   = "<p>sfsfsfssf<input type=\"button\" data-num=\"376\" onclick=\"parent.showDialog(this)\" value=\"答案\"/>sfsfssfsfsfsfsfsfsfs<input type=\"button\" data-num=\"736\" onclick=\"parent.showDialog(this)\" value=\"答案\"/>sfdd</p>";
            string result = UeditorContentFactory.Blank(name);

            if (result.Contains("<input type="))
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 9
0
        public void UeditorContentFactory_FetchUrl_ReturnVirtualPath()
        {
            string name = "<p><img src=\"http://abhstest.oss-cn-beijing.aliyuncs.com/QuestionDatabase/298e6150c1174043b655967dd4430099.jpg\" title=\"800x400.jpg\" alt=\"800x400.jpg\"/></p>";

            string url = UeditorContentFactory.FetchUrl(name, Domain.Enum.UeditorType.Image);

            if (url.Contains(".aliyuncs.com"))
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 10
0
        public ActionResult Pricing(CoursePricingInputModel input)
        {
            CourseBll bll = new CourseBll();

            input.CoverIamge = UeditorContentFactory.FetchUrl(
                input.CoverIamge, UeditorType.Image);
            DtoCoursePricing price = input.ConvertTo <DtoCoursePricing>();

            bll.Pricing(price, CurrentUserID);
            return(Json(new SuccessJsonResponse()));
        }
Ejemplo n.º 11
0
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            MultipleChoice          subject       = sub as MultipleChoice;
            Yw_SubjectSelectContent selectContent = null;

            if (content == null)
            {
                selectContent = new Yw_SubjectSelectContent();
                selectContent.Ysc_CreateTime  = DateTime.Now;
                selectContent.Ysc_Creator     = currentUser;
                selectContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                selectContent = content as Yw_SubjectSelectContent;
            }
            selectContent.Ysc_Editor  = currentUser;
            selectContent.Ysc_Explain = subject.Explain;
            if (subject.ContentType == UeditorType.Image)
            {
                subject.Options = subject.Options.Select(o =>
                                                         UeditorContentFactory.FetchUrl(o, subject.ContentType)).ToList();
            }
            var options = subject.Options
                          .Select((o, i) => new SubjectOption {
                Text = o, Key = i
            })
                          .ToList();

            selectContent.Ysc_Answer_Obj = new SubjectSelectAnswerObj
            {
                Answers = subject.Answers
            };
            string stem = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType);

            selectContent.Ysc_Content_Obj = new SubjectSelectContentObj
            {
                StemType    = (int)subject.StemType,
                Stem        = stem,
                ContentType = (int)subject.ContentType,
                Options     = options,
                Display     = subject.Display,
                Random      = subject.Random
            };
            selectContent.Ysc_UpdateTime = DateTime.Now;

            return(selectContent);
        }
Ejemplo n.º 12
0
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            TrueFalse           inputModel = new TrueFalse();
            Yw_TrueFalseContent c          = content as Yw_TrueFalseContent;

            inputModel.Answer   = c.Ysc_Answer_Obj.Answer;
            inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
            inputModel.Name     = UeditorContentFactory.RestoreContent(
                c.Ysc_Content_Obj.Stem,
                inputModel.StemType);
            return(inputModel);
        }
Ejemplo n.º 13
0
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            var inputModel = new Free();
            var c          = content as Yw_SubjectFreeContent;

            inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
            inputModel.Name     = UeditorContentFactory.RestoreContent(
                c.Ysc_Content_Obj.Stem,
                inputModel.StemType);
            inputModel.Answer     = c.Ysc_Answer_Obj.Answer;
            inputModel.ScoreRules = c.Ysc_Content_Obj.ScoreRules;
            return(inputModel);
        }
Ejemplo n.º 14
0
        public ActionResult GetDetails(int id)
        {
            CourseBll bll        = new CourseBll();
            var       dtoDetails = bll.GetDetailOfManagements(id);
            var       vm         = dtoDetails.ConvertTo <CurriculumDetailsViewModel>(
                PropertyNamePrefixAction.Remove);

            vm.CoverImage = UeditorContentFactory.RestoreUrl(vm.CoverImage, UeditorType.Image);
            SuccessJsonResponse response = new SuccessJsonResponse {
                Data = vm
            };

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 15
0
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            var inputModel = new Mark();
            var c          = content as Yw_SubjectMarkContent;

            inputModel.Color     = c.Ysc_Content_Obj.Color;
            inputModel.Content   = c.Ysc_Content_Obj.Content;
            inputModel.Alignment = c.Ysc_Content_Obj.Alignment;
            inputModel.StemType  = (UeditorType)c.Ysc_Content_Obj.StemType;
            inputModel.Name      = UeditorContentFactory.RestoreContent(
                c.Ysc_Content_Obj.Stem,
                inputModel.StemType);
            return(inputModel);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 课程制作详情视图动作
        /// </summary>
        /// <returns></returns>
        public ActionResult MakeInfo(int id = 0)
        {
            CourseBll bll   = new CourseBll();
            var       model = bll.GetDetails(id);

            var vm = model.ConvertTo <CurriculumDetailsViewModel>(
                PropertyNamePrefixAction.Remove);

            vm.CoverImage = UeditorContentFactory.RestoreUrl(
                vm.CoverImage, UeditorType.Image);
            if (model != null)
            {
                return(View(vm));
            }
            else
            {
                return(View(new CurriculumDetailsViewModel()));
            }
        }
Ejemplo n.º 17
0
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            var inputModel = new Match();
            var c          = content as Yw_MatchContent;

            inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
            inputModel.TitleOptionContentType   = (UeditorType)c.Ysc_Content_Obj.LeftOptionContentType;
            inputModel.AnswertOptionContentType = (UeditorType)c.Ysc_Content_Obj.RightOptionContentType;
            inputModel.Title = c.Ysc_Content_Obj.LeftOptions.Select(s =>
                                                                    UeditorContentFactory.RestoreContent(s.Text, inputModel.TitleOptionContentType)).ToList();
            inputModel.LinedAnswers = c.Ysc_Answer_Obj.Answers.Select(s => s[1]).ToList();
            inputModel.Answer       = c.Ysc_Content_Obj.RightOptions.Select(s =>
                                                                            UeditorContentFactory.RestoreContent(s.Text, inputModel.AnswertOptionContentType)).ToList();
            inputModel.Name = UeditorContentFactory.RestoreContent(
                c.Ysc_Content_Obj.Stem,
                inputModel.StemType);
            return(inputModel);
        }
Ejemplo n.º 18
0
        protected override QuestionInputModel ConvertToDerived2(Yw_SubjectContent content)
        {
            TrueFalse inputModel = new TrueFalse();

            if (content != null)
            {
                Yw_TrueFalseContent c = content as Yw_TrueFalseContent;
                inputModel.Answer   = c.Ysc_Answer_Obj.Answer;
                inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
                inputModel.Name     = UeditorContentFactory.RestoreContent(
                    c.Ysc_Content_Obj.Stem,
                    inputModel.StemType);
            }
            else
            {
                inputModel.StemType = UeditorType.Text;
                inputModel.Name     = string.Empty;
                inputModel.Answer   = 1;
            }
            return(inputModel);
        }
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            var inputModel = new MultipleChoiceFillInBlank();
            var c          = content as MultipleChoiceFillInBlankContent;

            inputModel.AnswerIndexes = new List <int>();
            UeditorType type = (UeditorType)c.Ysc_Content_Obj.ContentType;

            inputModel.Options = c.Ysc_Content_Obj.SubjectOptions.Select(o =>
                                                                         UeditorContentFactory.RestoreContent(o.Text, type)).ToList();
            inputModel.Goptions = c.Ysc_Content_Obj.SubjectGOptions.Select(o =>
                                                                           UeditorContentFactory.RestoreContent(o.Text, type)).ToList();
            inputModel.Name        = c.Ysc_Content_Obj.Stem;
            inputModel.ContentType = (UeditorType)c.Ysc_Content_Obj.ContentType;
            //inputModel.GPositions = new List<int>();
            //foreach (var item in c.Ysc_Content_Obj.GPositions)
            //{
            //    inputModel.GPositions.Add(item.Key);
            //}
            return(inputModel);
        }
Ejemplo n.º 20
0
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            Mark2 subject = sub as Mark2;
            Yw_SubjectMark2Content selectContent = null;

            if (content == null)
            {
                selectContent = new Yw_SubjectMark2Content();
                selectContent.Ysc_CreateTime  = DateTime.Now;
                selectContent.Ysc_Creator     = currentUser;
                selectContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                selectContent = content as Yw_SubjectMark2Content;
            }
            selectContent.Ysc_Editor      = currentUser;
            selectContent.Ysc_Explain     = subject.Explain;
            selectContent.Ysc_Content_Obj = new SubjectMark2ContentObj
            {
                Alignment = subject.Alignment,
                Color     = subject.Color,
                Content   = subject.Content,
                Stem      = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType),
                StemType  = (int)subject.StemType
            };

            selectContent.Ysc_Answer_Obj = new SubjectMark2AnswerObj
            {
                Answers = GenareteAnswers(subject.Content)
            };
            selectContent.Ysc_UpdateTime = DateTime.Now;

            return(selectContent);
        }
Ejemplo n.º 21
0
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            Free subject = sub as Free;
            Yw_SubjectFreeContent selectContent = null;

            if (content == null)
            {
                selectContent = new Yw_SubjectFreeContent();
                selectContent.Ysc_CreateTime  = DateTime.Now;
                selectContent.Ysc_Creator     = currentUser;
                selectContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                selectContent = content as Yw_SubjectFreeContent;
            }
            selectContent.Ysc_Editor     = currentUser;
            selectContent.Ysc_Explain    = subject.Explain;
            selectContent.Ysc_Answer_Obj = new SubjectFreeAnswerObj
            {
                Answer = subject.Answer
            };
            selectContent.Ysc_Content_Obj = new SubjectFreeContentObj
            {
                ScoreRules = subject.ScoreRules,
                Stem       = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType),
                StemType   = (int)subject.StemType
            };
            selectContent.Ysc_UpdateTime = DateTime.Now;

            return(selectContent);
        }
Ejemplo n.º 22
0
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            Match           subject       = sub as Match;
            Yw_MatchContent selectContent = null;

            if (content == null)
            {
                selectContent = new Yw_MatchContent();
                selectContent.Ysc_CreateTime  = DateTime.Now;
                selectContent.Ysc_Creator     = currentUser;
                selectContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                selectContent = content as Yw_MatchContent;
            }
            selectContent.Ysc_Editor  = currentUser;
            selectContent.Ysc_Explain = subject.Explain;
            List <SubjectOption> left = new List <SubjectOption>();

            if (subject.Title != null)
            {
                left = subject.Title.Select((t, i) => new SubjectOption
                {
                    Text = UeditorContentFactory.FetchUrl(t, subject.TitleOptionContentType),
                    Key  = i
                }).ToList();
            }
            List <SubjectOption> right = new List <SubjectOption>();

            if (subject.Answer != null)
            {
                right = subject.Answer.Select((t, i) => new SubjectOption
                {
                    Text = UeditorContentFactory.FetchUrl(t, subject.AnswertOptionContentType),
                    Key  = i
                }).ToList();
            }
            selectContent.Ysc_Content_Obj = new MatchContentObj
            {
                Stem                   = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType),
                LeftOptions            = left,
                RightOptions           = right,
                StemType               = (int)subject.StemType,
                LeftOptionContentType  = (int)subject.TitleOptionContentType,
                RightOptionContentType = (int)subject.AnswertOptionContentType
            };
            List <int[]> dics = new List <int[]>();

            if (subject.LinedAnswers != null)
            {
                for (int i = 0; i < subject.LinedAnswers.Count; i++)
                {
                    int[] d = new int[2] {
                        i, subject.LinedAnswers[i]
                    };

                    dics.Add(d);
                }
            }
            selectContent.Ysc_Answer_Obj = new MatchAnswerObj
            {
                Answers = dics
            };
            selectContent.Ysc_UpdateTime = DateTime.Now;

            return(selectContent);
        }
Ejemplo n.º 23
0
        public static SubjectVm Create(Yw_SubjectContent content)
        {
            Check.IfNull(content, nameof(content));

            SubjectVm       vm          = null;
            SubjectTypeEnum subjectType = (SubjectTypeEnum)content.Ysc_SubjectType;

            switch (subjectType)
            {
            case SubjectTypeEnum.择题:
                Yw_SubjectSelectContent select = content as Yw_SubjectSelectContent;
                var random   = select.Ysc_Content_Obj.Random;
                var mOptions = select.Ysc_Content_Obj.Options;
                if (random == 1)    //随机显示
                {
                    mOptions = mOptions.OrderBy(c => Guid.NewGuid()).ToList();
                }
                vm = new MultipleChoiceSubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = select.Ysc_Explain,
                    Answer      = select.Ysc_Answer_Obj.Answers,
                    StemType    = select.Ysc_Content_Obj.StemType,
                    Stem        = select.Ysc_Content_Obj.Stem,
                    Options     = mOptions,
                    OptionType  = select.Ysc_Content_Obj.ContentType,
                    SubjectType = select.Ysc_SubjectType,
                    Display     = select.Ysc_Content_Obj.Display
                };
                break;

            case SubjectTypeEnum.判断题:
                Yw_TrueFalseContent trueFalse = content as Yw_TrueFalseContent;
                vm = new TrueFalseSubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = trueFalse.Ysc_Explain,
                    Answer      = trueFalse.Ysc_Answer_Obj.Answer,
                    StemType    = trueFalse.Ysc_Content_Obj.StemType,
                    Stem        = trueFalse.Ysc_Content_Obj.Stem,
                    SubjectType = trueFalse.Ysc_SubjectType
                };
                break;

            case SubjectTypeEnum.填空题:
                Yw_FillInBlankContent fillInBlank = content as Yw_FillInBlankContent;
                string blankStem = UeditorContentFactory.Blank(
                    fillInBlank.Ysc_Content_Obj.Stem);
                vm = new FillInBlankSubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = fillInBlank.Ysc_Explain,
                    Answer      = new
                    {
                        Perfect = fillInBlank.Ysc_Answer_Obj.Perfect,
                        Correct = fillInBlank.Ysc_Answer_Obj.Correct,
                        Other   = fillInBlank.Ysc_Answer_Obj.Other
                    },
                    StemType    = (int)UeditorType.Text,
                    Stem        = blankStem,
                    SubjectType = fillInBlank.Ysc_SubjectType
                };
                break;

            case SubjectTypeEnum.择填空:
                MultipleChoiceFillInBlankContent multipleChoiceFillInBlank = content as MultipleChoiceFillInBlankContent;
                List <SubjectOption>             options = new List <SubjectOption>();
                options.AddRange(multipleChoiceFillInBlank.Ysc_Content_Obj.SubjectOptions);
                options.AddRange(multipleChoiceFillInBlank.Ysc_Content_Obj.SubjectGOptions);
                UeditorType contentType =
                    (UeditorType)multipleChoiceFillInBlank.Ysc_Content_Obj.ContentType;
                RestoreUrl(options, contentType);
                options = options.OrderBy(c => Guid.NewGuid()).ToList();
                string mBlankStem = UeditorContentFactory.Blank(
                    multipleChoiceFillInBlank.Ysc_Content_Obj.Stem);
                vm = new MultipleChoiceFillInBlankSubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = multipleChoiceFillInBlank.Ysc_Explain,
                    Answer      = multipleChoiceFillInBlank.Ysc_Answer_Obj.Answers,
                    StemType    = (int)UeditorType.Text,
                    Stem        = mBlankStem,
                    Options     = options,
                    OptionType  = multipleChoiceFillInBlank.Ysc_Content_Obj.ContentType,
                    SubjectType = multipleChoiceFillInBlank.Ysc_SubjectType
                };
                break;

            case SubjectTypeEnum.连线题:
                Yw_MatchContent match = content as Yw_MatchContent;

                var contentObj = match.Ysc_Content_Obj;

                var leftOptions = new List <SubjectOption>();
                leftOptions.AddRange(contentObj.LeftOptions);
                RestoreUrl(leftOptions, (UeditorType)contentObj.LeftOptionContentType);
                leftOptions = leftOptions.OrderBy(c => Guid.NewGuid()).ToList();

                var rightOptions = new List <SubjectOption>();
                rightOptions.AddRange(contentObj.RightOptions);
                RestoreUrl(rightOptions, (UeditorType)contentObj.RightOptionContentType);
                rightOptions = rightOptions.OrderBy(c => Guid.NewGuid()).ToList();
                vm           = new MatchSubjectVm
                {
                    KnowledgeId     = 0,
                    Analysis        = match.Ysc_Explain,
                    Answer          = match.Ysc_Answer_Obj.Answers,
                    StemType        = contentObj.StemType,
                    Stem            = contentObj.Stem,
                    LeftOptions     = leftOptions,
                    RightOptions    = rightOptions,
                    SubjectType     = match.Ysc_SubjectType,
                    LeftOptionType  = match.Ysc_Content_Obj.LeftOptionContentType,
                    RightOptionType = match.Ysc_Content_Obj.RightOptionContentType
                };
                break;

            case SubjectTypeEnum.主观题:
                Yw_SubjectFreeContent free = content as Yw_SubjectFreeContent;
                string freeAnswer          = free.Ysc_Answer_Obj.Answer;
                if (free.Ysc_Content_Obj.AnswerType == (int)UeditorType.Image)
                {
                    freeAnswer = ConfigurationManager.AppSettings["OssHostUrl"]
                                 + freeAnswer;
                }

                string freeStandard = free.Ysc_Content_Obj.ScoreRules;
                if (free.Ysc_Content_Obj.ScoreRulesType == (int)UeditorType.Image)
                {
                    freeStandard = ConfigurationManager.AppSettings["OssHostUrl"]
                                   + freeStandard;
                }

                string freeStem = free.Ysc_Content_Obj.Stem;
                if (free.Ysc_Content_Obj.StemType == (int)UeditorType.Image)
                {
                    freeStem = ConfigurationManager.AppSettings["OssHostUrl"]
                               + freeStem;
                }
                vm = new FreeSubjectVm
                {
                    KnowledgeId  = 0,
                    Analysis     = free.Ysc_Explain,
                    Answer       = freeAnswer,
                    AnswerType   = free.Ysc_Content_Obj.AnswerType,
                    StemType     = free.Ysc_Content_Obj.StemType,
                    Stem         = freeStem,
                    SubjectType  = free.Ysc_SubjectType,
                    Standard     = freeStandard,
                    StandardType = free.Ysc_Content_Obj.ScoreRulesType
                };
                break;

            case SubjectTypeEnum.圈点批注标色:
                Yw_SubjectMarkContent mark = content as Yw_SubjectMarkContent;
                string stem = mark.Ysc_Content_Obj.Stem;
                if (mark.Ysc_Content_Obj.StemType == (int)UeditorType.Image)
                {
                    stem = ConfigurationManager.AppSettings["OssHostUrl"]
                           + stem;
                }
                string markContent = mark.Ysc_Content_Obj.Content?
                                     .Replace("{:", string.Empty)
                                     .Replace("{:", string.Empty)
                                     .Replace("}", string.Empty);

                vm = new MarkSubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = mark.Ysc_Explain,
                    Answer      = mark.Ysc_Answer_Obj.Answers,
                    StemType    = mark.Ysc_Content_Obj.StemType,
                    Stem        = stem,
                    SubjectType = mark.Ysc_SubjectType,
                    Content     = markContent,
                    Color       = mark.Ysc_Content_Obj.Color
                };
                break;

            case SubjectTypeEnum.圈点批注断句:
                Yw_SubjectMark2Content mark2 = content as Yw_SubjectMark2Content;
                string mark2Stem             = mark2.Ysc_Content_Obj.Stem;
                if (mark2.Ysc_Content_Obj.StemType == (int)UeditorType.Image)
                {
                    mark2Stem = ConfigurationManager.AppSettings["OssHostUrl"]
                                + mark2Stem;
                }
                string mark2Content = mark2.Ysc_Content_Obj.Content?
                                      .Replace("/", string.Empty);
                vm = new Mark2SubjectVm
                {
                    KnowledgeId = 0,
                    Analysis    = mark2.Ysc_Explain,
                    Answer      = mark2.Ysc_Answer_Obj.Answers,
                    StemType    = mark2.Ysc_Content_Obj.StemType,
                    Stem        = mark2Stem,
                    SubjectType = mark2.Ysc_SubjectType,
                    Content     = mark2Content,
                    Color       = mark2.Ysc_Content_Obj.Color
                };
                break;

            default:
                break;
            }

            return(vm);
        }
Ejemplo n.º 24
0
 protected override string FormatReadonlyStem(string stem)
 {
     return(UeditorContentFactory.FormatReadonlyStem(stem));
 }
Ejemplo n.º 25
0
 protected override string FormatStem(string stem)
 {
     return(UeditorContentFactory.RestoreBlank(stem));
 }
        protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            MultipleChoiceFillInBlank        subject       = sub as MultipleChoiceFillInBlank;
            MultipleChoiceFillInBlankContent selectContent = null;

            if (content == null)
            {
                selectContent = new MultipleChoiceFillInBlankContent();
                selectContent.Ysc_CreateTime  = DateTime.Now;
                selectContent.Ysc_Creator     = currentUser;
                selectContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                selectContent = content as MultipleChoiceFillInBlankContent;
            }
            selectContent.Ysc_Editor  = currentUser;
            selectContent.Ysc_Explain = subject.Explain;
            List <int[]> anses = new List <int[]>();

            if (subject.Options != null)
            {
                for (int i = 0; i < subject.Options.Count; i++)
                {
                    int[] ds = new int[2] {
                        i, i
                    };
                    anses.Add(ds);
                }
            }
            selectContent.Ysc_Answer_Obj = new MultipleChoiceFillInBlankAnswerObj
            {
                Answers = anses
            };

            //答案的选项
            List <SubjectOption> subjectOptions = new List <SubjectOption>();

            if (subject.Options != null)
            {
                for (int i = 0; i < subject.Options.Count; i++)
                {
                    subjectOptions.Add(new SubjectOption
                    {
                        Key  = i,
                        Text = UeditorContentFactory.FetchUrl(subject.Options[i],
                                                              subject.ContentType)
                    });
                }
            }

            //干扰项
            List <SubjectOption> subjectGOptions = new List <SubjectOption>();

            if (subject.Goptions != null)
            {
                for (int i = 0; i < subject.Goptions.Count; i++)
                {
                    subjectGOptions.Add(new SubjectOption
                    {
                        Key  = i + 100,//干扰项的key设置值
                        Text = UeditorContentFactory.FetchUrl(subject.Goptions[i],
                                                              subject.ContentType)
                    });
                }
            }
            selectContent.Ysc_Content_Obj = new MultipleChoiceFillInBlankContentObj
            {
                Stem            = UeditorContentFactory.Blank(subject.Name),
                ContentType     = (int)subject.ContentType,
                SubjectOptions  = subjectOptions,
                SubjectGOptions = subjectGOptions,
                //GPositions = gps
            };

            selectContent.Ysc_UpdateTime = DateTime.Now;

            return(selectContent);
        }