Ejemplo n.º 1
0
            protected override ActionResult DoTask(string data)
            {
                int linkId = Convert.ToInt32(Request.QueryString["linkid"]);
                string[] param = StringUtility.Split(data, "%27");
                string shortDesc = Escape.JsUnEscape(param[0]);
                int diff = int.Parse(Escape.JsUnEscape(param[2]));
                string content = Escape.JsUnEscape(param[3]);
                string attached = Escape.JsUnEscape(param[4]);

                QuestionEntity entity = new QuestionEntity();
                entity.QuestionId = 0;
                entity.QuestionLinkId = linkId;
                entity.Fill();
                entity.QuestionLinkContent = content;
                entity.QuestionLinkDifficulty = diff;
                entity.QuestionLinkShortDescription = shortDesc;
                entity.QuestionLinkAttachedInfo = attached;
                entity.Save();
                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                return result;
            }
Ejemplo n.º 2
0
            protected override ActionResult DoTask(string data)
            {
                int questId = int.Parse(Request.QueryString["quesid"]);
                string[] param = StringUtility.Split(data, "%27");
                string shortDesc = Escape.JsUnEscape(param[0]);
                int score = int.Parse(Escape.JsUnEscape(param[1]));
                int diff = int.Parse(Escape.JsUnEscape(param[2]));
                string content = Escape.JsUnEscape(param[3]);
                string item = Escape.JsUnEscape(param[4]);
                string answer = Escape.JsUnEscape(param[5]);

                QuestionEntity entity = new QuestionEntity();
                entity.QuestionId = questId;
                entity.QuestionLinkId = 0;
                entity.Fill();
                entity.QuestionContent = content;
                entity.QuestionDifficulty = diff;
                entity.QuestionAnswer = answer;
                entity.QuestionScore = score;
                entity.QuestionShortDescription = shortDesc;
                entity.QuestionItem = item;
                entity.Save();
                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                return result;
            }
Ejemplo n.º 3
0
            protected override ActionResult DoTask(string data)
            {
                string[] param = StringUtility.Split(data, "%27");
                int historyId = Convert.ToInt32(Request.QueryString["history"]);
                int score = 0;
                int singscore = 0;
                int multiscore = 0;
                int julgscore = 0;

                DefaultEntity defaultEntity = new DefaultEntity();
                defaultEntity.DefaultType = DefaultTypeEnum.SingleSelect;
                defaultEntity.Fill();
                singscore = defaultEntity.DefaultScore;

                defaultEntity.DefaultType = DefaultTypeEnum.MultiSelect;
                defaultEntity.Fill();
                multiscore = defaultEntity.DefaultScore;

                defaultEntity.DefaultType = DefaultTypeEnum.JudgeSelect;
                defaultEntity.Fill();
                julgscore = defaultEntity.DefaultScore;

                foreach (string val in param)
                {
                    string txt = (val ?? string.Empty).Trim();
                    if (string.IsNullOrEmpty(txt))
                        continue;
                    string[] idandanswer = StringUtility.Split(txt, "%22");
                    QuestionEntity entity = new QuestionEntity();
                    entity.QuestionId = Convert.ToInt32(Escape.JsUnEscape(idandanswer[0]));
                    entity.Fill();
                    int itemScore = 0;
                    if (entity.QuestionAnswer.Equals(Escape.JsUnEscape(idandanswer[1])))
                        itemScore = entity.QuestionScore;
                    if (itemScore == 0)
                    {
                        switch (entity.QuestionType)
                        {
                            case QuestionTypeEnum.SingleSelect:
                                itemScore = singscore;
                                break;
                            case QuestionTypeEnum.JudgeSelect:
                                itemScore = julgscore;
                                break;
                            case QuestionTypeEnum.MultiSelect:
                                itemScore = multiscore;
                                break;
                        }
                    }
                    score = score + itemScore;
                }
                HistoryEntity history = new HistoryEntity();
                history.HistoryId = historyId;
                history.Fill();
                history.HistoryEndTime = DateTime.Now;
                history.HistoryScore = score;
                history.Save();

                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                StringBuilder response = new StringBuilder();
                response.Append(string.Format("TmpStr='{0}';", score));
                result.ResponseData = response.ToString();
                return result;
            }