示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        public ActionResult AddMcqQuestions(int QgrupId = 1)
        {
            if (Session["uid"] == null)
            {
                return(Redirect("../Account/Login?ReturnUrl=/Practice/AddMcqQuestions?QgrupId=" + QgrupId));
            }

            ViewBag.QgrupId = QgrupId;

            AddQuestionModel model = new AddQuestionModel();
            QuestionGroup    grp   = new QuestionGroup();

            grp           = grp.GetById(con, QgrupId);
            model.QgrupId = QgrupId;
            model.Qgrup   = grp.QuestionGroupName;
            return(View(model));
        }
示例#4
0
        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]));
        }