Пример #1
0
        /// <summary>
        /// 学生提交及得分报表
        /// </summary>
        /// <param name="zyId"></param>
        /// <param name="schoolId"></param>
        /// <param name="gradeId"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        public static dto_Echart_Bar GetStudentPoint(int zyId, int schoolId, int gradeId, int classId)
        {
            dto_Echart_Bar  deb = null;
            List <string>   x   = null;
            List <string>   y   = null;
            List <DateTime> o   = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(AnalyzeConnString),
                                                                  "select StudentId, SubmitDate, Score from T_StudentPoint where ZyId = @ZyId and SchoolId = @SchoolId and GradeId = @GradeId and ClassId = @ClassId order by SubmitDate",
                                                                  "@ZyId".ToInt32InPara(zyId),
                                                                  "@SchoolId".ToInt32InPara(schoolId),
                                                                  "@GradeId".ToInt32InPara(gradeId),
                                                                  "@ClassId".ToInt32InPara(classId)))
            {
                if (dr != null && dr.HasRows)
                {
                    deb = new dto_Echart_Bar();
                    x   = new List <string>();
                    y   = new List <string>();
                    o   = new List <DateTime>();
                    while (dr.Read())
                    {
                        x.Add(string.Concat(dr[0].ToString()));
                        y.Add(dr[2].ToString());
                        o.Add(DateTime.Parse(dr[1].ToString()));
                    }
                    deb.x = x;
                    deb.y = y;
                    deb.o = o;
                }
            }

            return(deb);
        }
Пример #2
0
        /// <summary>
        /// 作业试题正确数报表
        /// </summary>
        /// <param name="zyId"></param>
        /// <param name="schoolId"></param>
        /// <param name="gradeId"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        public static dto_Echart_Bar GetQuesCorrectCount(int zyId, int schoolId, int gradeId, int classId)
        {
            dto_Echart_Bar deb = null;
            List <string>  x   = null;
            List <string>  y   = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(AnalyzeConnString),
                                                                  "select QuesNumTip, Count from T_QuesCorrectCount 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_Bar();
                    x   = new List <string>();
                    y   = new List <string>();
                    while (dr.Read())
                    {
                        x.Add(string.Concat("第", dr[0].ToString(), "题"));
                        y.Add(dr[1].ToString());
                    }
                    deb.x = x;
                    deb.y = y;
                }
            }

            return(deb);
        }
Пример #3
0
        /// <summary>
        /// 试题统计
        /// </summary>
        /// <param name="zyId"></param>
        /// <returns></returns>
        public ActionResult GetQuesBar(long zyId, int schoolId, int gradeId, int classId)
        {
            int id = IdNamingHelper.Decrypt(IdNamingHelper.IdTypeEnum.Zy, zyId);

            dto_Echart_Bar deb = B_Analyze.GetQuesCorrectCount(id, schoolId, gradeId, classId);

            if (deb != null)
            {
                ViewBag.xData = string.Join(",", deb.x);
                ViewBag.yData = string.Join(",", deb.y);
            }

            ViewBag.ObjectiveCount = deb == null ? 0 : deb.x.Count;
            ViewBag.SubmitCount    = B_Analyze.GetZySubmitCount(id, schoolId, gradeId, classId);
            ViewBag.Worst          = deb == null ? "" : deb.x[deb.y.IndexOf(deb.y.Min(a => a))];
            return(PartialView());
        }
Пример #4
0
        /// <summary>
        /// 提交统计
        /// </summary>
        /// <param name="zyId"></param>
        /// <returns></returns>
        public ActionResult GetSubmitBar(long zyId, int schoolId, int gradeId, int classId)
        {
            int id = IdNamingHelper.Decrypt(IdNamingHelper.IdTypeEnum.Zy, zyId);

            dto_Echart_Bar deb = B_Analyze.GetStudentPoint(id, schoolId, gradeId, classId);

            if (deb != null)
            {
                for (int i = 0; i < deb.x.Count; i++)
                {
                    if (deb.x[i] == "0")
                    {
                        deb.x[i] = "试用学生";
                    }
                    else
                    {
                        string tname = B_UserRedis.GetUser(int.Parse(deb.x[i])).TrueName;
                        deb.x[i] = string.IsNullOrEmpty(tname) ? "未设姓名" : tname;
                    }
                }

                ViewBag.xData = string.Join(",", deb.x);
                ViewBag.yData = string.Join(",", deb.y);
            }
            int ObjectiveCount = JsonConvert.DeserializeObject <List <dto_ZyQuestion> >(B_ZyRedis.GetQdbZyQuesJson(id)).Count(a => Const.OBJECTIVE_QUES_TYPES.Contains(a.PTypeId));

            ViewBag.ObjectiveCount = ObjectiveCount;
            int SubmitCount = deb == null ? 0 : deb.x.Count;

            ViewBag.SubmitCount = SubmitCount;
            double ScoreRate = 0;

            ScoreRate         = (SubmitCount == 0 || ObjectiveCount == 0 || deb == null) ? 0 : Math.Round((deb.y.Sum(a => int.Parse(a)) * 1.0 / (ObjectiveCount * SubmitCount)), 4) * 100;
            ViewBag.ScoreRate = ScoreRate;
            dto_Zy zy = B_ZyRedis.GetZy(id);

            ViewBag.InTime   = deb == null ? 0 : deb.o.Count(a => a <= zy.DueDate);
            ViewBag.OverTime = deb == null ? 0 : deb.o.Count(a => a > zy.DueDate);
            return(PartialView());
        }