예제 #1
0
        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);
        }
예제 #2
0
        //for GetExamForDrp drp
        public void GetExamForDrp()
        {
            ExamBL examBL = new ExamBL();
            List <ExamEntities> pocoList = new List <ExamEntities>();

            pocoList = examBL.GetExamForDrp();

            List <ExamEntities> itmasterList = new List <ExamEntities>();

            foreach (ExamEntities up in pocoList)
            {
                ExamEntities unt = new ExamEntities();
                unt.ExamID   = up.ExamID;
                unt.ExamName = up.ExamName;

                itmasterList.Add(unt);
            }

            ViewBag.Exam = itmasterList.Select(x =>
                                               new SelectListItem()
            {
                Text  = x.ExamName,
                Value = x.ExamID.ToString()
            });
        }
예제 #3
0
        public List <SelectListItem> GetAnswerTypeListItem()
        {
            ExamBL objExamBL = new ExamBL();
            List <SelectListItem> lstSelectItem = new List <SelectListItem>();

            try
            {
                AnswerTypeMaster        obj         = new AnswerTypeMaster();
                List <AnswerTypeMaster> lstUserType = objExamBL.CRUDAnswerTypes(obj, "L");

                if (lstUserType != null)
                {
                    lstSelectItem.Add(new SelectListItem {
                        Text = "Select Answer Type", Value = ""
                    });
                    foreach (var u in lstUserType)
                    {
                        lstSelectItem.Add(new SelectListItem {
                            Text = Convert.ToString(u.AnswerType), Value = Convert.ToString(u.AnswerTypeId)
                        });
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lstSelectItem);
        }
예제 #4
0
        public ActionResult SaveOrUpdate(ExamEntities Examentities)
        {
            ExamBL Exambl         = new ExamBL();
            int    recordAffected = Exambl.SaveOrUpdateExam(Examentities);

            return(Json(recordAffected, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult DeleteExam(int ID)
        {
            ExamBL ExamBl         = new ExamBL();
            int    recordaffected = ExamBl.DeleteExam(ID);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public JsonResult GettblConfigByExamTime()
        {
            ExamBL examBL = new ExamBL();
            var    data   = examBL.GettblConfigByExamTime(Session["UserId"].ToString());

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        //private int GetQuestionCount(int QuestionCount)
        //{
        //    QuestionBL topicBL = new QuestionBL();
        //    return topicBL.GetAllQuestion(QuestionCount);
        //}

        //public JsonResult GetNextQuestion(string pageindex,string pagesize, string radioValue,string quesId)
        //{
        //    ExamPaper examPaper = new ExamPaper();
        //    QuestionBL topicBL = new QuestionBL();
        //    if (radioValue != null)
        //    {
        //        if(! String.IsNullOrEmpty(quesId))
        //            if(int.Parse(quesId) > 0 && !String.IsNullOrEmpty(radioValue))
        //        topicBL.SaveUserAnswer(int.Parse(radioValue), int.Parse(quesId), int.Parse(Session["UserId"].ToString()));
        //    }

        //    int questionCount = int.Parse(ConfigurationManager.AppSettings["QuestionCount"].ToString());

        //    examPaper = topicBL.GetNextPrevQuestion(int.Parse(pageindex), int.Parse(pagesize), int.Parse(Session["UserId"].ToString()));
        //    examPaper.QuestionEntities = examPaper.QuestionEntities.OrderBy(o => o.Id).ToList();

        //    return Json(examPaper, JsonRequestBehavior.AllowGet);

        //}

        public ExamPaper GetQuestion(string pageindex, string pagesize, string radioValue, string quesId, string currentTime)
        {
            ExamPaper  examPaper = new ExamPaper();
            QuestionBL topicBL   = new QuestionBL();

            if (radioValue != null && radioValue != String.Empty)
            {
                if (!String.IsNullOrEmpty(quesId))
                {
                    if (int.Parse(quesId) > 0 && !String.IsNullOrEmpty(radioValue))
                    {
                        topicBL.SaveUserAnswer(int.Parse(radioValue), int.Parse(quesId), int.Parse(Session["UserId"].ToString()), currentTime);
                    }
                }
            }
            else
            {
                ExamBL examBL = new ExamBL();
                examBL.UpdateExamTime(int.Parse(Session["UserId"].ToString()), currentTime);
            }

            int questionCount = int.Parse(ConfigurationManager.AppSettings["QuestionCount"].ToString());

            examPaper = topicBL.GetNextPrevQuestion(int.Parse(pageindex), int.Parse(pagesize), int.Parse(Session["UserId"].ToString()));
            examPaper.QuestionEntities = examPaper.QuestionEntities.OrderBy(o => o.Id).ToList();


            return(examPaper);
        }
예제 #8
0
        public JsonResult LoadAllExamPageWise()
        {
            int draw, start, length;
            int pageIndex = 0;

            if (null != Request.Form.GetValues("draw"))
            {
                draw   = int.Parse(Request.Form.GetValues("draw").FirstOrDefault().ToString());
                start  = int.Parse(Request.Form.GetValues("start").FirstOrDefault().ToString());
                length = int.Parse(Request.Form.GetValues("length").FirstOrDefault().ToString());
            }
            else
            {
                draw   = 1;
                start  = 0;
                length = 50;
            }

            if (start == 0)
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = (start / length) + 1;
            }

            ExamBL ExamBl       = new ExamBL();
            int    totalrecords = 0;

            List <ExamEntities> ExamList = new List <ExamEntities>();

            ExamList = ExamBl.GetAllExamPageWise(pageIndex, ref totalrecords, length);

            var data = ExamList;

            return(Json(new { draw = draw, recordsFiltered = totalrecords, recordsTotal = totalrecords, data = data }, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
 public StudentsController()
 {
     _ExamBL = new ExamBL();
 }
예제 #10
0
        public ActionResult GetExamByID(int ID)
        {
            ExamBL Exambl = new ExamBL();

            return(Json(Exambl.GetExamByID(ID), JsonRequestBehavior.AllowGet));
        }
예제 #11
0
 public AdminController()
 {
     _ExamBL = new ExamBL();
 }