コード例 #1
0
 public static string GetStatsClassHW_ScoreOrderDistribution(string ClassCode, string ResourceToResourceFolder_Id, string UserId)
 {
     try
     {
         DataTable dt          = new DataTable();
         string    StrTemp     = string.Empty;
         string    StudentsNum = string.Empty;
         if (ClassCode == "-1")
         {
             BLL_StatsTeacherHW_ScoreLevel          bllTeacherHW_ScoreLevel  = new BLL_StatsTeacherHW_ScoreLevel();
             List <Model_StatsTeacherHW_ScoreLevel> TeacherHW_ScoreLevelList = new List <Model_StatsTeacherHW_ScoreLevel>();
             TeacherHW_ScoreLevelList = bllTeacherHW_ScoreLevel.GetModelList(" TeacherID='" + UserId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by HWScoreLevelRight desc");
             foreach (var item in TeacherHW_ScoreLevelList)
             {
                 StrTemp += string.Format("<tr><td>{0}</td><td>{1}-{2}</td><td>{3}</td><td>{4}%</td><td>{5}%-{6}%</td></tr>"
                                          , item.HWScoreLevelName
                                          , item.HWScoreLevelLeft.ToString().clearLastZero()
                                          , item.HWScoreLevelRight.ToString().clearLastZero()
                                          , item.HWScoreLevelCount.ToString().clearLastZero()
                                          , item.HWScoreLevelCountRate.ToString().clearLastZero()
                                          , item.HWScoreLevelRateLeft
                                          , item.HWScoreLevelRateRight);
                 StudentsNum += item.HWScoreLevelCountRate.ToString().clearLastZero() + ",";
             }
             StudentsNum = StudentsNum.TrimEnd(',');
             string[] StrArr = StudentsNum.Split(',');
             string   StrNum = "[ {\"y\": " + StrArr[0] + ",\"name\": \"优秀\"},{\"y\": " + StrArr[1] + ",\"name\": \"良好\"},{\"y\": " + StrArr[2] + ",\"name\": \"中等\"},{\"y\": " + StrArr[3]
                               + ",\"name\": \"及格\"},{\"y\": " + StrArr[4] + ",\"name\": \"不及格\"}]";
             return(StrTemp + "|" + StrNum);
         }
         else
         {
             BLL_StatsClassHW_ScoreLevel          bllClassHW_ScoreLevel  = new BLL_StatsClassHW_ScoreLevel();
             List <Model_StatsClassHW_ScoreLevel> ClassHW_ScoreLevelList = new List <Model_StatsClassHW_ScoreLevel>();
             ClassHW_ScoreLevelList = bllClassHW_ScoreLevel.GetModelList(" ClassID='" + ClassCode + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by HWScoreLevelRight desc");
             foreach (var item in ClassHW_ScoreLevelList)
             {
                 StrTemp += string.Format("<tr><td>{0}</td><td>{1}-{2}</td><td>{3}</td><td>{4}%</td><td>{5}%-{6}%</td></tr>"
                                          , item.HWScoreLevelName
                                          , item.HWScoreLevelLeft.ToString().clearLastZero()
                                          , item.HWScoreLevelRight.ToString().clearLastZero()
                                          , item.HWScoreLevelCount.ToString().clearLastZero()
                                          , item.HWScoreLevelCountRate.ToString().clearLastZero()
                                          , item.HWScoreLevelRateLeft
                                          , item.HWScoreLevelRateRight);
                 StudentsNum += item.HWScoreLevelCountRate.ToString().clearLastZero() + ",";
             }
             StudentsNum = StudentsNum.TrimEnd(',');
             string[] StrArr = StudentsNum.Split(',');
             string   StrNum = "[ {\"y\": " + StrArr[0] + ",\"name\": \"优秀\"},{\"y\": " + StrArr[1] + ",\"name\": \"良好\"},{\"y\": " + StrArr[2] + ",\"name\": \"中等\"},{\"y\": " + StrArr[3]
                               + ",\"name\": \"及格\"},{\"y\": " + StrArr[4] + ",\"name\": \"不及格\"}]";
             return(StrTemp + "|" + StrNum);
         }
     }
     catch (Exception)
     {
         return("");
     }
 }
コード例 #2
0
        public static string GetStatsGradeHW_ScoreLevel(string GradeId, string ResourceToResourceFolder_Id)
        {
            try
            {
                StringBuilder StrBody      = new StringBuilder();
                StringBuilder StrBodyGrade = new StringBuilder();
                GradeId = GradeId.Filter();
                ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();
                string TempClassName          = string.Empty;
                string ClassHWScoreLevelCount = string.Empty;
                string TempDate = string.Empty;
                string Ydate    = string.Empty;
                string Ldate    = string.Empty;
                string Zdate    = string.Empty;
                string Jdate    = string.Empty;
                string Bdate    = string.Empty;
                ///年级
                BLL_StatsGradeHW_ScoreLevel          bllStatsGradeHW_ScoreLevel  = new BLL_StatsGradeHW_ScoreLevel();
                List <Model_StatsGradeHW_ScoreLevel> StatsGradeHW_ScoreLevelList = new List <Model_StatsGradeHW_ScoreLevel>();
                StatsGradeHW_ScoreLevelList = bllStatsGradeHW_ScoreLevel.GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' order by HWScoreLevelRight desc");
                List <Model_StatsGradeHW_ScoreLevel> listGradeDistict = StatsGradeHW_ScoreLevelList.Where((x, i) => StatsGradeHW_ScoreLevelList.FindIndex(z => z.Gradeid == x.Gradeid) == i).ToList();//去重后数据
                string    sqlGrade = "select ResourceToResourceFolder_Id,Gradeid,CommittedCount ,UncommittedCount ,AssignedCount,ClassAllCount  from StatsGradeHW_Score";
                DataTable dtGrade  = Rc.Common.DBUtility.DbHelperSQL.Query(sqlGrade).Tables[0];

                foreach (var item in listGradeDistict)
                {
                    DataRow[] drGrade = dtGrade.Select("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "' and Gradeid='" + item.Gradeid + "'");
                    StrBodyGrade.Append("<tr><td>年级</td>");
                    List <Model_StatsGradeHW_ScoreLevel> listSub = StatsGradeHW_ScoreLevelList.Where(x => x.Gradeid == item.Gradeid).ToList();//子级数据
                    foreach (var itemSub in listSub)
                    {
                        StrBodyGrade.AppendFormat("<td>{0}</td>", itemSub.HWScoreLevelCount.ToString().clearLastZero());
                        if (itemSub.HWScoreLevelName == "优秀")
                        {
                            Ydate = itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "良好")
                        {
                            Ldate = itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "中等")
                        {
                            Zdate = itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "及格")
                        {
                            Jdate = itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "不及格")
                        {
                            Bdate = itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                    }
                    StrBodyGrade.AppendFormat("<td>{0}</td><td>{1}</td><td>{2}</td>"
                                              , item.GradeAllCount
                                              , drGrade[0]["AssignedCount"].ToString().clearLastZero() + "/" + (Convert.ToInt32(drGrade[0]["ClassAllCount"]) - Convert.ToInt32(drGrade[0]["AssignedCount"]))
                                              , drGrade[0]["CommittedCount"].ToString().clearLastZero() + "/" + drGrade[0]["UncommittedCount"].ToString().clearLastZero());
                }
                //1,2,3
                ///班级
                BLL_StatsClassHW_ScoreLevel          bllStatsClassHW_ScoreLevel  = new BLL_StatsClassHW_ScoreLevel();
                List <Model_StatsClassHW_ScoreLevel> StatsClassHW_ScoreLevelList = new List <Model_StatsClassHW_ScoreLevel>();
                List <Model_StatsClassHW_ScoreLevel> listAll = new List <Model_StatsClassHW_ScoreLevel>();                                                //所有数据
                listAll = bllStatsClassHW_ScoreLevel.GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' order by HWScoreLevelRight desc");
                List <Model_StatsClassHW_ScoreLevel> listDistict = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据
                string    sqlClass = "select ResourceToResourceFolder_Id,Gradeid,ClassID,CommittedCount ,UncommittedCount ,AssignedCount,ClassAllCount  from StatsClassHW_Score";
                DataTable dtClass  = Rc.Common.DBUtility.DbHelperSQL.Query(sqlClass).Tables[0];
                foreach (var item in listDistict)
                {
                    DataRow[] drClass = dtClass.Select("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "' and Gradeid='" + item.Gradeid + "' and ClassID='" + item.ClassID + "'");
                    StrBody.AppendFormat("<tr><td>{0}</td>", item.ClassName);
                    List <Model_StatsClassHW_ScoreLevel> listSub = listAll.Where(x => x.ClassID == item.ClassID).ToList();//子级数据
                    foreach (var itemSub in listSub)
                    {
                        StrBody.AppendFormat("<td>{0}</td>", itemSub.HWScoreLevelCount.ToString().clearLastZero());
                        if (itemSub.HWScoreLevelName == "优秀")
                        {
                            Ydate += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "良好")
                        {
                            Ldate += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "中等")
                        {
                            Zdate += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "及格")
                        {
                            Jdate += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                        if (itemSub.HWScoreLevelName == "不及格")
                        {
                            Bdate += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }
                    }
                    StrBody.AppendFormat("<td>{0}</td><td>{1}</td><td>{2}</td>"
                                         , Convert.ToInt32(item.ClassAllCount)
                                         , drClass[0]["AssignedCount"].ToString().clearLastZero() + "/" + (Convert.ToInt32(drClass[0]["ClassAllCount"]) - Convert.ToInt32(drClass[0]["AssignedCount"]))
                                         , drClass[0]["CommittedCount"].ToString().clearLastZero() + "/" + drClass[0]["UncommittedCount"].ToString().clearLastZero());
                    TempClassName += item.ClassName.TrimEnd() + "|";
                }
                StrBody.AppendFormat("</tr>");
                TempDate = "[{\"name\":\"优秀\",\"data\":[" + Ydate.TrimEnd(',') + "]},"
                           + "{\"name\":\"良好\",\"data\":[" + Ldate.TrimEnd(',') + "]},"
                           + "{\"name\":\"中等\",\"data\":[" + Zdate.TrimEnd(',') + "]},"
                           + "{\"name\":\"及格\",\"data\":[" + Jdate.TrimEnd(',') + "]}," + "{\"name\":\"不及格\",\"data\":[" + Bdate.TrimEnd(',') + "]}]";
                if (string.IsNullOrEmpty(StrBody.ToString()))
                {
                    return("");
                }
                //    [
                //    {
                //        name: '优秀',
                //        data: [49, 71, 76, 99, 100, 76, 35, 48, 62, 94, 95, 54]
                //    },
                //]
                else
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new
                    {
                        TempClassName = "全年级|" + TempClassName.TrimEnd('|'),
                        TempDate = TempDate,
                        tb = StrBody.ToString(),
                        tbGrade = StrBodyGrade.ToString(),
                    }));
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
コード例 #3
0
        public static string StatsClassHW_ScoreLevel(string ResourceToResourceFolder_Id, string UserId, string ClassID)
        {
            try
            {
                ClassID = "";
                string StrTemp              = string.Empty;
                string StrTempAll           = string.Empty;
                string StrScore             = string.Empty;
                string StrClassname         = string.Empty;
                int    SumHWScoreLevelCount = 0;
                string DateSour             = string.Empty;
                string StrScoreTemp         = string.Empty;
                string StrWhere             = "ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id.Filter() + "' and TeacherID='" + UserId.Filter() + "'";
                if (!string.IsNullOrEmpty(ClassID.Filter()))
                {
                    StrWhere += " and ClassID=" + ClassID.Filter();

                    BLL_StatsClassHW_ScoreLevel          bllStatsClassHW_ScoreLevel  = new BLL_StatsClassHW_ScoreLevel();
                    List <Model_StatsClassHW_ScoreLevel> StatsClassHW_ScoreLevelList = new List <Model_StatsClassHW_ScoreLevel>();
                    List <Model_StatsClassHW_ScoreLevel> listAll = new List <Model_StatsClassHW_ScoreLevel>();                                                //所有数据
                    listAll = bllStatsClassHW_ScoreLevel.GetModelList(StrWhere + " order by HWScoreLevelRight desc");
                    List <Model_StatsClassHW_ScoreLevel> listDistict = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据
                    //{name: '1班',data: [5, 13, 12, 4, 1]},
                    foreach (var item in listDistict)
                    {
                        List <Model_StatsClassHW_ScoreLevel> listSub = listAll.Where(x => x.ClassID == item.ClassID).ToList();//子级数据
                        foreach (var itemSub in listSub)
                        {
                            StrScore            += "<td>" + itemSub.HWScoreLevelCount.ToString().clearLastZero() + "</td>";
                            SumHWScoreLevelCount = SumHWScoreLevelCount + Convert.ToInt32(itemSub.HWScoreLevelCount.ToString().clearLastZero());
                            StrScoreTemp        += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }

                        StrTemp             += "<tr><td>" + item.ClassName + "</td>" + StrScore + "<td>" + SumHWScoreLevelCount + "</td></tr>";
                        DateSour            += "{\"name\":\"" + item.ClassName + "\",\"data\":[" + StrScoreTemp.TrimEnd(',') + "]},";
                        StrScore             = "";
                        SumHWScoreLevelCount = 0;
                        StrScoreTemp         = "";
                    }
                }
                else
                {
                    BLL_StatsClassHW_ScoreLevel          bllStatsClassHW_ScoreLevel  = new BLL_StatsClassHW_ScoreLevel();
                    List <Model_StatsClassHW_ScoreLevel> StatsClassHW_ScoreLevelList = new List <Model_StatsClassHW_ScoreLevel>();
                    List <Model_StatsClassHW_ScoreLevel> listAll = new List <Model_StatsClassHW_ScoreLevel>();                                                //所有数据
                    listAll = bllStatsClassHW_ScoreLevel.GetModelList(StrWhere + " order by HWScoreLevelRight desc");
                    List <Model_StatsClassHW_ScoreLevel> listDistict = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据
                    //{name: '1班',data: [5, 13, 12, 4, 1]},
                    foreach (var item in listDistict)
                    {
                        List <Model_StatsClassHW_ScoreLevel> listSub = listAll.Where(x => x.ClassID == item.ClassID).ToList();//子级数据
                        foreach (var itemSub in listSub)
                        {
                            StrScore            += "<td>" + itemSub.HWScoreLevelCount.ToString().clearLastZero() + "</td>";
                            SumHWScoreLevelCount = SumHWScoreLevelCount + Convert.ToInt32(itemSub.HWScoreLevelCount.ToString().clearLastZero());
                            StrScoreTemp        += itemSub.HWScoreLevelCount.ToString().clearLastZero() + ",";
                        }

                        StrTemp             += "<tr><td>" + item.ClassName + "</td>" + StrScore + "<td>" + SumHWScoreLevelCount + "</td></tr>";
                        DateSour            += "{\"name\":\"" + item.ClassName + "\",\"data\":[" + StrScoreTemp.TrimEnd(',') + "]},";
                        StrScore             = "";
                        SumHWScoreLevelCount = 0;
                        StrScoreTemp         = "";
                    }
                    string teacherStrScore = string.Empty;
                    BLL_StatsTeacherHW_ScoreLevel          bllStatsTeacherStudentHW_Score = new BLL_StatsTeacherHW_ScoreLevel();
                    List <Model_StatsTeacherHW_ScoreLevel> StatsTeacherHW_ScoreLevelList  = new List <Model_StatsTeacherHW_ScoreLevel>();
                    StatsTeacherHW_ScoreLevelList = bllStatsTeacherStudentHW_Score.GetModelList("TeacherID='" + UserId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by HWScoreLevelRight desc");
                    SumHWScoreLevelCount          = 0;
                    foreach (var item in StatsTeacherHW_ScoreLevelList)
                    {
                        teacherStrScore     += "<td>" + item.HWScoreLevelCount.ToString().clearLastZero() + "</td>";
                        SumHWScoreLevelCount = SumHWScoreLevelCount + Convert.ToInt32(item.HWScoreLevelCount.ToString().clearLastZero());
                    }
                    StrTempAll = "<tr><td>全部班级</td>" + teacherStrScore + "<td>" + SumHWScoreLevelCount + "</td></tr>";
                }

                return(StrTemp + "|[" + DateSour.TrimEnd(',') + "]|" + StrTempAll);
            }

            catch (Exception)
            {
                return("");
            }
        }