Exemplo n.º 1
0
        /// <summary>
        /// 选项统计
        /// </summary>
        /// <param name="zyId"></param>
        /// <param name="schoolId"></param>
        /// <param name="gradeId"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        public ActionResult GetOptionBar(long zyId, int schoolId, int gradeId, int classId)
        {
            int             id  = IdNamingHelper.Decrypt(IdNamingHelper.IdTypeEnum.Zy, zyId);
            dto_Echart_Bar2 deb = B_Analyze.GetOptionSelectCount(id, schoolId, gradeId, classId);

            if (deb != null)
            {
                ViewBag.Category = string.Join(",", deb.category);
                ViewBag.AData    = string.Join(",", deb.optiona);
                ViewBag.BData    = string.Join(",", deb.optionb);
                ViewBag.CData    = string.Join(",", deb.optionc);
                ViewBag.DData    = string.Join(",", deb.optiond);
            }
            ViewBag.SubmitCount = B_Analyze.GetZySubmitCount(id, schoolId, gradeId, classId);
            return(PartialView());
        }
Exemplo n.º 2
0
        public static dto_Echart_Bar2 GetOptionSelectCount(int zyId, int schoolId, int gradeId, int classId)
        {
            dto_Echart_Bar2 deb      = null;
            List <string>   category = null;
            List <string>   optiona  = null;
            List <string>   optionb  = null;
            List <string>   optionc  = null;
            List <string>   optiond  = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(AnalyzeConnString),
                                                                  "select QuesNumTip, OptionA, OptionB, OptionC, OptionD from T_OptionSelectCount where ZyId = @ZyId and SchoolId = @SchoolId and GradeId = @GradeId and ClassId = @ClassId order by QuesNum",
                                                                  "@ZyId".ToInt32InPara(zyId),
                                                                  "@SchoolId".ToInt32InPara(schoolId),
                                                                  "@GradeId".ToInt32InPara(gradeId),
                                                                  "@ClassId".ToInt32InPara(classId)))
            {
                if (dr != null && dr.HasRows)
                {
                    deb      = new dto_Echart_Bar2();
                    category = new List <string>();
                    optiona  = new List <string>();
                    optionb  = new List <string>();
                    optionc  = new List <string>();
                    optiond  = new List <string>();
                    while (dr.Read())
                    {
                        category.Add(string.Concat("第", dr[0].ToString(), "题"));
                        optiona.Add(dr[1].ToString());
                        optionb.Add(dr[2].ToString());
                        optionc.Add(dr[3].ToString());
                        optiond.Add(dr[4].ToString());
                    }
                    deb.category = category;
                    deb.optiona  = optiona;
                    deb.optionb  = optionb;
                    deb.optionc  = optionc;
                    deb.optiond  = optiond;
                }
            }

            return(deb);
        }