public void ProcessRequest(HttpContext context) { List <BLLJIMP.Model.Question> questions = null; string msg = ""; bool result = bllQuestion.GetQuestionListBySet(Convert.ToInt32(context.Request["id"]), out questions, out msg); if (result) { BLLJIMP.Model.QuestionnaireSet QuestionnaireSetModel = bllQuestion.GetByKey <BLLJIMP.Model.QuestionnaireSet>("AutoID", context.Request["id"]); bool isUserAnswer = bllQuestion.ExistsRecordCount(CurrentUserInfo.UserID, QuestionnaireSetModel.AutoID, null); var resultList = from p in questions select new { question_id = p.QuestionID, question_name = p.QuestionName, question_type = p.QuestionType, question_required = p.IsRequired, question_options = (from s in p.Answers select new { option_id = s.AnswerID, option_name = s.AnswerName }) }; apiResp.result = new { id = QuestionnaireSetModel.AutoID, title = QuestionnaireSetModel.Title, img = QuestionnaireSetModel.Img, describe = QuestionnaireSetModel.Description, bgimg_index = QuestionnaireSetModel.BgImgIndex, bgimg_answer = QuestionnaireSetModel.BgImgAnswer, bgimg_end = QuestionnaireSetModel.BgImgEnd, is_useranswer = isUserAnswer, is_moreanswer = QuestionnaireSetModel.IsMoreAnswer, win_count = QuestionnaireSetModel.WinCount, win_btn_text = QuestionnaireSetModel.WinBtnText, win_btn_url = QuestionnaireSetModel.WinBtnUrl, win_describe = QuestionnaireSetModel.WinDescription, questions = resultList }; apiResp.code = (int)APIErrCode.IsSuccess; } else { apiResp.code = (int)APIErrCode.OperateFail; } apiResp.status = result; apiResp.msg = msg; bllQuestion.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string AutoID = context.Request["AutoID"]; BLLJIMP.Model.QuestionnaireSet QuestionnaireSetModel = bllQuestion.GetByKey <BLLJIMP.Model.QuestionnaireSet>("AutoID", AutoID); if (QuestionnaireSetModel == null) { apiResp.code = (int)APIErrCode.ContentNotFound; apiResp.msg = "没有找到记录"; bllQuestion.ContextResponse(context, apiResp); return; } apiResp.code = (int)APIErrCode.IsSuccess; apiResp.status = true; apiResp.result = QuestionnaireSetModel; bllQuestion.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string AutoID = context.Request["AutoID"]; BLLJIMP.Model.QuestionnaireSet QuestionnaireSetModel = bllQuestion.GetByKey <BLLJIMP.Model.QuestionnaireSet>("AutoID", AutoID); QuestionnaireSetModel = bllQuestion.ConvertRequestToModel <BLLJIMP.Model.QuestionnaireSet>(QuestionnaireSetModel); apiResp.status = bllQuestion.Update(QuestionnaireSetModel); if (apiResp.status) { apiResp.code = (int)APIErrCode.IsSuccess; apiResp.msg = "更新完成"; bllLog.Add(BLLJIMP.Enums.EnumLogType.Marketing, BLLJIMP.Enums.EnumLogTypeAction.Update, bllLog.GetCurrUserID(), "编辑答题[id=" + AutoID + "]"); } else { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "更新失败"; } bllQuestion.ContextResponse(context, apiResp); }