Пример #1
0
        // Token: 0x060000D6 RID: 214 RVA: 0x00015284 File Offset: 0x00013484
        protected override void View()
        {
            ExamQuestion examQuestion = DbHelper.ExecuteModel <ExamQuestion>(this.qid);

            if (examQuestion.id == 0)
            {
                this.ShowErrMsg("对不起,该题目不存在或已被删除。");
            }
            SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);

            if (sortInfo.id == 0)
            {
                this.ShowErrMsg("对不起,该题目题库不存在或已被删除。");
            }
            foreach (int num in FPUtils.SplitInt(sortInfo.parentlist))
            {
                if (num != 0)
                {
                    ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num);
                    if (examLogInfo.sortid == 0)
                    {
                        examLogInfo.sortid    = examQuestion.sortid;
                        examLogInfo.channelid = examQuestion.channelid;
                        examLogInfo.uid       = this.userid;
                        examLogInfo.notes     = 1;
                        examLogInfo.notelist  = this.qid.ToString();
                        if (num == sortInfo.id)
                        {
                            examLogInfo.curnotes = 1;
                        }
                        DbHelper.ExecuteInsert <ExamLogInfo>(examLogInfo);
                    }
                    else
                    {
                        if (!FPUtils.InArray(this.qid, examLogInfo.notelist))
                        {
                            examLogInfo.notes++;
                            ExamLogInfo examLogInfo2 = examLogInfo;
                            examLogInfo2.notelist += ((examLogInfo.notelist == "") ? this.qid.ToString() : ("," + this.qid.ToString()));
                            if (num != sortInfo.id)
                            {
                                examLogInfo.curnotes++;
                            }
                        }
                        DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo);
                    }
                }
            }
            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("qid", this.qid),
                DbHelper.MakeAndWhere("uid", this.userid)
            };
            ExamNote examNote = DbHelper.ExecuteModel <ExamNote>(sqlparams);

            examNote.uid  = this.userid;
            examNote.qid  = this.qid;
            examNote.note = this.note;
            if (examNote.id > 0)
            {
                DbHelper.ExecuteUpdate <ExamNote>(examNote);
            }
            else
            {
                DbHelper.ExecuteInsert <ExamNote>(examNote);
            }
            Hashtable hashtable = new Hashtable();

            hashtable["error"]   = 0;
            hashtable["message"] = "";
            base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            base.Response.Write(JsonMapper.ToJson(hashtable));
            base.Response.End();
        }
Пример #2
0
        // Token: 0x060000CB RID: 203 RVA: 0x0001420C File Offset: 0x0001240C
        protected override void View()
        {
            ExamQuestion examQuestion = DbHelper.ExecuteModel <ExamQuestion>(this.qid);

            if (examQuestion.id == 0)
            {
                this.ShowErrMsg("对不起,该题目不存在或已被删除。");
            }
            SortInfo sortInfo = SortBll.GetSortInfo(examQuestion.sortid);

            if (this.option == 1)
            {
                foreach (int num in FPUtils.SplitInt(sortInfo.parentlist))
                {
                    if (num != 0)
                    {
                        ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num);
                        if (examLogInfo.sortid == 0)
                        {
                            examLogInfo.sortid    = examQuestion.sortid;
                            examLogInfo.channelid = examQuestion.channelid;
                            examLogInfo.uid       = this.userid;
                            examLogInfo.favs      = 1;
                            if (num == sortInfo.id)
                            {
                                examLogInfo.curfavs = 1;
                            }
                            examLogInfo.favlist = this.qid.ToString();
                            DbHelper.ExecuteInsert <ExamLogInfo>(examLogInfo);
                        }
                        else
                        {
                            examLogInfo.favs++;
                            if (num == sortInfo.id)
                            {
                                examLogInfo.curfavs++;
                            }
                            ExamLogInfo examLogInfo2 = examLogInfo;
                            examLogInfo2.favlist += ((examLogInfo.favlist == "") ? this.qid.ToString() : ("," + this.qid.ToString()));
                            DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo);
                        }
                    }
                }
            }
            else if (this.option == -1)
            {
                foreach (int num in FPUtils.SplitInt(sortInfo.parentlist))
                {
                    if (num != 0)
                    {
                        ExamLogInfo examLogInfo = ExamBll.GetExamLogInfo(this.userid, num);
                        if (examLogInfo.sortid != 0)
                        {
                            if (FPUtils.InArray(this.qid, examLogInfo.favlist))
                            {
                                examLogInfo.favs--;
                                if (num == sortInfo.id)
                                {
                                    examLogInfo.curfavs--;
                                }
                                string text = "";
                                foreach (int num2 in FPUtils.SplitInt(examLogInfo.favlist))
                                {
                                    if (num2 != this.qid)
                                    {
                                        text += ((text == "") ? num2.ToString() : ("," + num2.ToString()));
                                    }
                                }
                                examLogInfo.favlist = text;
                                DbHelper.ExecuteUpdate <ExamLogInfo>(examLogInfo);
                            }
                        }
                    }
                }
            }
            Hashtable hashtable = new Hashtable();

            hashtable["error"]   = 0;
            hashtable["message"] = "";
            hashtable["action"]  = this.option;
            base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            base.Response.Write(JsonMapper.ToJson(hashtable));
            base.Response.End();
        }