public List <BLLQuestion> SelectQuestion() { List <BLLQuestion> objlist = new List <BLLQuestion>(); BLLQuestion objbll = new BLLQuestion(); SqlDataReader dr; objcon.OpenConnection(); dr = objcon.sqlcmdSelectAll("sp_selectquestion"); while (dr.Read()) { objbll = new BLLQuestion(); objbll.Id = Convert.ToInt32(dr["id"].ToString()); objbll.Course_code = dr["course_code"].ToString(); objbll.Course_title = dr["course_title"].ToString(); objbll.Answer_type = dr["answer_type"].ToString(); objbll.No_of_answer = dr["no_of_question"].ToString(); objbll.Topic = dr["topic"].ToString(); objbll.Question = dr["question"].ToString(); objbll.Ques_level = dr["ques_level"].ToString(); objbll.Answer_a = dr["answer_a"].ToString(); objbll.Answer_b = dr["answer_b"].ToString(); objbll.Answer_c = dr["answer_c"].ToString(); objbll.Answer_d = dr["answer_d"].ToString(); objbll.Correct_answer = dr["correct_answer"].ToString(); objbll.Status = Convert.ToBoolean(dr["status"].ToString()); objbll.Createdby = dr["createdby"].ToString(); objbll.Modifiedby = dr["modifiedby"].ToString(); objbll.Insert_date = Convert.ToDateTime(dr["insert_date"].ToString()); objbll.Update_date = Convert.ToDateTime(dr["update_date"].ToString()); objlist.Add(objbll); } objcon.CloseConnection(); return(objlist); }
public void LoadQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Ques_level = ques_level; objbll.Course_code = lblcoursecode.Text; objlistque = objbll.Selectquestionforquizobjectivefull(objbll); Session["question"] = objlistque; if (objlistque.Count > 0) { if (no < no_of_question) { int quesno = no + 1; lblquesno.Text = " Q." + (quesno.ToString()); lblno.Text = Convert.ToString(objlistque[0].Id); lblQuestionNumber.Text = objlistque[0].Question; rbOption1.Text = objlistque[0].Answer_a; rbOption2.Text = objlistque[0].Answer_b; rbOption3.Text = objlistque[0].Answer_c; rbOption4.Text = objlistque[0].Answer_d; } else { btnSubmit.Enabled = false; Selectanswerfromquiz(); InsertGradeBook(); ASPxPopupControl1.ShowOnPageLoad = true; } } //lblques.Text = objlistque.Count.ToString(); }
public List <BLLQuestion> Selectquestionforquizobjectivefull(BLLQuestion objbll) { List <BLLQuestion> objlist = new List <BLLQuestion>(); SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@ques_level", SqlDbType.NVarChar); param[0].Value = objbll.Ques_level; param[1] = new SqlParameter("@course_code", SqlDbType.NVarChar); param[1].Value = objbll.Course_code; SqlDataReader dr; objcon.OpenConnection(); dr = objcon.sqlcmdSelectByMultimoreprogram("sp_selecttakequizobjectivesubjectwise", param); while (dr.Read()) { objbll = new BLLQuestion(); objbll.Id = Convert.ToInt32(dr["id"].ToString()); objbll.Question = dr["question"].ToString(); objbll.Answer_a = dr["answer_a"].ToString(); objbll.Answer_b = dr["answer_b"].ToString(); objbll.Answer_c = dr["answer_c"].ToString(); objbll.Answer_d = dr["answer_d"].ToString(); objbll.Correct_answer = dr["correct_answer"].ToString(); objbll.Ques_level = dr["ques_level"].ToString(); objlist.Add(objbll); } objcon.CloseConnection(); return(objlist); }
public List <BLLQuestion> Selectsubjectivequestionfullforquiz(BLLQuestion objbll) { List <BLLQuestion> objlist = new List <BLLQuestion>(); SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@quiz_name", SqlDbType.NVarChar); param[0].Value = objbll.Quiz_name; param[1] = new SqlParameter("@course_code", SqlDbType.NVarChar); param[1].Value = objbll.Course_code; SqlDataReader dr; objcon.OpenConnection(); dr = objcon.sqlcmdSelectByMultimoreprogram("sp_selecttakequizsubjectivequestionsubjectwise", param); while (dr.Read()) { objbll = new BLLQuestion(); objbll.Id = Convert.ToInt32(dr["id"].ToString()); objbll.Question = dr["question"].ToString(); objlist.Add(objbll); } objcon.CloseConnection(); return(objlist); }
public void LoadQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Quiz_name = lblquizname.Text; objbll.Course_code = lblcoursecode.Text; objlistque = objbll.Selectquestionforquiz(objbll); Session["question"] = objlistque; lblques.Text = objlistque.Count.ToString(); }
protected void btndelete_Click(object sender, EventArgs e) { LinkButton obj = (LinkButton)(sender); string val = obj.CommandArgument.ToString(); BLLQuestion objbll = new BLLQuestion(); objbll.Id = Convert.ToInt32(val); int a = objbll.DeleteQuestion(objbll); LoadGrid(); }
public void LoadForm() { BLLQuestion objbll = new BLLQuestion(); objbll.Id = (int)Session["ques_update"]; List <BLLQuestion> objlist = new List <BLLQuestion>(); objlist = objbll.Selectquestionbyid(objbll); if (objlist.Count > 0) { string answer_type = objlist[0].Answer_type; if (answer_type == "Objective") { ControlEnableTrue(); } else { ControlEnableFalse(); } cbanswertype.Text = answer_type; txttopic.Text = objlist[0].Topic; txtquestion.Text = objlist[0].Question; cblevel.Text = objlist[0].Ques_level; cbnoofanswers.Text = objlist[0].No_of_answer; txta.Text = objlist[0].Answer_a; txtb.Text = objlist[0].Answer_b; txtc.Text = objlist[0].Answer_c; txtd.Text = objlist[0].Answer_d; string val = objlist[0].Correct_answer; if (val == "A") { rba.Checked = true; } else if (val == "B") { rbb.Checked = true; } else if (val == "C") { rbc.Checked = true; } else if (val == "D") { rbd.Checked = true; } } }
public int DeleteQuestion(BLLQuestion objbll) { SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@id", SqlDbType.Int); param[0].Value = objbll.Id; objcon.OpenConnection(); int a = objcon.sqlcmdUpdateById("sp_deletequestion", param); objcon.CloseConnection(); return(a); }
public void LoadGrid() { BLLQuestion objbll = new BLLQuestion(); objbll.Course_code = cbcourses.SelectedItem.Value.ToString(); List <BLLQuestion> objlist = new List <BLLQuestion>(); objlist = objbll.Selectquestionbycourse(objbll); if (objlist.Count > 0) { dgquestion.DataSource = objlist; dgquestion.DataBind(); } }
public void LoadGrid() { BLLQuestion objbll = new BLLQuestion(); objbll.Course_code = txtcoursecode.Text; List <BLLQuestion> objlist = new List <BLLQuestion>(); objlist = objbll.Selectquestionbycourse(objbll); if (objlist.Count > 0) { dgquestion.DataSource = objlist; dgquestion.DataBind(); } }
public int UpdateQuestion(BLLQuestion objbll) { SqlParameter[] param = new SqlParameter[13]; param[0] = new SqlParameter("@answer_type", SqlDbType.NVarChar); param[0].Value = objbll.Answer_type; param[1] = new SqlParameter("@no_of_question", SqlDbType.NVarChar); param[1].Value = objbll.No_of_answer; param[2] = new SqlParameter("@topic", SqlDbType.NVarChar); param[2].Value = objbll.Topic; param[3] = new SqlParameter("@question", SqlDbType.NVarChar); param[3].Value = objbll.Question; param[4] = new SqlParameter("@ques_level", SqlDbType.NVarChar); param[4].Value = objbll.Ques_level; param[5] = new SqlParameter("@answer_a", SqlDbType.NVarChar); param[5].Value = objbll.Answer_a; param[6] = new SqlParameter("@answer_b", SqlDbType.NVarChar); param[6].Value = objbll.Answer_b; param[7] = new SqlParameter("@answer_c", SqlDbType.NVarChar); param[7].Value = objbll.Answer_c; param[8] = new SqlParameter("@answer_d", SqlDbType.NVarChar); param[8].Value = objbll.Answer_d; param[9] = new SqlParameter("@correct_answer", SqlDbType.NVarChar); param[9].Value = objbll.Correct_answer; param[10] = new SqlParameter("@modifiedby ", SqlDbType.NVarChar); param[10].Value = objbll.Modifiedby; param[11] = new SqlParameter("@Update_Date", SqlDbType.DateTime); param[11].Value = objbll.Update_date; param[12] = new SqlParameter("@id", SqlDbType.Int); param[12].Value = objbll.Id; objcon.OpenConnection(); int a = objcon.sqlcmdUpdateById("sp_updatequestion", param); objcon.CloseConnection(); return(a); }
public void InsertObjectiveQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Course_code = txtcoursecode.Text; objbll.Course_title = txtcoursetitle.Text; objbll.Answer_type = "Objective"; objbll.No_of_answer = cbnoofanswers.SelectedItem.ToString(); objbll.Topic = txttopic.Text; objbll.Question = txtquestion.Text; objbll.Ques_level = cblevel.SelectedItem.ToString(); objbll.Answer_a = txta.Text; objbll.Answer_b = txtb.Text; objbll.Answer_c = txtc.Text; objbll.Answer_d = txtd.Text; if (rba.Checked == true) { objbll.Correct_answer = "A"; } else if (rbb.Checked == true) { objbll.Correct_answer = "B"; } else if (rbc.Checked == true) { objbll.Correct_answer = "C"; } else { objbll.Correct_answer = "D"; } objbll.Createdby = user; objbll.Modifiedby = user; int a = objbll.InsertQuestion(objbll); if (a == 1) { lblresult.Text = "Question Save Successfully...."; BtnSave.Enabled = false; BtnNew.Enabled = true; txttopic.Focus(); } }
public void UpdateObjectiveQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Id = (int)Session["ques_update"]; objbll.Answer_type = "Objective"; objbll.No_of_answer = cbnoofanswers.SelectedItem.ToString(); objbll.Topic = txttopic.Text; objbll.Question = txtquestion.Text; objbll.Ques_level = cblevel.SelectedItem.ToString(); objbll.Answer_a = txta.Text; objbll.Answer_b = txtb.Text; objbll.Answer_c = txtc.Text; objbll.Answer_d = txtd.Text; if (rba.Checked == true) { objbll.Correct_answer = "A"; } else if (rbb.Checked == true) { objbll.Correct_answer = "B"; } else if (rbc.Checked == true) { objbll.Correct_answer = "C"; } else { objbll.Correct_answer = "D"; } objbll.Modifiedby = user; int a = objbll.UpdateQuestion(objbll); if (a == 1) { lblresult.Text = "Question Update Successfully...."; BtnSave.Enabled = false; BtnNew.Enabled = true; txttopic.Focus(); Session["mode"] = null; } }
public void UpdateSubjectiveQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Answer_type = "Subjective"; objbll.Topic = txttopic.Text; objbll.Question = txtquestion.Text; objbll.Ques_level = cblevel.SelectedItem.ToString(); objbll.Modifiedby = user; int a = objbll.UpdateQuestion(objbll); if (a == 1) { lblresult.Text = "Question Update Successfully...."; BtnSave.Enabled = false; BtnNew.Enabled = true; txttopic.Focus(); Session["mode"] = null; } }
public void InsertSubjectiveQuestion() { BLLQuestion objbll = new BLLQuestion(); objbll.Course_code = txtcoursecode.Text; objbll.Course_title = txtcoursetitle.Text; objbll.Answer_type = "Subjective"; objbll.Topic = txttopic.Text; objbll.Question = txtquestion.Text; objbll.Ques_level = cblevel.SelectedItem.ToString(); objbll.Createdby = user; objbll.Modifiedby = user; int a = objbll.InsertQuestion(objbll); if (a == 1) { lblresult.Text = "Question Save Successfully...."; BtnSave.Enabled = false; BtnNew.Enabled = true; txttopic.Focus(); } }
public int UpdateQuestion(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.UpdateQuestion(objbll)); }
public List <BLLQuestion> Selectquestionforquizobjectivefull(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.Selectquestionforquizobjectivefull(objbll)); }
public int InsertQuestion(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.InsertQuestion(objbll)); }
public List <BLLQuestion> Selectsubjectivequestionfullforquiz(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.Selectsubjectivequestionfullforquiz(objbll)); }
public int InsertQuestion(BLLQuestion objbll) { SqlParameter[] param = new SqlParameter[17]; param[0] = new SqlParameter("@course_code", SqlDbType.NVarChar); param[0].Value = objbll.Course_code; param[1] = new SqlParameter("@course_title", SqlDbType.NVarChar); param[1].Value = objbll.Course_title; param[2] = new SqlParameter("@answer_type", SqlDbType.NVarChar); param[2].Value = objbll.Answer_type; param[3] = new SqlParameter("@no_of_question", SqlDbType.NVarChar); param[3].Value = objbll.No_of_answer; param[4] = new SqlParameter("@topic", SqlDbType.NVarChar); param[4].Value = objbll.Topic; param[5] = new SqlParameter("@question", SqlDbType.NVarChar); param[5].Value = objbll.Question; param[6] = new SqlParameter("@ques_level", SqlDbType.NVarChar); param[6].Value = objbll.Ques_level; param[7] = new SqlParameter("@answer_a", SqlDbType.NVarChar); param[7].Value = objbll.Answer_a; param[8] = new SqlParameter("@answer_b", SqlDbType.NVarChar); param[8].Value = objbll.Answer_b; param[9] = new SqlParameter("@answer_c", SqlDbType.NVarChar); param[9].Value = objbll.Answer_c; param[10] = new SqlParameter("@answer_d", SqlDbType.NVarChar); param[10].Value = objbll.Answer_d; param[11] = new SqlParameter("@correct_answer", SqlDbType.NVarChar); param[11].Value = objbll.Correct_answer; param[12] = new SqlParameter("@status", SqlDbType.Bit); param[12].Value = objbll.Status; param[13] = new SqlParameter("@createdby", SqlDbType.NVarChar); param[13].Value = objbll.Createdby; param[14] = new SqlParameter("@modifiedby ", SqlDbType.NVarChar); param[14].Value = objbll.Modifiedby; param[15] = new SqlParameter("@Insert_Date", SqlDbType.DateTime); param[15].Value = objbll.Insert_date; param[16] = new SqlParameter("@Update_Date", SqlDbType.DateTime); param[16].Value = objbll.Update_date; objcon.OpenConnection(); int a = objcon.sqlcmdInsert("sp_insertquestion", param); objcon.CloseConnection(); return(a); }
public int DeleteQuestion(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.DeleteQuestion(objbll)); }
public List <BLLQuestion> Selectquestionbyid(BLLQuestion objbll) { DALQuestion objdal = new DALQuestion(); return(objdal.Selectquestionbyid(objbll)); }
public void ProcessRequest(HttpContext context) { BLLQuestion bllQuestion = new BLLQuestion(); BLLUser bllUser = new BLLUser(); ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction(); int examId = 0; try { string jsonData = context.Request["JsonData"]; QuestionnaireRecordList list = ZentCloud.Common.JSONHelper.JsonToModel <QuestionnaireRecordList>(jsonData); if (list.Data.Count > 0) { examId = list.Data[0].QuestionnaireID; if (bllUser.GetCount <QuestionnaireRecord>(string.Format("UserId='{0}' And QuestionnaireID={1}", CurrentUserInfo.UserID, list.Data[0].QuestionnaireID)) > 0) { apiResp.msg = "您已经提交过了"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } long recordId = Convert.ToInt64(bllQuestion.GetRecordGUID()); foreach (var item in list.Data) { ZentCloud.BLLJIMP.Model.QuestionnaireRecordDetail model = new BLLJIMP.Model.QuestionnaireRecordDetail(); model.UserID = CurrentUserInfo.UserID; model.QuestionnaireID = item.QuestionnaireID; model.QuestionID = item.QuestionID; model.AnswerID = item.AnswerID; model.AnswerContent = item.AnswerContent; model.RecordID = recordId; if (!bllUser.Add(model)) { tran.Rollback(); apiResp.msg = "提交失败"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } } QuestionnaireRecord record = new QuestionnaireRecord(); record.UserId = CurrentUserInfo.UserID; record.QuestionnaireID = list.Data[0].QuestionnaireID; record.InsertDate = DateTime.Now; record.IP = context.Request.UserHostAddress; record.RecordID = recordId; if (!bllUser.Add(record)) { tran.Rollback(); apiResp.msg = "提交失败"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } } else//自动提交 { QuestionnaireRecord record = new QuestionnaireRecord(); record.UserId = CurrentUserInfo.UserID; record.QuestionnaireID = int.Parse(context.Request["examId"]); record.InsertDate = DateTime.Now; record.IP = context.Request.UserHostAddress; record.RecordID = 0; if (bllQuestion.Add(record)) { apiResp.status = true; Questionnaire questionModelA = bllUser.Get <Questionnaire>(string.Format(" QuestionnaireID={0} ", examId)); questionModelA.SubmitCount = bllUser.GetCount <QuestionnaireRecord>(string.Format(" QuestionnaireID={0}", examId)); bllUser.Update(questionModelA); } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } } catch (Exception ex) { tran.Rollback(); apiResp.msg = ex.Message; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } tran.Commit(); apiResp.status = true; int submitCount = bllUser.GetCount <QuestionnaireRecord>(string.Format(" QuestionnaireID={0}", examId)); Questionnaire questionModel = bllUser.Get <Questionnaire>(string.Format(" QuestionnaireID={0} ", examId)); if (questionModel != null) { questionModel.SubmitCount = submitCount; bllUser.Update(questionModel); } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }