public void DelData() { string idlist = Parameters["pparm"]; OEQuestionBiz biz = new OEQuestionBiz(); ErrorEntity ErrInfo = new ErrorEntity(); biz.Delete(idlist, out ErrInfo); Response.Write(ErrInfo.ToJson()); }
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); } }
public void GetChoosenList() { string _paperid = Parameters["ppaperid"]; string _detailid = Parameters["pdetailid"]; List<HQOnlineExam.ML.OEQuestion> lists = new List<HQOnlineExam.ML.OEQuestion>(); NameValueCollection where = new NameValueCollection(); where.Add("condition", "(FQuestionStatus = '1') and (FQuestionId in (select FQuestionId from t_oe_choosequestion where FPaperId = " + _paperid + " and FDetailId = " + _detailid + "))"); OEQuestionBiz biz = new OEQuestionBiz(); lists = biz.Select(where); if (lists.Count > 0) { Response.Write(Utils.ConvertToJson(lists)); } else { Response.Write("NULL"); } }
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()); }
public void GetGridData() { string _searchcontent = ""; string _sortname = ""; string _sortdirection = ""; string _pagenumber = ""; string _pagesize = ""; _searchcontent = Parameters["psearchcontent"]; _sortname = Parameters["psortname"]; if (!string.IsNullOrEmpty(_sortname)) { sSortName = _sortname; } _sortdirection = Parameters["psortdirection"]; if (!string.IsNullOrEmpty(_sortdirection)) { sSortDirection = _sortdirection; } _pagenumber = Parameters["ppagenumber"]; if (!string.IsNullOrEmpty(_pagenumber)) { sPageIndex = Convert.ToInt32(_pagenumber); } _pagesize = Parameters["ppagesize"]; if (!string.IsNullOrEmpty(_pagesize)) { sPageSize = Convert.ToInt32(_pagesize); } string _qbankid = Parameters["pqbankid"]; string _tilte = Parameters["ptitle"]; string _type = Parameters["ptype"]; string _diffculty = Parameters["pdifficulty"]; string _keyword = Parameters["pkeyword"]; string _desc = Parameters["pdesc"]; List<HQOnlineExam.ML.OEQuestion> lists = new List<HQOnlineExam.ML.OEQuestion>(); OEQuestionBiz biz = new OEQuestionBiz(); string _searchtext = _searchcontent; string wheresql = "(FQBankId = " + _qbankid + ") and (FQuestionStatus <> '0') "; if (!string.IsNullOrEmpty(_tilte)) { wheresql += " and (FQuestionTilte like '%" + _tilte + "%') "; } if (!string.IsNullOrEmpty(_type)) { wheresql += " and (FQuestionType = '" + _type + "')"; } if (!string.IsNullOrEmpty(_diffculty)) { wheresql += " and (FQuestionDifficulty = '" + _diffculty + "')"; } if (!string.IsNullOrEmpty(_keyword)) { string _k = _keyword.Trim(); string[] k; k = _k.Split(' '); string _sql = ""; for (int i = 0; i < k.Length; i++) { if (!string.IsNullOrEmpty(_sql)) { _sql += " or "; } if (!string.IsNullOrEmpty(k[i].Trim())) { _sql += " ( FKeyWord like '%" + k[i].Trim() + "%') "; } } if (!string.IsNullOrEmpty(_sql)) { wheresql += " and (" + _sql + ") "; } } if (!string.IsNullOrEmpty(_desc)) { wheresql += " and (FQuestionDesc like '%" + _desc + "%') "; } NameValueCollection where = new NameValueCollection(); where.Add("condition", wheresql); NameValueCollection orderby = new NameValueCollection(); orderby.Add(_sortname, _sortdirection); Int32 totalcount = 0; lists = biz.Select(where, orderby, Convert.ToInt32(sPageIndex), Convert.ToInt32(sPageSize), out totalcount); string datasource = Utils.GetRepeaterDatasource(lists, sPageIndex, sPageSize, totalcount); Response.Write(datasource); }
public void UpdateStatus() { string _id = Parameters["pid"]; string _flag = Parameters["pflag"]; OEQuestionBiz biz = new OEQuestionBiz(); ErrorEntity ErrInfo = new ErrorEntity(); biz.UpdateStatus(_id, _flag, out ErrInfo); Response.Write(ErrInfo.ToJson()); }
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); }
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); } }
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); } }
public void GetQuestionList() { string _bank = Parameters["pbank"]; string _title = Parameters["ptitle"]; string _keyword = Parameters["pkeyword"]; string _chkpoint = Parameters["ppoint"]; string _paperid = Parameters["ppaperid"]; string _detailid = Parameters["pdetailid"]; string wheresql = "(FQuestionId not in (select FQuestionId from t_oe_choosequestion where FPaperId = " + _paperid + "))"; wheresql += " and (FQuestionStatus = '1')"; wheresql += " and (FQuestionDifficulty in (select FDifficulty from t_oe_paperdetailset where FPaperId = " + _paperid + " and FDetailSetId = " + _detailid + "))"; wheresql += " and (FQuestionType in (select FQuestionType from t_oe_paperdetailset where FPaperId = " + _paperid + " and FDetailSetId = " + _detailid + "))"; if (string.IsNullOrEmpty(_bank)) { wheresql += " and (FQbankId in (select FQBankId from t_oe_combinebank where FPaperId = " + _paperid + "))"; } else { wheresql += " and (FQBankId = " + _bank + ")"; } if (!string.IsNullOrEmpty(_title)) { wheresql += " and (FQuestionTitle like '%" + _title + "%')"; } if (!string.IsNullOrEmpty(_keyword)) { string _k = _keyword.Trim(); string[] k; k = _k.Split(' '); string _sql = ""; for (int i = 0; i < k.Length; i++) { if (!string.IsNullOrEmpty(_sql)) { _sql += " or "; } if (!string.IsNullOrEmpty(k[i].Trim())) { _sql += " ( FKeyWord like '%" + k[i].Trim() + "%') "; } } if (!string.IsNullOrEmpty(_sql)) { wheresql += " and (" + _sql + ") "; } } if (!string.IsNullOrEmpty(_chkpoint)) { wheresql += " and (FQuestionDesc like '%" + _chkpoint + "%')"; } List<HQOnlineExam.ML.OEQuestion> lists = new List<HQOnlineExam.ML.OEQuestion>(); OEQuestionBiz biz = new OEQuestionBiz(); NameValueCollection where = new NameValueCollection(); where.Add("condition",wheresql); lists = biz.Select(where); if (lists.Count > 0) { Response.Write(Utils.ConvertToJson(lists)); } else { Response.Write("NULL"); } }
public void GetQTypeCount() { OEQuestionBiz biz = new OEQuestionBiz(); NameValueCollection where = new NameValueCollection(); string _type = Parameters["ptype"]; string _banklist = Parameters["pidlist"]; where.Add("condition", "(FQuestionType = '" + _type + "') and (FQBankId in (" + _banklist + "))"); Int64 result = biz.SelectCount(where); Response.Write(result.ToString()); }