コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     item = new HQOnlineExam.ML.OEQuestion();
     if (!Page.IsPostBack)
     {
         string _id = Parameters["qid"];
         OEQuestionBiz biz = new OEQuestionBiz();
         item = biz.Select(_id);
         List<OEQuestionItem> lists = new List<OEQuestionItem>();
         OEQuestionItemBiz ibiz = new OEQuestionItemBiz();
         lists = ibiz.Select(_id);
         AddDatasource("itemlists", lists);
     }
 }
コード例 #2
0
ファイル: OEQuestionBiz.cs プロジェクト: hqsoftmac/HQDEV1-1
 public Int64 Insert(OEQuestion item, out ErrorEntity ErrInfo)
 {
     //Error Judge Define
     if (item.FQBankId == 0)
     {
         ErrInfo = new ErrorEntity("OQ010001", "所属题库不能为空!");
         return -1;
     }
     if (string.IsNullOrEmpty(item.FQuestionTitle))
     {
         ErrInfo = new ErrorEntity("OQ010002", "题目标题不能为空!");
         return -1;
     }
     if (string.IsNullOrEmpty(item.FQuestionType))
     {
         ErrInfo = new ErrorEntity("OQ010003", "题目类型不能为空!");
         return -1;
     }
     if (string.IsNullOrEmpty(item.FQuestionDifficulty))
     {
         ErrInfo = new ErrorEntity("OQ010004", "题目难度不能为空!");
         return -1;
     }
     if (string.IsNullOrEmpty(item.FKeyWord))
     {
         ErrInfo = new ErrorEntity("OQ010005", "题目关键字不能为空!");
         return -1;
     }
     NameValueCollection parameters = new NameValueCollection();
     parameters.Add("FQBankId", item.FQBankId.ToString());
     parameters.Add("FQuestionTitle", item.FQuestionTitle);
     parameters.Add("FQuestionType", item.FQuestionType);
     parameters.Add("FQuestionDifficulty", item.FQuestionDifficulty);
     parameters.Add("FKeyWord", item.FKeyWord);
     parameters.Add("FQuestionDesc", item.FQuestionDesc);
     parameters.Add("FQuestionAnalysis", item.FQuestionAnalysis);
     parameters.Add("AUserId", item.AUserId.ToString());
     parameters.Add("AUserName", item.AUserName);
     return Insert(parameters, out ErrInfo);
 }
コード例 #3
0
 public void SaveQuestion()
 {
     string _contentclassid = Parameters["pcontentclassid"];
     string _questionbank = Parameters["pquestionbank"];
     string _questionid = Parameters["pquestionid"];
     string _questiontitile = Parameters["pquestiontitle"];
     string _questiontype = Parameters["pquestiontype"];
     string _questiondiffculty = Parameters["pquestiondifficulty"];
     string _keyword = Parameters["pkeyword"];
     string _desc = Parameters["pdesc"];
     string _analysis = Parameters["panalysis"];
     ErrorEntity ErrInfo = new ErrorEntity();
     OEQuestionBiz biz = new OEQuestionBiz();
     HQOnlineExam.ML.OEQuestion item = new HQOnlineExam.ML.OEQuestion();
     SysUser useritem = new SysUser();
     useritem = GetUserInfo();
     item.AUserId = useritem.FUserId;
     item.AUserName = useritem.FUserName;
     item.FQuestionId = Convert.ToInt64(_questionid);
     item.FQBankId = Convert.ToInt64(_questionbank);
     item.FQuestionTitle = _questiontitile;
     item.FQuestionType = _questiontype;
     item.FQuestionDifficulty = _questiondiffculty;
     item.FKeyWord = _keyword;
     item.FQuestionDesc = _desc;
     item.FQuestionAnalysis = _analysis;
     item.FQuestionStatus = "1";
     if (string.IsNullOrEmpty(_questionid) || _questionid == "0")
     {
         biz.Insert(item, out ErrInfo);
     }
     else
     {
         biz.Update(item, out ErrInfo);
     }
     Response.Write(ErrInfo.ToJson());
 }
コード例 #4
0
        public Int32 Insert(OEQuestionItem item, out ErrorEntity ErrInfo)
        {
            //Error Judge Define
            if (item.FQuestionId == 0)
            {
                ErrInfo = new ErrorEntity("QI010001", "归属题目ID不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FItemContent))
            {
                ErrInfo = new ErrorEntity("QI010002", "题目答案内容不能为空!");
                return -1;
            }
            if (string.IsNullOrEmpty(item.FItemFlag))
            {
                item.FItemFlag = "0";
            }
            //判断题型
            NameValueCollection where = new NameValueCollection();
            where.Add("FQuestionId", item.FQuestionId.ToString());
            List<OEQuestionItem> itemlists = new List<OEQuestionItem>();
            itemlists = Select(where);
            if (itemlists.Count > 0)
            {
                OEQuestion qitem = new OEQuestion();
                OEQuestionBiz biz = new OEQuestionBiz();
                qitem = biz.Select(item.FQuestionId.ToString());
                if (qitem.FQuestionType == "0")
                {
                    if(itemlists.Count > 1)
                    {
                        ErrInfo = new ErrorEntity("QI010003", "判断题型只能有2个备选答案!");
                        return -1;
                    }
                }
                if (qitem.FQuestionType == "1")
                {
                    if (item.FItemFlag == "1")
                    {
                        if (itemlists.Where(p => p.FItemFlag == "1").ToList<OEQuestionItem>().Count > 0)
                        {
                            ErrInfo = new ErrorEntity("QI010004", "单选题只能有一个正确答案!");
                            return -1;
                        }
                    }
                }
            }

            item.FItemId = GenerateItemId(item.FQuestionId.ToString());
            NameValueCollection parameters = new NameValueCollection();
            parameters.Add("FQuestionId", item.FQuestionId.ToString());
            parameters.Add("FItemId", item.FItemId.ToString());
            parameters.Add("FItemContent", item.FItemContent);
            parameters.Add("FItemFlag", item.FItemFlag);
            return Insert(parameters, out ErrInfo);
        }
コード例 #5
0
 public int UpdateRight(string _qid, string _itemid, out ErrorEntity ErrInfo )
 {
     OEQuestionBiz biz = new OEQuestionBiz();
     OEQuestion item = new OEQuestion();
     item = biz.Select(_qid);
     string _type = item.FQuestionType;
     switch (_type)
     {
         case "1": //判断题
             NameValueCollection parameters = new NameValueCollection();
             parameters.Add("FItemFlag", "0");
             NameValueCollection where = new NameValueCollection();
             where.Add("FQuestionId", _qid);
             Update(parameters, where, out ErrInfo);
             parameters.Clear();
             parameters.Add("FItemFlag", "1");
             where.Add("FItemId", _itemid);
             return Update(parameters, where, out ErrInfo);
         case "2":
             NameValueCollection parameters1 = new NameValueCollection();
             parameters1.Add("FItemFlag", "0");
             NameValueCollection where1 = new NameValueCollection();
             where1.Add("FQuestionId", _qid);
             Update(parameters1, where1, out ErrInfo);
             parameters1.Clear();
             parameters1.Add("FItemFlag", "1");
             where1.Add("FItemId", _itemid);
             return Update(parameters1, where1, out ErrInfo);
         default:
             NameValueCollection parameters2 = new NameValueCollection();
             NameValueCollection where2 = new NameValueCollection();
             parameters2.Add("FItemFlag", "1");
             where2.Add("FQuestionId", _qid);
             where2.Add("FItemId", _itemid);
             return Update(parameters2, where2, out ErrInfo);
     }
 }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string _id = Parameters["qid"];
         item = new HQOnlineExam.ML.OEQuestion();
         OEQuestionBiz biz = new OEQuestionBiz();
         item = biz.Select(_id);
         List<OEQuestionBank> lists = new List<OEQuestionBank>();
         OEQuestionBankBiz QBbiz = new OEQuestionBankBiz();
         NameValueCollection where = new NameValueCollection();
         where.Add("FContentClassId",item.FContentClassId.ToString());
         NameValueCollection orderby = new NameValueCollection();
         orderby.Add("FQBankCode","asc");
         lists = QBbiz.Select(where, orderby);
         AddDatasource("QBankList", lists);
     }
 }