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); }
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); }
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); }
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); }
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); }
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); }
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); }