Example #1
0
            protected override ActionResult DoTask(string data)
            {
                QuestionLinkTypeEnum linkType = (QuestionLinkTypeEnum)int.Parse(Request.QueryString["style"]);
                int linkId = 0;
                string[] blocks = StringUtility.Split(data, "%22");
                for (int i = 0; i < blocks.Length; i++)
                {
                    string block = blocks[i];
                    string[] param = StringUtility.Split(block, "%27");
                    if (i == 0)
                    {
                        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 linkEntity = new QuestionEntity();
                        linkEntity.QuestionLinkType = linkType;
                        linkEntity.QuestionLinkContent = content;
                        linkEntity.QuestionLinkDifficulty = diff;
                        linkEntity.QuestionLinkShortDescription = shortDesc;
                        linkEntity.QuestionLinkAttachedInfo = attached;
                        linkEntity.Save();
                        linkId = linkEntity.QuestionLinkId;
                    }
                    else
                    {
                        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]);
                        DefaultTypeEnum defaultType = (DefaultTypeEnum)int.Parse(Escape.JsUnEscape(param[6]));
                        if (score == 0)
                        {
                            DefaultEntity defaultEntity = new DefaultEntity();
                            defaultEntity.DefaultType = defaultType;
                            defaultEntity.Fill();
                            score = defaultEntity.DefaultScore;
                            if (score == 0)
                            {
                                switch (defaultType)
                                {
                                    case DefaultTypeEnum.SingleSelect:
                                        score = 2;
                                        break;
                                    case DefaultTypeEnum.MultiSelect:
                                        score = 4;
                                        break;
                                    case DefaultTypeEnum.JudgeSelect:
                                        score = 1;
                                        break;
                                }
                            }
                        }
                        QuestionEntity entity = new QuestionEntity();
                        entity.QuestionType = QuestionEntity.ConvertDefaultTypeToQuestionType(defaultType);
                        entity.QuestionLinkId = linkId;
                        entity.QuestionContent = content;
                        entity.QuestionDifficulty = diff;
                        entity.QuestionAnswer = answer;
                        entity.QuestionScore = score;
                        entity.QuestionShortDescription = shortDesc;
                        entity.QuestionItem = item;
                        entity.QuestionLinkType = QuestionLinkTypeEnum.Nothing;
                        entity.Save();
                    }
                }
                QuestionCollection collection = new QuestionCollection();
                collection.PageSize = 8;
                collection.AbsolutePage = 1;
                collection.IsReturnDataTable = true;
                collection.Fill();
                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.ResponseData = response.ToString();
                return result;
            }
Example #2
0
            protected override ActionResult DoTask(string data)
            {
                string sign = Request.QueryString["sign"];
                string condition = PageQuestionTaskUtility.ParseExpVal(sign, data);

                QuestionCollection collection = new QuestionCollection();
                collection.PageSize = 8;
                collection.AbsolutePage = 1;
                collection.IsReturnDataTable = true;
                collection.FillByCondition(condition);

                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
Example #3
0
            protected override ActionResult DoTask(string data)
            {
                string pageNoStr = Request.QueryString["pagenum"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;

                string condition = PageQuestionTaskUtility.ParseExpVal("0", "");
                QuestionCollection collection = new QuestionCollection();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                else
                {
                    collection.PageSize = 8;
                    collection.FillByCondition(condition);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
Example #4
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["pagenum"]);
                int linkId = Convert.ToInt32(Request.QueryString["subid"]);

                QuestionCollection collection = new QuestionCollection();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByLinkId(linkId);
                }
                else
                {
                    collection.PageSize = 4;
                    collection.FillByLinkId(linkId);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByLinkId(linkId);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable(), this.IsOtherRequest));
                if (this.IsOtherRequest)
                    response.Append(string.Format("STmpStr={0};", collection.PageCount));
                else
                    response.Append(string.Format("TmpStr={0};", collection.PageCount));

                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
Example #5
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["PageN"]);
                string linkStrIds = Request.QueryString["linkid"];
                int[] linkIds = StringUtility.SplitStringToIntArray(linkStrIds, ",");
                if (linkIds == null || linkIds.Length == 0)
                    linkIds = new int[] { -1 };
                string quesStrIds = Request.QueryString["quesid"];
                int[] quesIds = StringUtility.SplitStringToIntArray(quesStrIds, ",");
                if (quesIds == null || quesIds.Length == 0)
                    quesIds = new int[] { -1 };

                QuestionCollection collection = new QuestionCollection();
                collection.DeleteByQuestionIds(quesIds);
                collection.DeleteByLinkIds(linkIds);

                string condition = PageQuestionTaskUtility.CurrentExpVal();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                else
                {
                    collection.PageSize = 8;
                    collection.FillByCondition(condition);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
Example #6
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["pagenum"]);
                int linkId = Convert.ToInt32(Request.QueryString["subid"]);
                string delStrIds = Request.QueryString["ids"];

                string[] delStrIdCol = delStrIds.Split(',');
                List<int> delIds = new List<int>();
                foreach (string delStrId in delStrIdCol)
                {
                    string tmpDelIdStr = (delStrId ?? string.Empty).Trim();
                    if (string.IsNullOrEmpty(tmpDelIdStr))
                        continue;
                    else
                    {
                        int tmpDelId = 0;
                        if (int.TryParse(tmpDelIdStr, out tmpDelId))
                            delIds.Add(tmpDelId);
                        else
                            continue;
                    }
                }

                QuestionCollection collection = new QuestionCollection();
                collection.DeleteByQuestionIds(delIds.ToArray());

                collection.PageSize = 4;
                collection.FillByLinkId(linkId);
                if (pageNo > collection.PageCount)
                    pageNo = collection.PageCount;
                collection.AbsolutePage = pageNo;
                collection.IsReturnDataTable = true;
                collection.FillByLinkId(linkId);

                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }