コード例 #1
0
        /// <summary>
        /// 输出主式题的Json
        /// </summary>
        /// <param name="q"></param>
        /// <returns></returns>
        private string getQuesJson(Song.Entities.Questions q)
        {
            q           = quesClear(q);
            q           = Extend.Questions.TranText(q);        //处理文件
            q.Qus_Title = q.Qus_Title.Replace("\"", "&quot;"); //转换双引号
            string quesJs = q.ToJson("Qus_ID,Qus_Title,Qus_Diff,Qus_Type,Qus_UID,Qus_Number", null);

            //如果是单选题,或多选题,或填空题
            if (q.Qus_Type == 1 || q.Qus_Type == 2 || q.Qus_Type == 5)
            {
                quesJs = getAnserJson(q, quesJs);
            }
            return(quesJs);
        }
コード例 #2
0
        //获取当前学科下的所有试卷
        protected void Page_Load(object sender, EventArgs e)
        {
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
            EmpAccount currentUser         = Extend.LoginState.Admin.CurrentUser;

            if (currentUser == null)
            {
                Response.Write("");
                Response.End();
                return;
            }
            //当前员所处的学科
            Song.Entities.Team team = Business.Do <ITeam>().TeamSingle((int)currentUser.Team_ID);
            if (team != null)
            {
                sbjid = (int)team.Sbj_ID;
            }
            //员工选择的每日一练的学科范围
            string sel = Business.Do <ISystemPara>()["SubjectForAccout_" + currentUser.Acc_Id].String;

            string[] arr = sel.Split(',');
            if (arr.Length > 0)
            {
                arr[arr.Length - 1] = sbjid.ToString();
            }
            //随机抽取学科
            if (arr.Length > 1)
            {
                Random rand  = new Random();
                int    index = rand.Next(0, arr.Length - 1);
                sbjid = Convert.ToInt32(arr[index]);
            }
            Song.Entities.Questions[] ques = Business.Do <IQuestions>().QuesRandom(org.Org_ID, sbjid, -1, -1, type, diff, diff, true, 1);
            string tm = "";

            if (ques.Length > 0)
            {
                Song.Entities.Questions q = ques[0];
                q  = replaceText(q);
                tm = q.ToJson();
                //如果是单选题,或多选题
                if (q.Qus_Type == 1 || q.Qus_Type == 2 || q.Qus_Type == 5)
                {
                    tm = getAnserJson(q, tm);
                }
            }

            Response.Write(tm);
            Response.End();
        }
コード例 #3
0
        //获取当前学科下的所有试卷
        protected void Page_Load(object sender, EventArgs e)
        {
            Song.Entities.Organization org  = Business.Do <IOrganization>().OrganCurrent();
            Song.Entities.Questions[]  ques = Business.Do <IQuestions>().QuesRandom(org.Org_ID, sbjid, -1, -1, type, diff, diff, true, 1);
            string tm = "";

            if (ques.Length > 0)
            {
                Song.Entities.Questions q = ques[0];
                q  = replaceText(q);
                tm = q.ToJson();
                //如果是单选题,或多选题
                if (q.Qus_Type == 1 || q.Qus_Type == 2 || q.Qus_Type == 5)
                {
                    tm = getAnserJson(q, tm);
                }
            }

            Response.Write(tm);
            Response.End();
        }