public async Task <IActionResult> PutQuestionMaster(int id, QuestionMaster questionMaster) { if (id != questionMaster.Id) { return(BadRequest()); } _context.Entry(questionMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuestionMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <QuestionMaster> > PostQuestionMaster(QuestionMaster questionMaster) { _context.QuestionMaster.Add(questionMaster); await _context.SaveChangesAsync(); return(CreatedAtAction("GetQuestionMaster", new { id = questionMaster.Id }, questionMaster)); }
public List <SelectListItem> GetQuestionListItem(int courseId) { ExamBL objExamBL = new ExamBL(); List <SelectListItem> lstSelectItem = new List <SelectListItem>(); try { QuestionMaster obj = new QuestionMaster(); obj.CourseId = courseId; List <QuestionMaster> lstUserType = objExamBL.CRUDQuestions(obj, "Q"); if (lstUserType != null) { lstSelectItem.Add(new SelectListItem { Text = "Select Question", Value = "" }); foreach (var u in lstUserType) { lstSelectItem.Add(new SelectListItem { Text = Convert.ToString(u.Question), Value = Convert.ToString(u.QuestionId) }); } } } catch (Exception) { throw; } return(lstSelectItem); }
public ActionResult DeleteConfirmed(int id) { QuestionMaster questionMaster = db.QuestionMasters.Find(id); db.QuestionMasters.Remove(questionMaster); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Questions() { QuestionMaster question = new QuestionMaster(); question.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value); List <QuestionMaster> questionList = objExamBL.CRUDQuestions(question, "L"); return(View(questionList)); }
void InitializePlayMode() { qmaster = null; qmarker = null; ReadQuestionFile(); SetNextQuestion(); SetQuestionUI(); RefreshResultList(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["BMSSCTID"].ToString() != "") { int Level = 0; int NoOfQuestion = 0; if (Request.QueryString["Level"].ToString() != "") { Level = Convert.ToInt32(Request.QueryString["Level"].ToString()); } if (Level == 0) { NoOfQuestion = Convert.ToInt32(getConfigValue("MaxQuestionForAll")); } else { NoOfQuestion = Convert.ToInt32(getConfigValue("MaxQuestionForLevelWise")); } DataTable dt = new DataTable(); QuestionMaster objQuestionMaster = new QuestionMaster(); DataSet ds = new DataSet(); string RndoKey = "0"; RndoKey = getConfigValue("JumbleQuestion"); int RndmQuestion = Convert.ToInt32(RndoKey); ViewState["TestTypeToTable"] = Request.QueryString["TestType"].ToString(); ds = objQuestionMaster.SELECTAll_QuestionByBMSSCTID(RndmQuestion, Level, NoOfQuestion, Convert.ToInt32(Request.QueryString["BMSSCTID"].ToString()), Request.QueryString["TestType"]); // ds = objQuestionMaster.SELECTAll_QuestionByBMSSCTID(RndmQuestion, Level, NoOfQuestion, Convert.ToInt32(Request.QueryString["BMSSCTID"].ToString()), "MCQ"); //////////String xmldata; //////////StringWriter sw = new StringWriter(); //////////ds.Tables[0].WriteXml(sw); //////////xmldata = sw.ToString(); if (ds.Tables.Count > 0) { dt = ds.Tables[0]; dt.Columns.Add("GivenAnswerID", typeof(Int64)); dt.Columns.Add("GivenAnswer", typeof(String)); dt.Columns.Add("ResultTF", typeof(String)); ViewState["QuestionAnsDT"] = dt; ViewState["CurQuestion"] = 0; BindNextQuestion(dt); } else { BtnButton.Visible = false; WebMsg.Show("No Question found!"); } } } }
public JsonResult GetQuestionByCourseId(int id) { QuestionMaster objQuestion = new QuestionMaster(); objQuestion.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value); objQuestion.CourseId = id; List <QuestionMaster> questionList = objExamBL.CRUDQuestions(objQuestion, "Q"); return(Json(questionList, JsonRequestBehavior.AllowGet)); }
public ActionResult ViewQuestionAll(int QGid) { QuestionMaster Qm = new QuestionMaster(); QuestionGroup Qg = new QuestionGroup(); QuestionTestModel model = new QuestionTestModel(); model.Questions = Qm.GetByGroup(QGid, con); model.Name = Qg.GetById(con, QGid).QuestionGroupName; return(View(model)); }
//[Authorize(Roles = "Admin")] public ActionResult QuestionMasters(QuestionMaster QuestionMaster) { string UserId = User.Identity.GetUserId(); var UserDetails = generic.GetUserDetail(UserId); ViewData["UserProfile"] = UserDetails; bool result = rms.AddQuestions(QuestionMaster.QuestionId, QuestionMaster.Question, QuestionMaster.Category, UserDetails.SubscriberId); return(RedirectToAction("QuestionMasters", "RMS", new { Area = "RMS", status = result })); }
public ActionResult AddQuestion(string id, string Exception) { ViewBag.CourseList = new SelectList(_course.GetAll(), "pkid", "CourseName"); ViewBag.DivisionList = new SelectList(_division.GetAll(), "pkid", "DivisioName"); ViewBag.Exception = Exception; if (!String.IsNullOrWhiteSpace(id)) { int _id = Convert.ToInt32(id); tbl_QuestionMaster model = _question.Get(_id); QuestionMaster abc = new QuestionMaster(); abc.pkid = model.pkid; abc.subjecttype_fkid = model.subjecttype_fkid; abc.Question = model.Question; abc.Explaination = model.Explaination; abc.Subject_fkid = Convert.ToInt32(model.Subject_fkid); abc.Division_fkid = model.Division_fkid; abc.hint = model.hint; abc.SelectLevel = model.SelectLevel; abc.SelectLevel = model.SelectLevel; abc.NegativeMarks = model.NegativeMarks; abc.Marks = model.Marks; abc.Status = model.Status; abc.Adddate = model.Adddate; if (model.subjecttype_fkid == 5) { abc.Questtype_fkid = model.subjecttype_fkid; abc.MATContent = _Matc.GetAll().Where(x => x.Ques_fkid == model.pkid).ToList(); } else if (model.subjecttype_fkid == 7) { abc.Questtype_fkid = model.subjecttype_fkid; abc.FULLF = _Matc.GetAll().Where(x => x.Ques_fkid == model.pkid).ToList(); } else { tbl_AnswerMaster ANS = _answer.GetAll().Where(x => x.Ques_fkid == model.pkid).FirstOrDefault(); abc.Questtype_fkid = ANS.Questtype_fkid; abc.Answer1 = ANS.Answer1; abc.Answer2 = ANS.Answer2; abc.Answer3 = ANS.Answer3; abc.Answer4 = ANS.Answer4; abc.CorrectAnswerDD = ANS.CorrectAnswer; abc.BlanckSpace = ANS.BlanckSpace; abc.TrueFalse = ANS.TrueFalse; abc.SubAnswer = ANS.SubAnswer; abc.Status = ANS.status; abc.Adddate = ANS.Adddate; } return(View(abc)); } return(View()); }
void ReadQuestionFile() { if (qmaster == null) { qmaster = new QuestionMaster(); } var dictpath = @"dict\" + dictList.SelectedItem.ToString(); qmaster.SetQuestion(dictpath); }
public ActionResult Edit([Bind(Include = "ID,Introduction,Question,Deactive,QuestionOrder,LevelID,SelectionType")] QuestionMaster questionMaster) { if (ModelState.IsValid) { db.Entry(questionMaster).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LevelID = new SelectList(db.LevelMasters, "ID", "LevelName", questionMaster.LevelID); return(View(questionMaster)); }
public ActionResult StartExam(List <QuestionMaster> QuestionMaster) { try { QuestionMaster obj = new QuestionMaster(); obj = objExamBL.SaveExamPapers(QuestionMaster); } catch (Exception ex) { } return(RedirectToAction("StudentDashboard", "SuperAdmin")); }
// GET: QuestionMasters/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuestionMaster questionMaster = db.QuestionMasters.Find(id); if (questionMaster == null) { return(HttpNotFound()); } return(View(questionMaster)); }
// GET: QuestionMasters/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuestionMaster questionMaster = db.QuestionMasters.Find(id); if (questionMaster == null) { return(HttpNotFound()); } ViewBag.LevelID = new SelectList(db.LevelMasters, "ID", "LevelName", questionMaster.LevelID); return(View(questionMaster)); }
/// <summary> /// Function returns a list of Question Details /// </summary> /// <returns>List</returns> public void ViewQuestion(int QuestId, ref QuestionMaster _QueslateDetails, ref List <QuestionOptions> lstQuesDetails) { DataSet dsViewquesDetails = new DataSet(); Database dbViewquesDetails = ConnectDatabase.Conn(); String sqlDetails = "Proc_ViewQuestion"; DbCommand quesDetailsCmd = dbViewquesDetails.GetStoredProcCommand(sqlDetails); dbViewquesDetails.AddInParameter(quesDetailsCmd, "QuestId", DbType.Int32, QuestId); dsViewquesDetails = dbViewquesDetails.ExecuteDataSet(quesDetailsCmd); if (dsViewquesDetails.Tables.Count > 0) { _QueslateDetails = Mapqueslate(dsViewquesDetails.Tables[0]); lstQuesDetails = MapquesDetails(dsViewquesDetails.Tables[1]); } }
public JsonResult DeleteQuestions(int id) { try { QuestionMaster question = new QuestionMaster(); question.AnswerTypeId = id; question.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value); if (question.AnswerTypeId > 0) { objExamBL.CRUDQuestions(question, "D"); TempData["SuccessMessage"] = "You have removed one answer type successfully"; } } catch (Exception ex) { } return(Json(new { Success = "Success" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddMcqQuestions(AddQuestionModel model) { ViewBag.Values = model.DynamicTextBox; if (!ModelState.IsValid) { return(View(model)); } QuestionGroup qg = new QuestionGroup(); QuestionMaster qm = new QuestionMaster(); qg = qg.GetById(con, model.QgrupId); List <QuestionMaster> lst = new List <QuestionMaster>(); lst = qm.GetByGroup(model.QgrupId, con); qm.GetByGroup(model.QgrupId, con); qm.Question = System.Web.HttpUtility.HtmlEncode(model.Question); qm.QuestionGroup = model.QgrupId; qm.SrNo = lst.Count + 1; qm.QLanguage = qg.QLanguage; qm.Active = 1; qm.QuestionType = "1"; qm.CurrectAnswer = model.CurrectAnswer; qm.AnswerDetails = model.AnswerDescription; qm.CreatedDate = DateTime.Now; qm.CreatedBy = 1; List <QuestionOptions> lstOp = new List <QuestionOptions>(); int srNo = 65; foreach (var item in model.DynamicTextBox) { char character = (char)srNo; string text = character.ToString(); lstOp.Add(new QuestionOptions(0, 0, text, item, 1, DateTime.Now, 1)); srNo += 1; } qm.Options = lstOp; qm.Create(qm, con); return(Redirect("AddMcqQuestions?QgrupId=" + model.QgrupId)); }
/// <summary> /// Maps a Datatable to a Generic List of Questions /// </summary> /// <param name="dtquesDetails"></param> /// <returns>List</returns> public QuestionMaster Mapqueslate(DataTable dtquesDetails) { QuestionMaster _question = new QuestionMaster(); foreach (DataRow drques in dtquesDetails.Rows) { if (dtquesDetails.Columns.Contains("Quest_Id") && drques["Quest_Id"] != DBNull.Value) { _question.Id = Convert.ToInt32(drques["Quest_Id"]); } if (dtquesDetails.Columns.Contains("Product_Id") && drques["Product_Id"] != DBNull.Value) { _question.Product.UniqueId = Convert.ToInt32(drques["Product_Id"]); } if (dtquesDetails.Columns.Contains("QnType_Id") && drques["QnType_Id"] != DBNull.Value) { _question.typeId = Convert.ToInt32(drques["QnType_Id"]); } if (dtquesDetails.Columns.Contains("Sem_Id") && drques["Sem_Id"] != DBNull.Value) { _question.Semester.SemesterId = Convert.ToInt32(drques["Sem_Id"]); } if (dtquesDetails.Columns.Contains("Quest_Complexity") && drques["Quest_Complexity"] != DBNull.Value) { _question.Complexity = Convert.ToChar(drques["Quest_Complexity"]); } if (dtquesDetails.Columns.Contains("Quest_Desc") && drques["Quest_Desc"] != DBNull.Value) { _question.Description = Convert.ToString(drques["Quest_Desc"]); } if (dtquesDetails.Columns.Contains("Quest_Marks") && drques["Quest_Marks"] != DBNull.Value) { _question.Marks = Convert.ToInt32(drques["Quest_Marks"]); } if (dtquesDetails.Columns.Contains("Quest_IsActive") && drques["Quest_IsActive"] != DBNull.Value) { _question.IsActive = Convert.ToBoolean(drques["Quest_IsActive"]); } if (dtquesDetails.Columns.Contains("Quest_IsNegativeMark") && drques["Quest_IsNegativeMark"] != DBNull.Value) { _question.IsNegativeMark = Convert.ToBoolean(drques["Quest_IsNegativeMark"]); } } return(_question); }
public List <QuestionMaster> CRUDQuestions(QuestionMaster objQues, string action) { List <QuestionMaster> objQuesDetails = new List <QuestionMaster>(); try { DataTable dtResponse = examDA.CRUDQuestions(objQues, action); if (dtResponse != null && dtResponse.Rows.Count > 0) { objQuesDetails = dtResponse.ConvertToListOf <QuestionMaster>(); } } catch (Exception ex) { throw; } return(objQuesDetails); }
public QuestionMaster SaveExamPapers(List <QuestionMaster> questionMaster) { QuestionMaster result = new QuestionMaster(); try { DataTable dtResponse = examDA.SaveExamPapers(questionMaster); if (dtResponse != null && dtResponse.Rows.Count > 1) { result = dtResponse.ConvertToListOf <QuestionMaster>().FirstOrDefault(); } } catch (Exception) { throw; } return(result); }
public ActionResult ViewQuestion(int QGid = 0) { if (Session["uid"] == null) { return(Redirect("../Account/Login?ReturnUrl=/Practice/ViewQuestion?QGid=" + QGid)); } if (QGid == 0) { return(Redirect("Practice")); } QuestionMaster Qm = new QuestionMaster(); QuestionGroup Qg = new QuestionGroup(); List <QuestionMaster> Ql = new List <QuestionMaster>(); Qg = Qg.GetById(con, QGid); Ql = Qm.GetByGroup(QGid, con);; Session["Qlist"] = Ql; if (Ql.Count > 1) { ViewBag.Last = false; } else { ViewBag.Last = true; } ViewBag.QuestionGroupName = Qg.QuestionGroupName; ViewBag.EndTime = DateTime.Now.AddSeconds(Ql.Count * Qg.TimePerQuestion); Session["EndTime"] = DateTime.Now.AddSeconds(Ql.Count * Qg.TimePerQuestion).ToString("MMM dd, yyyy HH:mm:ss"); Session["StartTime"] = DateTime.Now; Session["TimeLeft"] = Ql.Count * Qg.TimePerQuestion; Ql[0].TotalQuestion = Ql.Count; return(View(Ql[0])); }
public ActionResult AddQuestions(int?id) { QuestionMaster objQuestion = new QuestionMaster(); try { QuestionMaster obj = new QuestionMaster(); obj.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value); obj.QuestionId = id ?? 0; if (id != null && id > 0) { objQuestion = objExamBL.CRUDQuestions(obj, "S").FirstOrDefault(); } objQuestion.ListCourse = new SelectList(GetCourseListItem(), "Value", "Text"); objQuestion.AnswerTypeList = new SelectList(GetDropdownList <AnswerTypeMaster>(objExamBL.CRUDAnswerTypes(new AnswerTypeMaster(), "L"), "AnswerType", "AnswerTypeId", "Select Answer Type"), "Value", "Text"); } catch (Exception ex) { } return(View(objQuestion)); }
public ActionResult StartExam(int id) { List <QuestionMaster> questionList = new List <QuestionMaster>(); try { long studentId = long.Parse("0" + Request.Cookies["UserId"].Value); QuestionPaper result = objExamBL.ExamPapers(id, studentId); foreach (QuestionMaster ques in result.QuestionList) { QuestionMaster question = new QuestionMaster(); question = ques; question.Options = result.AnswerList.Where(a => a.QuestionId == ques.QuestionId).ToList(); questionList.Add(question); } } catch (Exception ex) { } return(View(questionList)); }
public DataTable CRUDQuestions(QuestionMaster ansType, string action) { DataTable dtResult = new DataTable(); try { SqlParameter objSqlParameter = new SqlParameter("AnswerTypeId", ansType.AnswerTypeId); SqlParameter objSqlParameter1 = new SqlParameter("CourseId", ansType.CourseId); SqlParameter objSqlParameter2 = new SqlParameter("QuestionId", ansType.QuestionId); SqlParameter objSqlParameter3 = new SqlParameter("Marks", ansType.Marks); SqlParameter objSqlParameter4 = new SqlParameter("Question", ansType.Question); SqlParameter objSqlParameter5 = new SqlParameter("LoggedInUser", ansType.LoggedInUser); SqlParameter objSqlParameter6 = new SqlParameter("Action", action); List <SqlParameter> lstSqlParams = DBCommon.GetSqlParameterList(new SqlParameter[] { objSqlParameter, objSqlParameter1, objSqlParameter2, objSqlParameter3, objSqlParameter4, objSqlParameter5, objSqlParameter6 }); dtResult = DBCommon.ExecuteDataAdapterDataTable("CRUDQuestions", lstSqlParams); } catch (Exception ex) { throw; } return(dtResult); }
public ActionResult AddQuestions(QuestionMaster QuestionMaster) { try { QuestionMaster.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value); QuestionMaster objQuestionDetails = objExamBL.CRUDQuestions(QuestionMaster, (QuestionMaster.QuestionId > 0 ? "U" : "I")).FirstOrDefault(); if (objQuestionDetails.CRUDStatus == "success" || objQuestionDetails.QuestionId > 0) { TempData["SuccessMessage"] = "You have " + (QuestionMaster.QuestionId > 0 ? "updated" : "added") + " one question successfully"; return(RedirectToAction("Questions", "Exam")); } else { TempData["ErrorMessage"] = objQuestionDetails.CRUDStatus; return(RedirectToAction("Questions", "Exam")); } } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(RedirectToAction("Questions", "Exam")); } }
public ActionResult ShowQuestion(int id) { try { QuestionMaster abc = new QuestionMaster(); tbl_QuestionMaster QUE = _question.Get(id); abc.subjecttype_fkid = QUE.subjecttype_fkid; abc.Question = QUE.Question; abc.Marks = QUE.Marks; abc.NegativeMarks = QUE.NegativeMarks; if (abc.subjecttype_fkid == 5) { abc.MATContent = _Matc.GetAll().Where(x => x.Ques_fkid == id).ToList(); } else if (abc.subjecttype_fkid == 7) { abc.FULLF = _Matc.GetAll().Where(x => x.Ques_fkid == id).ToList(); } else { tbl_AnswerMaster ANS = _answer.GetAll().Where(x => x.Ques_fkid == QUE.pkid).FirstOrDefault(); abc.Answer1 = ANS.Answer1; abc.Answer2 = ANS.Answer2; abc.Answer3 = ANS.Answer3; abc.Answer4 = ANS.Answer4; abc.CorrectAnswerDD = ANS.CorrectAnswer; abc.BlanckSpace = ANS.BlanckSpace; abc.TrueFalse = ANS.TrueFalse; } return(PartialView(abc)); } catch { return(PartialView()); } }
public ActionResult ViewResult2(long TestId) { TestResults tr = new TestResults(); TestList tl = new TestList(); List <TestResults> lsttr = new List <TestResults>(); tl = tl.GetById(TestId, con); lsttr = tr.GetByTestId(TestId, con); QuestionMaster qm = new QuestionMaster(); List <QuestionMaster> Ql = new List <QuestionMaster>(); Ql = qm.GetByGroup(tl.QuestionGroup, con); foreach (QuestionMaster item in Ql) { List <TestResults> lsttr1 = new List <TestResults>(); item.Answer = lsttr.FindAll(m => m.Qid == item.Qid)[0].Answer; } Session["Qlist"] = Ql; //Ql = (List<QuestionMaster>)Session["Qlist"]; return(View(Ql)); }
public void Add(QuestionMaster questionMaster) { context.QuestionMaster.Add(questionMaster); }