Пример #1
0
        /// <summary>
        /// 界面无需使用此方法
        /// </summary>
        /// <returns></returns>
        public 试题内容表 类映射表赋值()
        {
            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = 30;
            content.难易度 = this.难易度;

            for (int i = 0; i < this.连线题左选项集合.Count; i++)
            {
                连线题选项表 choice = new 连线题选项表();
                choice.ID = this.连线题左选项集合[i].ID;
                choice.连线标记 = 0;
                choice.顺序 = Convert.ToByte(i);
                choice.选项内容HTML = this.连线题左选项集合[i].选项内容HTML;
                choice.选项内容文本 = this.连线题左选项集合[i].选项内容文本;
                content.连线题选项表.Add(choice);
            }
            for (int j = 0; j < this.连线题右选项集合.Count; j++)
            {
                连线题选项表 rightChoice = new 连线题选项表();
                rightChoice.ID = this.连线题右选项集合[j].ID;
                rightChoice.连线标记 = 1;
                rightChoice.顺序 = Convert.ToByte(j);
                rightChoice.选项内容HTML = this.连线题右选项集合[j].选项内容HTML;
                rightChoice.选项内容文本 = this.连线题右选项集合[j].选项内容文本;
                content.连线题选项表.Add(rightChoice);
            }
            for (int k = 0; k < this.连线题答案集合.Count; k++)
            {
                连线题答案表 answer = new 连线题答案表();
                answer.ID = Guid.NewGuid();
                answer.顺序 = Convert.ToByte(k);
                answer.右边ID = this.连线题答案集合[k].连线题右选项ID;
                answer.左边ID = this.连线题答案集合[k].连线题左选项ID;
                content.连线题答案表.Add(answer);
            }
            content.Json字符串 = this.转化成Json带答案();
            content.爱考网ID = this.爱考网ID;
            return content;
        }
Пример #2
0
        /// <summary>
        /// 界面无需使用此方法
        /// </summary>
        /// <returns></returns>
        public 试题内容表 类映射表赋值()
        {
            试题内容表 problemContent = new 试题内容表();
            problemContent.ID = this.ID;
            problemContent.操作人ID = this.操作人ID;
            problemContent.操作时间 = DateTime.Now;
            problemContent.解题思路 = this.解题思路;
            problemContent.试题外部信息ID = this.试题外部信息ID;
            problemContent.题干HTML = this.题干HTML;
            problemContent.题干文本 = this.题干文本;
            problemContent.小题型Enum = 15;
            problemContent.难易度 = this.难易度;

            for (int i = 0; i < this.单选空格集合.Count; i++)
            {
                this.单选空格集合[i].ID = Guid.NewGuid();
                自由题选项组表 choiceGroup = new 自由题选项组表();
                choiceGroup.ID = Guid.NewGuid();
                for (int j = 0; j < this.单选空格集合[i].选项组.选项集合.Count; j++)
                {
                    自由题选项表 choice = new 自由题选项表();
                    choice.ID = this.单选空格集合[i].选项组.选项集合[j].ID;
                    choice.顺序 = Convert.ToByte(j);
                    choice.选项内容HTML = this.单选空格集合[i].选项组.选项集合[j].选项内容HTML;
                    choice.选项内容文本 = this.单选空格集合[i].选项组.选项集合[j].选项内容文本;
                    choiceGroup.自由题选项表.Add(choice);
                }
                自由题选项空格答案表 answer = new 自由题选项空格答案表();
                answer.ID = Guid.NewGuid();
                answer.顺序 = 0;
                answer.自由题选项ID = this.单选空格集合[i].答案ID;

                自由题空格表 space = new 自由题空格表();
                space.ID = this.单选空格集合[i].ID;
                space.空格类型 = 0;
                space.顺序 = Convert.ToByte(i);
                space.自由题选项组表 = choiceGroup;
                space.自由题选项空格答案表.Add(answer);
                problemContent.自由题空格表.Add(space);
            }
            problemContent.Json字符串 = this.转化成Json带答案();
            problemContent.爱考网ID = this.爱考网ID;
            return problemContent;
        }
Пример #3
0
        /// <summary>
        /// 界面无需使用此方法
        /// </summary>
        /// <returns></returns>
        public 试题内容表 类映射表赋值()
        {
            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = 13;
            content.难易度 = this.难易度;

            for (int i = 0; i < this.填空空格集合.Count; i++)
            {
                this.填空空格集合[i].ID = Guid.NewGuid();
                自由题空格表 space = new 自由题空格表();
                space.ID = this.填空空格集合[i].ID;
                space.空格类型 = 2;
                space.顺序 = Convert.ToByte(i);
                for (int j = 0; j < this.填空空格集合[i].填空空格答案集合.Count; j++)
                {
                    自由题填空答案表 answer = new 自由题填空答案表();
                    answer.ID = Guid.NewGuid();
                    answer.该空答案 = this.填空空格集合[i].填空空格答案集合[j].答案内容;
                    answer.顺序 = Convert.ToByte(j);
                    space.自由题填空答案表.Add(answer);
                }
                content.自由题空格表.Add(space);
            }
            content.Json字符串 = this.转化成Json带答案();
            content.爱考网ID = this.爱考网ID;
            return content;
        }
Пример #4
0
        /// <summary>
        /// 界面无需使用此方法
        /// </summary>
        /// <returns></returns>
        public 试题内容表 类映射表赋值()
        {
            判断题答案表 answer = new 判断题答案表();
            answer.答案 = this.答案;

            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = 20;
            content.判断题答案表 = answer;
            content.Json字符串 = this.转化成Json带答案();
            content.爱考网ID = this.爱考网ID;
            content.难易度 = this.难易度;

            return content;
        }
Пример #5
0
        /// <summary>
        /// 界面无需使用此方法
        /// </summary>
        /// <returns></returns>
        public 试题内容表 类映射表赋值()
        {
            自由题选项组表 choiceGroup = new 自由题选项组表();
            choiceGroup.ID = Guid.NewGuid();
            for (int i = 0; i < this.选项列表.Count; i++)
            {
                自由题选项表 choice = new 自由题选项表();
                choice.ID = this.选项列表[i].ID;
                choice.选项内容HTML = this.选项列表[i].选项内容HTML;
                if (this.选项列表[i].选项内容文本.Length > 1024)
                {
                    this.选项列表[i].选项内容文本 = this.选项列表[i].选项内容文本.Substring(0, 1024);
                }
                choice.选项内容文本 = this.选项列表[i].选项内容文本;
                choice.顺序 = Convert.ToByte(i);
                choiceGroup.自由题选项表.Add(choice);
            }

            自由题空格表 space = new 自由题空格表();
            space.ID = Guid.NewGuid();
            space.空格类型 = 0;
            space.自由题选项组表 = choiceGroup;

            for (int j = 0; j < 答案列表.Count; j++)
            {
                自由题选项空格答案表 answer = new 自由题选项空格答案表();
                answer.ID = Guid.NewGuid();
                answer.自由题选项ID = 答案列表[j];
                space.自由题选项空格答案表.Add(answer);
            }

            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = 12;
            content.Json字符串 = this.转化成Json带答案();
            content.爱考网ID = this.爱考网ID;
            content.难易度 = this.难易度;
            content.自由题空格表.Add(space);

            return content;
        }
Пример #6
0
        public override void 保存(LoveKaoExamEntities db, string Json字符串)
        {
            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = this.小题型Enum;
            content.难易度 = this.难易度;
            JObject bo = JObject.Parse(Json字符串);
            for (int i = 0; i < this.子小题集合.Count; i++)
            {
                switch (this.子小题集合[i].小题型Enum)
                {
                    //单选题
                    case 11:
                        {
                            string singleJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            单选题 single = jss.Deserialize<单选题>(singleJson);
                            单选题.给单选题选项赋值新ID(single);
                            single.操作人ID = this.操作人ID;
                            single.试题外部信息ID = this.试题外部信息ID;
                            single.父试题内容ID = content.ID;
                            single.爱考网ID = this.子小题集合[i].爱考网ID;
                            single.ID = this.子小题集合[i].ID;
                            试题内容表 singleContent = single.类映射表赋值();
                            singleContent.父试题内容ID = content.ID;
                            singleContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(singleContent);
                            break;
                        }
                    //多选题
                    case 12:
                        {
                            string multiJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            多选题 multi = jss.Deserialize<多选题>(multiJson);
                            多选题.给多选题选项赋值新ID(multi);
                            multi.操作人ID = this.操作人ID;
                            multi.试题外部信息ID = this.试题外部信息ID;
                            multi.父试题内容ID = content.ID;
                            multi.爱考网ID = this.子小题集合[i].爱考网ID;
                            multi.ID = this.子小题集合[i].ID;
                            试题内容表 multiContent = multi.类映射表赋值();
                            multiContent.父试题内容ID = content.ID;
                            multiContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(multiContent);
                            break;
                        }
                    //填空题
                    case 13:
                        {
                            string fillJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            填空题 fill = jss.Deserialize<填空题>(fillJson);
                            fill.操作人ID = this.操作人ID;
                            fill.试题外部信息ID = this.试题外部信息ID;
                            fill.父试题内容ID = content.ID;
                            fill.爱考网ID = this.子小题集合[i].爱考网ID;
                            fill.ID = this.子小题集合[i].ID;
                            试题内容表 fillContent = fill.类映射表赋值();
                            fillContent.父试题内容ID = content.ID;
                            fillContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(fillContent);
                            break;
                        }
                    case 14:
                        {
                            string dictionJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            选词填空 diction = jss.Deserialize<选词填空>(dictionJson);
                            选词填空.给选词填空选项赋值新ID(diction);
                            diction.操作人ID = this.操作人ID;
                            diction.试题外部信息ID = this.试题外部信息ID;
                            diction.父试题内容ID = content.ID;
                            diction.爱考网ID = this.子小题集合[i].爱考网ID;
                            diction.ID = this.子小题集合[i].ID;
                            试题内容表 dictionContent = diction.类映射表赋值();
                            dictionContent.父试题内容ID = content.ID;
                            dictionContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(dictionContent);
                            break;
                        }
                    case 15:
                        {
                            string clozeJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            完形填空 cloze = jss.Deserialize<完形填空>(clozeJson);
                            完形填空.给完形填空选项赋值新ID(cloze);
                            cloze.操作人ID = this.操作人ID;
                            cloze.试题外部信息ID = this.试题外部信息ID;
                            cloze.父试题内容ID = content.ID;
                            cloze.爱考网ID = this.子小题集合[i].爱考网ID;
                            cloze.ID = this.子小题集合[i].ID;
                            试题内容表 clozeContent = cloze.类映射表赋值();
                            clozeContent.父试题内容ID = content.ID;
                            clozeContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(clozeContent);
                            break;
                        }
                    //判断题
                    case 20:
                        {
                            string singleJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            判断题 judge = jss.Deserialize<判断题>(singleJson);
                            judge.操作人ID = this.操作人ID;
                            judge.试题外部信息ID = this.试题外部信息ID;
                            judge.父试题内容ID = content.ID;
                            judge.爱考网ID = this.子小题集合[i].爱考网ID;
                            judge.ID = this.子小题集合[i].ID;
                            试题内容表 judgeContent = judge.类映射表赋值();
                            judgeContent.父试题内容ID = content.ID;
                            judgeContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(judgeContent);
                            break;
                        }
                    case 30:
                        {
                            string linkJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            连线题 link = jss.Deserialize<连线题>(linkJson);
                            连线题.给连线题选项赋值新ID(link);
                            link.操作人ID = this.操作人ID;
                            link.试题外部信息ID = this.试题外部信息ID;
                            link.父试题内容ID = content.ID;
                            link.爱考网ID = this.子小题集合[i].爱考网ID;
                            link.ID = this.子小题集合[i].ID;
                            试题内容表 linkContent = link.类映射表赋值();
                            linkContent.父试题内容ID = content.ID;
                            linkContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(linkContent);
                            break;
                        }
                    //问答题
                    case 60:
                    case 61:
                    case 62:
                    case 63:
                    case 64:
                    case 65:
                    case 66:
                    case 67:
                    case 68:
                    case 69:
                        {
                            string questionAnswerJson = bo["子小题集合"][i].ToString();
                            JavaScriptSerializer jss = new JavaScriptSerializer();
                            问答题 questionAnswer = jss.Deserialize<问答题>(questionAnswerJson);
                            questionAnswer.操作人ID = this.操作人ID;
                            questionAnswer.试题外部信息ID = this.试题外部信息ID;
                            questionAnswer.父试题内容ID = content.ID;
                            questionAnswer.爱考网ID = this.子小题集合[i].爱考网ID;
                            questionAnswer.ID = this.子小题集合[i].ID;
                            试题内容表 questionAnswerContent = questionAnswer.类映射表赋值();
                            questionAnswerContent.父试题内容ID = content.ID;
                            questionAnswerContent.本题在复合题中顺序 = Convert.ToByte(i);
                            content.试题内容表1.Add(questionAnswerContent);
                            break;
                        }

                }
            }
            content.Json字符串 = this.转化成Json带答案();
            content.爱考网ID = this.爱考网ID;
            db.试题内容表.AddObject(content);
            db.SaveChanges();
        }
        public override void 保存(LoveKaoExamEntities db, string Json字符串)
        {
            试题内容表 content = new 试题内容表();
            content.ID = this.ID;
            content.操作人ID = this.操作人ID;
            content.操作时间 = DateTime.Now;
            content.解题思路 = this.解题思路;
            content.试题外部信息ID = this.试题外部信息ID;
            content.题干HTML = this.题干HTML;
            content.题干文本 = this.题干文本;
            content.小题型Enum = this.小题型Enum;
            content.爱考网ID = this.爱考网ID;
            content.难易度 = this.难易度;

            for (int i = 0; i < this.子小题集合.Count; i++)
            {
                this.子小题集合[i].本题在复合题中顺序 = Convert.ToByte(i);
                this.子小题集合[i].ID = Guid.NewGuid();
            }
            var subContentGroup = this.子小题集合.GroupBy(a => a.选项组ID).ToList();
            for (int j = 0; j < subContentGroup.Count; j++)
            {
                自由题选项组表 dbGroup = new 自由题选项组表();
                dbGroup.ID = subContentGroup[j].Key;
                选项组 newGroup = new 选项组();
                foreach (选项组 group in this.选项组集合)
                {
                    if (subContentGroup[j].Key == group.ID)
                    {
                        newGroup = group;
                    }
                }
                for (int k = 0; k < newGroup.选项集合.Count; k++)
                {
                    自由题选项表 choice = new 自由题选项表();
                    choice.ID = newGroup.选项集合[k].ID;
                    choice.顺序 = Convert.ToByte(k);
                    choice.选项内容HTML = newGroup.选项集合[k].选项内容HTML;
                    choice.选项内容文本 = newGroup.选项集合[k].选项内容文本;
                    dbGroup.自由题选项表.Add(choice);
                }

                subContentGroup[j].ElementAt(0).父试题内容ID = content.ID;
                试题内容表 dbSubContent = new 试题内容表();
                dbSubContent.ID = subContentGroup[j].ElementAt(0).ID;
                dbSubContent.操作人ID = this.操作人ID;
                dbSubContent.操作时间 = DateTime.Now;
                dbSubContent.解题思路 = subContentGroup[j].ElementAt(0).解题思路;
                dbSubContent.试题外部信息ID = this.试题外部信息ID;
                dbSubContent.题干HTML = subContentGroup[j].ElementAt(0).题干HTML;
                dbSubContent.题干文本 = subContentGroup[j].ElementAt(0).题干文本;
                dbSubContent.小题型Enum = subContentGroup[j].ElementAt(0).小题型Enum;
                dbSubContent.本题在复合题中顺序 = subContentGroup[j].ElementAt(0).本题在复合题中顺序;
                dbSubContent.父试题内容ID = content.ID;
                dbSubContent.Json字符串 = subContentGroup[j].ElementAt(0).转化成Json带答案();
                dbSubContent.爱考网ID = subContentGroup[j].ElementAt(0).爱考网ID;

                自由题选项空格答案表 answer = new 自由题选项空格答案表();
                answer.ID = Guid.NewGuid();
                answer.自由题选项ID = subContentGroup[j].ElementAt(0).答案ID;

                自由题空格表 space = new 自由题空格表();
                space.ID = Guid.NewGuid();
                space.空格类型 = 0;
                space.顺序 = 0;
                space.自由题选项组表 = dbGroup;
                space.自由题选项空格答案表.Add(answer);
                dbSubContent.自由题空格表.Add(space);
                content.试题内容表1.Add(dbSubContent);

                for (int m = 1; m < subContentGroup[j].Count(); m++)
                {
                    subContentGroup[j].ElementAt(m).父试题内容ID = content.ID;
                    试题内容表 dbSubContent1 = new 试题内容表();
                    dbSubContent1.ID = subContentGroup[j].ElementAt(m).ID;
                    dbSubContent1.操作人ID = this.操作人ID;
                    dbSubContent1.操作时间 = DateTime.Now;
                    dbSubContent1.解题思路 = subContentGroup[j].ElementAt(m).解题思路;
                    dbSubContent1.试题外部信息ID = this.试题外部信息ID;
                    dbSubContent1.题干HTML = subContentGroup[j].ElementAt(m).题干HTML;
                    dbSubContent1.题干文本 = subContentGroup[j].ElementAt(m).题干文本;
                    dbSubContent1.小题型Enum = subContentGroup[j].ElementAt(m).小题型Enum;
                    dbSubContent1.本题在复合题中顺序 = subContentGroup[j].ElementAt(m).本题在复合题中顺序;
                    dbSubContent1.父试题内容ID = content.ID;
                    dbSubContent1.Json字符串 = subContentGroup[j].ElementAt(m).转化成Json带答案();
                    dbSubContent1.爱考网ID = subContentGroup[j].ElementAt(m).爱考网ID;

                    自由题选项空格答案表 answer1 = new 自由题选项空格答案表();
                    answer1.ID = Guid.NewGuid();
                    answer1.自由题选项ID = subContentGroup[j].ElementAt(m).答案ID;

                    自由题空格表 space1 = new 自由题空格表();
                    space1.ID = Guid.NewGuid();
                    space1.空格类型 = 0;
                    space1.顺序 = 0;
                    space1.自由题选项组ID = newGroup.ID;
                    space1.自由题选项空格答案表.Add(answer1);
                    dbSubContent1.自由题空格表.Add(space1);
                    content.试题内容表1.Add(dbSubContent1);
                }
            }
            content.Json字符串 = this.转化成Json带答案();
            db.试题内容表.AddObject(content);
            db.SaveChanges();
        }
 /// <summary>
 /// 用于向 试题内容表 EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTo试题内容表(试题内容表 试题内容表)
 {
     base.AddObject("试题内容表", 试题内容表);
 }
 /// <summary>
 /// 创建新的 试题内容表 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="解题思路">解题思路 属性的初始值。</param>
 /// <param name="题干HTML">题干HTML 属性的初始值。</param>
 /// <param name="题干文本">题干文本 属性的初始值。</param>
 /// <param name="试题外部信息ID">试题外部信息ID 属性的初始值。</param>
 /// <param name="操作时间">操作时间 属性的初始值。</param>
 /// <param name="操作人ID">操作人ID 属性的初始值。</param>
 /// <param name="小题型Enum">小题型Enum 属性的初始值。</param>
 /// <param name="本题在复合题中顺序">本题在复合题中顺序 属性的初始值。</param>
 /// <param name="json字符串">Json字符串 属性的初始值。</param>
 /// <param name="爱考网ID">爱考网ID 属性的初始值。</param>
 /// <param name="难易度">难易度 属性的初始值。</param>
 public static 试题内容表 Create试题内容表(global::System.Guid id, global::System.String 解题思路, global::System.String 题干HTML, global::System.String 题干文本, global::System.Guid 试题外部信息ID, global::System.DateTime 操作时间, global::System.Guid 操作人ID, global::System.Int32 小题型Enum, global::System.Byte 本题在复合题中顺序, global::System.String json字符串, global::System.Guid 爱考网ID, global::System.Decimal 难易度)
 {
     试题内容表 试题内容表 = new 试题内容表();
     试题内容表.ID = id;
     试题内容表.解题思路 = 解题思路;
     试题内容表.题干HTML = 题干HTML;
     试题内容表.题干文本 = 题干文本;
     试题内容表.试题外部信息ID = 试题外部信息ID;
     试题内容表.操作时间 = 操作时间;
     试题内容表.操作人ID = 操作人ID;
     试题内容表.小题型Enum = 小题型Enum;
     试题内容表.本题在复合题中顺序 = 本题在复合题中顺序;
     试题内容表.Json字符串 = json字符串;
     试题内容表.爱考网ID = 爱考网ID;
     试题内容表.难易度 = 难易度;
     return 试题内容表;
 }