Exemple #1
0
 ActionResult IAction.DoAction(string actionType, string actionData)
 {
     if (this._isLogin)
     {
         UserEntity entity = SessionManager.User;
         if (entity == null)
         {
             ActionResult result = new ActionResult();
             result.IsSuccess = false;
             result.ResponseData = "location.href='login.aspx?text=2';";
             return result;
         }
         if (this._operationUserLevels != null)
         {
             bool isOperation = false;
             foreach (UserLevelType userLevel in this._operationUserLevels)
             {
                 if (entity.UserLevel == userLevel)
                 {
                     isOperation = true;
                     break;
                 }
             }
             if (!isOperation)
             {
                 ActionResult result = new ActionResult();
                 result.IsSuccess = false;
                 result.TipMessage = "对不起!<br>您没有此功能的操作权限";
                 return result;
             }
         }
     }
     actionData = actionData ?? string.Empty;
     ITask task = this.GetActionTask(actionType);
     if (task == null)
     {
         ActionResult result = new ActionResult();
         result.IsSuccess = false;
         result.TipMessage = "指令发送有误请重新操作";
         return result;
     }
     if (task.IsEscape)
         actionData = Escape.JsUnEscape(actionData);
     task.CurrentContext = this._context;
     task.IsOtherRequest = this._isOther;
     return task.DoTask(actionData);
 }
Exemple #2
0
            protected override ActionResult DoTask(string data)
            {
                ActionResult result = new ActionResult();
                result.IsSuccess = false;

                string[] param = data.Split('\'');
                string number = param[0];
                string password = EncryptMD5.MD5to16Code(param[1]);
                string validateCode = param[2];

                if (!SessionManager.ValidateCode.Equals(validateCode))
                    throw new ActionParseException("您的验证码输入有误");

                UserEntity entity = new UserEntity();
                entity.UserNo = number;
                entity.Password = password;
                entity.FillByUserNoAndPassword();
                if (entity.EntityState != DataFrameworkLibrary.Core.EntityState.Inserted)
                    throw new ActionParseException("用户编号或者对应密码错误");

                if (entity.IsLogin == false || entity.UserLevel == UserLevelType.Admin)
                {
                    entity.IsLogin = true;
                    entity.Save();

                    SessionManager.User = entity;
                    SessionManager.UserExp = "";
                    SessionManager.ClientIp = getUserClientIP();

                    StringBuilder response = new StringBuilder();
                    response.Append("Lock = false;");
                    response.Append("top.location.href = 'welcome.aspx';");
                    result.ResponseData = response.ToString();
                    result.IsSuccess = true;
                }
                else
                    throw new ActionParseException("您的帐号已在登陆状态,请不要连续登陆系统!");
                return result;
            }
            protected override ActionResult DoTask(string data)
            {
                ActionResult result = new ActionResult();
                result.IsSuccess = false;
                string[] param = StringUtility.Split(data, "%27");
                string username = Escape.JsUnEscape(param[0]);
                string password = EncryptMD5.MD5to16Code(Escape.JsUnEscape(param[1]));
                string oldpassword = EncryptMD5.MD5to16Code(Escape.JsUnEscape(param[2]));
                int id = int.Parse(Request.QueryString["id"]);

                UserEntity entity = SessionManager.User;
                if (entity.UserId != id)
                    throw new ActionParseException("您准备编辑的用户不是您自己的当前用户");
                if (!entity.Password.ToLower().Equals(oldpassword.ToLower()))
                    throw new ActionParseException("您输入的原始密码有误");
                if (!string.IsNullOrEmpty(username))
                    entity.UserName = username;
                if (!string.IsNullOrEmpty(password))
                    entity.Password = password;
                entity.Save();
                result.IsSuccess = true;
                return result;
            }
            protected override ActionResult DoTask(string data)
            {
                string[] param = StringUtility.Split(data, "%27");
                int userid = int.Parse(Escape.JsUnEscape(param[0]));
                string usernum = Escape.JsUnEscape(param[1]);
                string username = Escape.JsUnEscape(param[2]);
                UserLevelType usertype = (UserLevelType)int.Parse(Escape.JsUnEscape(param[3]));
                bool userlogin = StringUtility.ConvertBool(Escape.JsUnEscape(param[4]));
                bool usertest = StringUtility.ConvertBool(Escape.JsUnEscape(param[5]));
                string password = EncryptMD5.MD5to16Code(Escape.JsUnEscape(param[6]));

                UserEntity entity = new UserEntity();
                if (!string.IsNullOrEmpty(usernum))
                {
                    entity.UserNo = usernum;
                    entity.FillByUserNo();
                    if (entity.EntityState == DataFrameworkLibrary.Core.EntityState.Inserted)
                        throw new ActionParseException("系统不允许定义<br>两个编号相同的用户");
                }

                bool isChange = false;
                if (usertype == UserLevelType.Admin)
                    isChange = true;
                else
                {
                    UserCollection userCollection = new UserCollection();
                    userCollection.FillByUserLevel(UserLevelType.Admin);
                    if (userCollection.Count == 1)
                    {
                        if (userCollection[0].UserId == userid)
                            throw new ActionParseException("系统不允许移出最后一位<br>进行人员管理的用户权限");
                        else
                            isChange = true;
                    }
                    else
                        isChange = true;
                }
                if (isChange)
                {
                    entity = new UserEntity();
                    entity.UserId = userid;
                    entity.Fill();
                    if (entity.EntityState == DataFrameworkLibrary.Core.EntityState.Inserted)
                    {
                        if (!string.IsNullOrEmpty(usernum))
                            entity.UserNo = usernum;
                        if (!string.IsNullOrEmpty(password))
                            entity.Password = password;
                        entity.UserName = username;
                        entity.UserLevel = usertype;
                        entity.IsLogin = userlogin;
                        entity.DoTest = usertest;
                        entity.Save();

                        UserEntity sessionEntity = SessionManager.User;
                        if (sessionEntity != null && sessionEntity.UserId == entity.UserId)
                        {
                            SessionManager.User = entity;
                        }
                    }
                }
                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                return result;
            }
            protected override ActionResult DoTask(string data)
            {
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();

                string delStrIds = Request.QueryString["id"];
                string pageNoStr = Request.QueryString["PageN"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;
                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;
                    }
                }
                string flag = "";
                int currentId = (SessionManager.User == null) ? 0 : SessionManager.User.UserId;
                bool isFilter = this.filterIds(delIds, currentId);
                if (isFilter)
                {
                    if (string.IsNullOrEmpty(flag))
                        flag = "1";
                    else
                        flag = flag + "1";
                }
                UserCollection userCollection = new UserCollection();
                userCollection.FillByUserLevel(UserLevelType.Admin);
                if (userCollection.Count == 1)
                {
                    currentId = userCollection[0].UserId;
                    isFilter = this.filterIds(delIds, currentId);
                    if (isFilter)
                    {
                        if (string.IsNullOrEmpty(flag))
                            flag = "2";
                        else
                            flag = flag + "2";
                    }
                }
                if (delIds.Count == 0)
                {
                    if (string.IsNullOrEmpty(flag))
                        flag = "3";
                    else
                        flag = flag + "3";
                }
                else
                {
                    int[] ids = delIds.ToArray();
                    userCollection.DeleteByUserIds(ids);
                    HistoryCollection historyCollection = new HistoryCollection();
                    historyCollection.DeleteByUserIds(ids);

                    string condition = PageManageTaskUtility.CurrentExpVal();
                    userCollection.PageSize = 6;
                    userCollection.FillByCondition(condition);
                    if (pageNo > userCollection.PageCount)
                        pageNo = userCollection.PageCount;
                    userCollection.AbsolutePage = pageNo;
                    userCollection.IsReturnDataTable = true;
                    userCollection.FillByCondition(condition);

                    response.Append(ActionTaskUtility.ReturnClientDataArray(userCollection.GetFillDataTable()));
                    flag = flag + "|" + userCollection.PageCount;
                }
                result.IsSuccess = true;
                response.Append(string.Format("TmpStr='{0}';", flag));
                result.ResponseData = response.ToString();
                return result;
            }
            protected override ActionResult DoTask(string data)
            {
                string delStrIds = Request.QueryString["id"];
                string pageNoStr = Request.QueryString["PageN"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;
                int userId = 0;
                if (!int.TryParse(data, out userId))
                    userId = 0;
                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;
                    }
                }
                HistoryCollection collection = new HistoryCollection();
                collection.DeleteByHistoryIds(delIds.ToArray());

                collection.PageSize = 6;
                collection.FillByUserId(userId);
                if (pageNo > collection.PageCount)
                    pageNo = collection.PageCount;
                collection.AbsolutePage = pageNo;
                collection.IsReturnDataTable = true;
                collection.FillByUserId(userId);

                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;
            }
            protected override ActionResult DoTask(string data)
            {
                string pageNoStr = Request.QueryString["pagenum"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;

                string condition = PageHistoryTaskUtility.CurrentExpVal();
                HistoryCollection historyCollection = new HistoryCollection();
                if (pageNo == 0)
                {
                    historyCollection.PageSize = 0;
                    historyCollection.IsReturnDataTable = true;
                    historyCollection.FillByCondition(condition);
                }
                else
                {
                    historyCollection.PageSize = 10;
                    historyCollection.FillByCondition(condition);
                    if (pageNo > historyCollection.PageCount)
                        pageNo = historyCollection.PageCount;
                    historyCollection.AbsolutePage = pageNo;
                    historyCollection.IsReturnDataTable = true;
                    historyCollection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(historyCollection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", historyCollection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
            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;
            }
            protected override ActionResult DoTask(string data)
            {
                string sign = Request.QueryString["sign"];
                string condition = PageManageTaskUtility.ParseExpVal(sign, data);

                UserCollection collection = new UserCollection();
                collection.PageSize = 6;
                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;
            }
            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;
            }
            protected override ActionResult DoTask(string data)
            {
                string[] param = StringUtility.Split(data, "'");
                int uploadMaxSize = Convert.ToInt32(param[0]);
                int sessionTime = Convert.ToInt32(param[1]);
                int examineTime = Convert.ToInt32(param[2]);
                int examineQuestion = Convert.ToInt32(param[3]);

                SettingConfigUtility.UploadFileMaxSize = uploadMaxSize;
                SettingConfigUtility.SessionTimeout = sessionTime;
                SettingConfigUtility.ExaminationTime = examineTime;
                SettingConfigUtility.ExaminationQuestion = examineQuestion;

                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                return result;
            }
            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;
            }
            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;
            }
        void IHttpHandler.ProcessRequest(HttpContext context)
        {
            context.Response.AddHeader("Pragma", "no-cache");
            context.Response.AddHeader("Cache-Control", "no-cache");
            context.Response.Expires = 0;
            context.Response.Charset = "utf-8";
            context.Response.ContentType = "text/plain";

            ActionResult result = null;
            bool isOther = false;
            try
            {
                string other = (context.Request.QueryString["os"] as string ?? string.Empty).Trim();
                isOther = ("1".Equals(other));
                string action = (context.Request.QueryString["action"] as string ?? string.Empty).Trim();
                if (!string.IsNullOrEmpty(action))
                {
                    string typeStr = string.Format("ExamineSystem.action.{0}, ExamineSystem", action);
                    Type type = Type.GetType(typeStr, false, true);
                    if (type == null)
                    {
                        string error = string.Format("Missing Action Class With FullName {0}.", typeStr);
                        throw new ArgumentException(error, "action");
                    }
                    IAction instance = Activator.CreateInstance(type, true) as IAction;
                    if (instance == null)
                    {
                        string error = string.Format("Action Class ({0}) No Implements ExamineSystem.action.inner.IAction.", typeStr);
                        throw new ArgumentException(error, "action");
                    }
                    instance.CurrentContext = context;
                    instance.IsOtherRequest = isOther;
                    string actionData = GetOriginalData(context.Request);
                    string actionType = (context.Request.QueryString["type"] ?? string.Empty).Trim();
                    result = instance.DoAction(actionType, actionData);
                }
                else
                {
                    throw new ArgumentException("Missing Action Param.", "action");
                }
            }
            catch (ActionParseException e)
            {
                logger.Error(e.InnerException ?? e);
                result = new ActionResult();
                result.IsSuccess = false;
                result.TipMessage = e.ShowMessage;
            }
            catch (ActionHandlerParseException e)
            {
                logger.Error(e.InnerException ?? e);
                result = new ActionResult();
                result.IsSuccess = false;
                result.TipMessage = e.ShowMessage;
            }
            catch (Exception e)
            {
                logger.Error(e);
                result = new ActionResult();
                result.IsSuccess = false;
            }
            this.RenderAction(context.Response, result, isOther);
        }
 private void RenderAction(HttpResponse response, ActionResult result, bool isOther)
 {
     bool isSuccess = false;
     string message = "系统运行出现未知严重错误";
     string responseData = string.Empty;
     if (result != null)
     {
         isSuccess = result.IsSuccess;
         responseData = (result.ResponseData ?? string.Empty).Trim();
         if (!isSuccess)
         {
             string mess = (result.TipMessage ?? string.Empty).Trim();
             message = string.IsNullOrEmpty(mess) ? message : mess;
         }
     }
     StringBuilder output = new StringBuilder();
     output.Append(string.Format("{0} = {1};", (isOther) ? "Ssign" : "sign", (isSuccess) ? "true" : "false"));
     output.Append(responseData);
     if (!isSuccess)
     {
         if (!isOther)
             output.Append(string.Format("BadInfo = '{0}<br>请重新操作!';", message));
     }
     response.ClearContent();
     response.Write(Escape.JsEscape(output.ToString()));
     response.End();
 }
            protected override ActionResult DoTask(string data)
            {
                string pageNoStr = Request.QueryString["pagenum"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;
                int userId = 0;
                if (!int.TryParse(data, out userId))
                    userId = 0;

                HistoryCollection collection = new HistoryCollection();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByUserId(userId);
                }
                else
                {
                    collection.PageSize = 6;
                    collection.FillByUserId(userId);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByUserId(userId);
                }
                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;
            }
            protected override ActionResult DoTask(string data)
            {
                string pageNoStr = Request.QueryString["pagenum"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;

                string condition = PageManageTaskUtility.ParseExpVal("0", "");
                UserCollection userCollection = new UserCollection();
                if (pageNo == 0)
                {
                    userCollection.PageSize = 0;
                    userCollection.IsReturnDataTable = true;
                    userCollection.FillByCondition(condition);
                }
                else
                {
                    userCollection.PageSize = 6;
                    userCollection.FillByCondition(condition);
                    if (pageNo > userCollection.PageCount)
                        pageNo = userCollection.PageCount;
                    userCollection.AbsolutePage = pageNo;
                    userCollection.IsReturnDataTable = true;
                    userCollection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(userCollection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", userCollection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
            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;
            }
            protected override ActionResult DoTask(string data)
            {
                string[] param = StringUtility.Split(data, "%27");
                string usernum = Escape.JsUnEscape(param[0]);
                string username = Escape.JsUnEscape(param[1]);
                string password = EncryptMD5.MD5to16Code(Escape.JsUnEscape(param[2]));
                UserLevelType usertype = (UserLevelType)int.Parse(Escape.JsUnEscape(param[3]));

                UserEntity entity = new UserEntity();
                if (usertype == UserLevelType.Student)
                {
                    entity.FillIdentityStudentUserId();
                }
                else
                {
                    entity.UserNo = usernum;
                    entity.FillByUserNo();
                    if (entity.EntityState == DataFrameworkLibrary.Core.EntityState.Inserted)
                        throw new ActionParseException("系统中已存在相同编号的用户<br>请更换别的编号");
                }
                entity.UserName = username;
                entity.Password = password;
                entity.UserLevel = usertype;
                entity.IsLogin = false;
                entity.DoTest = true;
                entity.Save();

                UserCollection collection = new UserCollection();
                collection.PageSize = 6;
                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;
            }
            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;
            }