Esempio n. 1
0
        /// <summary>
        /// 获取问题列表
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="keyWord"></param>
        /// <returns></returns>
        public JsonResult GetQuestionList(int pageSize, int pageIndex, string keyWord = "")
        {
            BLL.Question          bll = new BLL.Question();
            List <Model.Question> lst = new List <Model.Question>();

            lst = bll.GetQuestionList(pageIndex, pageSize, keyWord);
            int count = bll.Count();

            return(Json(new { total = count, rows = lst }));
        }
Esempio n. 2
0
        public JsonResult deleteNaireQuestion(int Id)
        {
            BLL.Question bll    = new BLL.Question();
            int          result = bll.deleteNaireQuestion(Id);

            if (result <= 0)
            {
                return(Json("删除失败"));
            }
            else
            {
                return(Json("删除" + result + "记录"));
            }
        }
Esempio n. 3
0
        public JsonResult Deletenaire(string[] ids)
        {
            BLL.Question bll    = new BLL.Question();
            int          result = bll.Deletenaire(ids);

            if (result <= 0)
            {
                return(Json("删除失败"));
            }
            else
            {
                return(Json("删除" + result + "记录"));
            }
        }
Esempio n. 4
0
        //public JsonResult GetTeacher(int SchoolId)
        //{
        //    BLL.Question bll = new BLL.Question();
        //    return Json(bll.GetTeacher(SchoolId));
        //}

        public JsonResult AddSaveNaire(string QuestionnaireName, DateTime StartTime, DateTime EndTime, int SchoolName,
                                       /* int teacherName,*/ int className)
        {
            BLL.Question bll = new BLL.Question();
            if (bll.AddSaveNaire(QuestionnaireName, StartTime,
                                 EndTime, SchoolName, /*teacherName, */ className) > 0)
            {
                return(Json("添加成功"));
            }
            else
            {
                return(Json("添加失败"));
            }
        }
Esempio n. 5
0
        public string AddTestQuestion(string data, long testInfoId)
        {
            string[]        datas  = data.Split('#');
            string          stem   = datas[0];
            Question        Q      = new Question();
            List <question> ques   = Q.Search(u => u.qusetion_Stem == stem);
            string          qclass = datas[1];

            if (ques.Count < 1)
            {
                //Create new
                question q = new question();


                List <@class> c = new _Class().Search(u => u.class_Class == qclass);
                if (c.Count < 1)
                {
                    return("不存在次类别,添加失败!");
                }
                q.question_IsDel   = false;
                q.qusetion_Stem    = datas[0];
                q.question_ClassId = c[0].class_Id;
                q.question_Option1 = datas[2];
                q.question_Option2 = datas[3];
                q.question_Option3 = datas[4];
                q.question_Option4 = datas[5];
                q.question_Option5 = datas[6];
                q.question_Option6 = datas[7];
                q.question_Option7 = datas[8];
                try
                {
                    new Question().Add(q);
                }
                catch
                {
                    return("数据插入异常!");
                }

                test t = new test();
                t.test_QuestionId = q.question_Id;
                t.test_TestInfoId = testInfoId;
                try
                {
                    Add(t);
                }
                catch
                {
                    return("数据插入异常!");
                }
            }
            else
            {
                long qId   = ques[0].question_Id;
                long tests = new Test().SearchCount(k => k.test_QuestionId == qId);
                if (tests > 1)
                {
                    return("此问卷中已包含此问题,请勿重复添加!");
                }
                List <@class> c = new _Class().Search(u => u.class_Class == qclass);
                if (c.Count < 1)
                {
                    return("不存在次类别,添加失败!");
                }
                test t = new test();
                t.test_QuestionId = ques[0].question_Id;
                t.test_TestInfoId = testInfoId;

                try
                {
                    Add(t);
                }
                catch
                {
                    return("数据插入异常!");
                }
            }
            return("ok");
        }