private void Bind()
        {
            if (!string.IsNullOrWhiteSpace(Request.QueryString["Id"]))
            {
                Guid Id = Guid.Empty;
                if (!Guid.TryParse(Request.QueryString["Id"], out Id))
                {
                    MessageBox.Messager(this.Page, "请求参数不合法,请正确操作", "错误提示", "error");
                    return;
                }
                if (Id.Equals(Guid.Empty))
                {
                    MessageBox.Messager(this.Page, "请求参数不合法,请正确操作", "错误提示", "error");
                    return;
                }

                RiskTestQuestionAnswer bll = new RiskTestQuestionAnswer();
                var model = bll.GetModel(Id);
                if (model == null)
                {
                    MessageBox.Messager(this.Page, "数据不存在或已被删除", "错误提示", "error");
                    return;
                }
                hAnswerQuestionId.Value = model.QuestionId.ToString();

                myDataAppend.Append(@"<div id=""xmlAnswer"" style=""display:none;"">" + model.AnswerResult + "</div>");
            }
        }
示例#2
0
        public string DelRiskTestQuestionAnswer(string itemAppend)
        {
            try
            {
                if (!HttpContext.Current.User.IsInRole("Administrators"))
                {
                    return(MC.Role_InvalidError);
                }

                itemAppend = itemAppend.Trim();
                if (string.IsNullOrEmpty(itemAppend))
                {
                    return(MC.Submit_InvalidRow);
                }

                string[] items = itemAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                RiskTestQuestionAnswer bll = new RiskTestQuestionAnswer();
                bll.DeleteBatch(items.ToList <object>());

                return("1");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
示例#3
0
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int totalRecords           = 0;
            RiskTestQuestionAnswer bll = new RiskTestQuestionAnswer();

            rpData.DataSource = bll.GetList(pageIndex, pageSize, out totalRecords, sqlWhere == null ? null : sqlWhere.ToString(), parms == null ? null : parms.ToArray());
            rpData.DataBind();

            myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr.ToString() + "\"}]</div>");
        }
        public ResResult SaveRiskTestQuestionAnswer(string username, object questionId, string xmlAnswer)
        {
            Guid qId = Guid.Empty;

            if (questionId != null)
            {
                Guid.TryParse(questionId.ToString(), out qId);
            }
            if (qId.Equals(Guid.Empty))
            {
                return(ResError("未找到任何题ID,请正确操作"));
            }

            try
            {
                XElement root = XElement.Parse(xmlAnswer);
            }
            catch
            {
                return(ResError("参数xmlAnswer值不合法"));
            }

            try
            {
                RiskTestQuestionAnswerInfo model = new RiskTestQuestionAnswerInfo();
                model.UserId          = Guid.Empty;
                model.QuestionId      = qId;
                model.AnswerResult    = xmlAnswer;
                model.LastUpdatedDate = DateTime.Now;
                RiskTestQuestionAnswer bll = new RiskTestQuestionAnswer();
                int effect = bll.Insert(model);
                if (effect < 1)
                {
                    return(ResError("数据库连接操作异常,请稍后再重试"));
                }
                return(ResSuccess("操作成功!"));
            }
            catch (Exception ex)
            {
                return(ResError(ex.Message));
            }
        }