public ActionResult Create(Question m)
        {
            if (ModelState.IsValid)
            {

                if (um.Create(m))
                {
                    return Redirect("/Contents/html/parent_reload.htm");
                }
            }

            ViewBag.Types = um.GetTypeList(m.Q_Type);
            ViewBag.Classifies = um.GetClassifyList(m.QC_Id);

            return View(m);
        }
        public ActionResult Edit(Question m)
        {
            if (ModelState.IsValid)
            {

                if (um.Edit(m))
                {
                    return Redirect("/Contents/html/layer_close.htm" + Request.UrlReferrer.Query);
                }
            }

            ViewBag.Types = um.GetTypeList(m.Q_Type);
            ViewBag.Classifies = um.GetClassifyList(m.Q_Status, m.QC_Id);

            return View(m);
        }
        private void DeleteErrorQuestion(Question q)
        {
            if (q.Q_Type == "判断题" || q.Q_Type == "公文改错题" || q.Q_Type == "计算题"
                || q.Q_Type == "案例分析题" || q.Q_Type == "问答题")
            {
                return;
            }

            if (q.Q_OptionalAnswer == "" || q.Q_OptionalAnswer == "{}" || q.Q_OptionalAnswer == "[]"
                || q.Q_ModelAnswer == "" || q.Q_ModelAnswer == "{}" || q.Q_ModelAnswer == "[]")
            {
                q.Q_Status = (Byte)Status.Delete;
            }
        }
Exemplo n.º 4
0
        public Question GetNew()
        {
            Question model;

            model = new Question()
            {
                Q_Id = 0,
                Q_Type = "",
                QC_Id = 0,
                Q_Content = "",
                Q_OptionalAnswer = "",
                Q_ModelAnswer = "",
                Q_DifficultyCoefficient = 0,
                Q_Score = 0,
                Q_Remark = "",
                Q_AddTime = DateTime.Now,
                Q_Status = (Byte)Status.Available
            };

            return model;
        }
Exemplo n.º 5
0
        public Boolean Edit(Question model)
        {
            try
            {
                olsEni.Entry(model).State = EntityState.Modified;
                olsEni.SaveChanges();

                return true;
            }
            catch (Exception ex)
            {
                StaticHelper.RecordSystemLog(ex);
                return false;
            }
        }
Exemplo n.º 6
0
        public Boolean Create(Question model)
        {
            try
            {

                Int32 id;

                id = GetQId();

                model.Q_Id = id;
                olsEni.Questions.Add(model);
                olsEni.SaveChanges();

                return true;
            }
            catch (Exception ex)
            {
                StaticHelper.RecordSystemLog(ex);
                return false;
            }
        }