public static string GetStatsGradeHW_Score(string GradeId, string ResourceToResourceFolder_Id)
 {
     try
     {
         GradeId = GradeId.Filter();
         ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();
         string TempGrade = string.Empty;
         string avgScore  = string.Empty;
         string Temp      = " <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>";
         string TempDate  = string.Empty;
         BLL_StatsClassHW_Score          bllStatsClassHW_Score  = new BLL_StatsClassHW_Score();
         List <Model_StatsClassHW_Score> StatsClassHW_ScoreList = new List <Model_StatsClassHW_Score>();
         StatsClassHW_ScoreList = bllStatsClassHW_Score.GetModelList("GradeID='" + GradeId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by AVGScore desc");
         int i = 0;
         foreach (var item in StatsClassHW_ScoreList)
         {
             TempDate  += string.Format(Temp, i + 1, item.ClassName, item.TeacherName, item.AVGScore.ToString().clearLastZero());
             TempGrade += "" + item.ClassName + ",";
             avgScore  += item.AVGScore + ",";
             i++;
         }
         if (string.IsNullOrEmpty(TempDate))
         {
             return("");
         }
         else
         {
             return(TempDate + "|" + TempGrade.TrimEnd(',') + "|" + avgScore.TrimEnd(',') + "");
         }
     }
     catch (Exception)
     {
         return("");
     }
 }
Beispiel #2
0
 public static string GetStatsGradeHW_Score(string GradeId, string ResourceToResourceFolder_Id)
 {
     try
     {
         GradeId = GradeId.Filter();
         ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();
         string TempAll     = "<tr><td class='text-left'>全部</td><td class='text-left'>{8}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{0}</td><td>{9}</td><td>{6}/{7}</td></tr>";
         string Temps       = "<tr><td class='text-left'>{9}</td><td class='text-left'>{8}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{0}</td><td>{10}</td><td>{6}/{7}</td></tr>";
         string TempDate    = string.Empty;
         string TempDateAll = string.Empty;
         BLL_StatsGradeHW_Score          bllStatsGradeHW_Score  = new BLL_StatsGradeHW_Score();
         List <Model_StatsGradeHW_Score> StatsGradeHW_ScoreList = new List <Model_StatsGradeHW_Score>();
         StatsGradeHW_ScoreList = bllStatsGradeHW_Score.GetModelList("GradeID='" + GradeId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "'");
         foreach (var item in StatsGradeHW_ScoreList)
         {
             TempDateAll = string.Format(TempAll, item.ClassAllCount.ToString().clearLastZero(), item.HighestScore.ToString().clearLastZero(), item.LowestScore.ToString().clearLastZero(), item.AVGScore.ToString().clearLastZero(), item.Median.ToString().clearLastZero(), item.Mode, item.CommittedCount.ToString().clearLastZero(), item.UncommittedCount.ToString().clearLastZero(), "-", item.AssignedCount.ToString().clearLastZero() + "/" + (Convert.ToInt32(item.ClassAllCount) - Convert.ToInt32(item.AssignedCount)));
         }
         BLL_StatsClassHW_Score          bllStatsClassHW_Score  = new BLL_StatsClassHW_Score();
         List <Model_StatsClassHW_Score> StatsClassHW_ScoreList = new List <Model_StatsClassHW_Score>();
         StatsClassHW_ScoreList = bllStatsClassHW_Score.GetModelList("GradeID='" + GradeId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "'");
         foreach (var item in StatsClassHW_ScoreList)
         {
             TempDate += string.Format(Temps, item.ClassAllCount.ToString().clearLastZero(), item.HighestScore.ToString().clearLastZero(), item.LowestScore.ToString().clearLastZero(), item.AVGScore.ToString().clearLastZero(), item.Median.ToString().clearLastZero(), item.Mode, item.CommittedCount.ToString().clearLastZero(), item.UncommittedCount.ToString().clearLastZero(), item.TeacherName, item.ClassName, item.AssignedCount.ToString().clearLastZero() + "/" + (Convert.ToInt32(item.ClassAllCount) - Convert.ToInt32(item.AssignedCount)));
         }
         return(TempDateAll + "†" + TempDate);
     }
     catch (Exception)
     {
         return("");
     }
 }
 public static string getData(string SubjectID, string ClassID, string GradeID)
 {
     try
     {
         SubjectID = SubjectID.Filter();
         ClassID   = ClassID.Filter();
         GradeID   = GradeID.Filter();
         string strAVGScore     = string.Empty;
         string strAVGScoreRate = string.Empty;
         string strHWScore      = string.Empty;
         //string strScoreOrder = string.Empty;
         string strHWName = string.Empty;
         BLL_StatsClassHW_Score          bll_StatsClassHW_Score = new BLL_StatsClassHW_Score();
         List <Model_StatsClassHW_Score> list = new List <Model_StatsClassHW_Score>();
         list = bll_StatsClassHW_Score.GetModelList("SubjectID='" + SubjectID + "' AND ClassID = '" + ClassID + "'AND GradeID = '" + GradeID + "' ORDER BY HomeWorkCreateTime ASC");
         foreach (var item in list)
         {
             strAVGScore     += item.AVGScore.ToString() + ",";
             strAVGScoreRate += item.AVGScoreRate.ToString() + ",";
             strHWScore      += item.HW_Score.ToString() + ",";
             strHWName       += ((!string.IsNullOrEmpty(item.Resource_Name.ToString())) ? item.Resource_Name.ToString().ReplaceForFilter() : "-") + ",";
         }
         return(Newtonsoft.Json.JsonConvert.SerializeObject(new
         {
             AVGScore = strAVGScore.TrimEnd(','),
             AVGScoreRate = strAVGScoreRate.TrimEnd(','),
             HWScore = strHWScore.TrimEnd(','),
             HWName = strHWName.TrimEnd(',')
         }));
     }
     catch (Exception)
     {
         return("err");
     }
 }
        public static string GetStatsClassHW_Score(string ResourceToResourceFolder_Id, string UserId, string ClassID)
        {
            try
            {
                string StrWhere = "TeacherID='" + UserId.Filter() + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id.Filter() + "'";
                //if (!string.IsNullOrEmpty(ClassID))
                //{
                //    StrWhere += "and ClassID='" + ClassID.Filter() + "'";
                //}
                string StrTemp = string.Empty;
                BLL_StatsClassHW_Score          bllcswso = new BLL_StatsClassHW_Score();
                List <Model_StatsClassHW_Score> ClassScoreOverviewList = new List <Model_StatsClassHW_Score>();
                ClassScoreOverviewList = bllcswso.GetModelList(StrWhere);
                string Temp = "<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}/{7}</td><td>{8}/{9}</td></tr>";
                foreach (var item in ClassScoreOverviewList)
                {
                    StrTemp += string.Format(Temp, item.ClassName, item.AVGScore.ToString().clearLastZero(), item.HighestScore.ToString().clearLastZero()
                                             , item.LowestScore.ToString().clearLastZero(), item.Median.ToString().clearLastZero(), item.Mode, item.CommittedCount.ToString().clearLastZero(), item.UncommittedCount.ToString().clearLastZero(), item.CorrectedCount.ToString().clearLastZero(), item.UnCorrectedCount.ToString().clearLastZero());
                }
                return(StrTemp);
            }

            catch (Exception)
            {
                return("");
            }
        }
 public static string GetStatsClassHW_ScoreOverview(string ClassCode, string ResourceToResourceFolder_Id, string UserId)
 {
     try
     {
         ClassCode = ClassCode.Filter();
         ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();
         UserId = UserId.Filter();
         CommonHandel                      chbll     = new CommonHandel();
         BLL_StatsTeacherHW_Score          bllsthwso = new BLL_StatsTeacherHW_Score();
         List <Model_StatsTeacherHW_Score> teacherScoreOverviewList = new List <Model_StatsTeacherHW_Score>();
         DataTable dt      = new DataTable();
         string    StrTemp = string.Empty;
         if (ClassCode == "-1")
         {
             HttpContext.Current.Session["StatsClassClassId"] = "-1";
             teacherScoreOverviewList = bllsthwso.GetModelList(" TeacherID='" + UserId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' ");
             foreach (var item in teacherScoreOverviewList)
             {
                 StrTemp += string.Format("<tr><td>全部</td><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td><td>{8}</td><td>{9}</td></tr>"
                                          , item.ClassAllCount
                                          , item.HighestScore.ToString().clearLastZero()
                                          , item.LowestScore.ToString().clearLastZero()
                                          , item.AVGScore.ToString().clearLastZero()
                                          , item.Median.ToString().clearLastZero()
                                          , item.Mode
                                          , item.StandardDeviation.ToString().clearLastZero()
                                          , item.AssignedCount.ToString().clearLastZero() + "/" + (Convert.ToInt32(item.ClassAllCount) - Convert.ToInt32(item.AssignedCount.ToString().clearLastZero()))
                                          , item.CommittedCount.ToString().clearLastZero() + "/" + item.UncommittedCount.ToString().clearLastZero()
                                          , item.CorrectedCount.ToString().clearLastZero() + "/" + item.UnCorrectedCount.ToString().clearLastZero());
             }
             return(StrTemp);
         }
         else
         {
             HttpContext.Current.Session["StatsClassClassId"] = ClassCode;
             BLL_StatsClassHW_Score bllcswso = new BLL_StatsClassHW_Score();
             List <Rc.Model.Resources.Model_StatsClassHW_Score> ClassScoreOverviewList = new List <Model_StatsClassHW_Score>();
             ClassScoreOverviewList = bllcswso.GetModelList("ClassID='" + ClassCode + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "'");
             foreach (var item in ClassScoreOverviewList)
             {
                 StrTemp = string.Format("< ><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td><td>{8}</td><td>{9}</td><td>{10}</td></tr>", item.ClassName, item.ClassAllCount
                                         , item.HighestScore.ToString().clearLastZero()
                                         , item.LowestScore.ToString().clearLastZero()
                                         , item.AVGScore.ToString().clearLastZero()
                                         , item.Median.ToString().clearLastZero()
                                         , item.Mode
                                         , item.StandardDeviation.ToString().clearLastZero()
                                         , item.AssignedCount.ToString().clearLastZero() + "/" + (Convert.ToInt32(item.ClassAllCount) - Convert.ToInt32(item.AssignedCount.ToString().clearLastZero()))
                                         , item.CommittedCount.ToString().clearLastZero() + "/" + item.UncommittedCount.ToString().clearLastZero()
                                         , item.CorrectedCount.ToString().clearLastZero() + "/" + item.UnCorrectedCount.ToString().clearLastZero());
             }
             return(StrTemp);
         }
     }
     catch (Exception)
     {
         return("");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                HomeWork_Id = Request.QueryString["HomeWork_Id"].Filter();
                ResourceToResourceFolder_Id = Request.QueryString["ResourceToResourceFolder_Id"].Filter();

                if (!IsPostBack)
                {
                    if (!string.IsNullOrEmpty(HomeWork_Id))
                    {
                        BLL_StatsClassHW_Score bllschwso = new BLL_StatsClassHW_Score();
                        DataTable dt = bllschwso.GetList("HomeWork_ID='" + HomeWork_Id + "' ").Tables[0];
                        if (dt.Rows.Count == 0)
                        {
                            string strSql = string.Format(@"select t.*,t2.Resource_Name
,t3.GradeName,t3.ClassName
,t4.D_Name as SubjectName
,(case when t5.TrueName is null then t5.UserName when t5.TrueName='' then t5.UserName else t5.UserName end) as TeacherName
,HW_Score=(select ISNULL(SUM(TestQuestions_Score),0) from TestQuestions_Score where ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id)
,t.HomeWork_AssignTeacher as TeacherID,t.UserGroup_Id as ClassId
from HomeWork t 
inner join ResourceToResourceFolder t2 on t2.ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id
inner join VW_ClassGradeSchool t3 on t3.ClassId=t.UserGroup_Id
inner join Common_Dict t4 on t4.Common_Dict_ID=t.SubjectId
inner join F_User t5 on t5.UserId=t.HomeWork_AssignTeacher
where t.HomeWork_Id='{0}'", HomeWork_Id);
                            dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                        }
                        if (dt.Rows.Count > 0)
                        {
                            ltlHomeWork_Name.Text = dt.Rows[0]["Resource_Name"].ToString().ReplaceForFilter();
                            ltlGrade.Text         = dt.Rows[0]["GradeName"].ToString();
                            ltlClass.Text         = dt.Rows[0]["ClassName"].ToString();
                            ltlSubjectName.Text   = dt.Rows[0]["SubjectName"].ToString();
                            ltlTeacherName.Text   = dt.Rows[0]["TeacherName"].ToString();
                            ltlSumSore.Text       = dt.Rows[0]["HW_Score"].ToString().clearLastZero();
                            strHomeWorkId         = " and HomeWork_Id='" + HomeWork_Id + "' ";
                            ClassId = dt.Rows[0]["ClassID"].ToString();
                            GetData();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS(Request.Url.ToString(), string.Format("讲评概述加载失败。作业标识:{0},资源标识:{1}。错误:{2}"
                                                                                                       , HomeWork_Id, ResourceToResourceFolder_Id, ex.Message.ToString()));
            }
        }
        /// <summary>
        /// 获得基本信息
        /// </summary>
        /// <returns></returns>
        protected void getCommon()
        {
            StringBuilder          commonInfo             = new StringBuilder();
            DataTable              dt                     = new DataTable();
            BLL_StatsClassHW_Score bll_StatsClassHW_Score = new BLL_StatsClassHW_Score();

            dt = bll_StatsClassHW_Score.GetList("StatsClassHW_ScoreID = '" + StatsClassHW_ScoreID + "'").Tables[0];
            foreach (DataRow item in dt.Rows)
            {
                PageTitle = item["ClassName"].ToString() + "的成长轨迹";
                //Student_ID = item["StudentID"].ToString();
                SubjectID = item["SubjectID"].ToString();
                ClassID   = item["ClassID"].ToString();
                GradeID   = item["GradeID"].ToString();
                commonInfo.AppendFormat("<span>年级:{0}</span>", item["GradeName"].ToString());
                commonInfo.AppendFormat("<span>学科:{0}</span>", item["SubjectName"].ToString());
                commonInfo.AppendFormat("<span>老师:{0}</span>", item["TeacherName"].ToString());
                //commonInfo.AppendFormat("<span>满分:{0}分</span>", Convert.ToInt16(item["HWScore"]).ToString());
            }
            ltlCommonInfo.Text = commonInfo.ToString();
        }
Beispiel #8
0
        public static string GetEachHWAnalysis(string GradeId, string SubjectId, string ResourceToResourceFolder_Id, int PageIndex, int PageSize)
        {
            try
            {
                GradeId   = GradeId.Filter();
                SubjectId = SubjectId.Filter();
                ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();

                HttpContext.Current.Session["StatsClassSubject"] = SubjectId;
                string strWhere = " ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' ";

                DataTable dt = new DataTable();
                BLL_StatsClassHW_Score bll = new BLL_StatsClassHW_Score();

                string strSqlMain = string.Format(@"select hw.HomeWork_ID,hw.ResourceToResourceFolder_Id,hw.HomeWork_Name,hw.HomeWork_AssignTeacher as TeacherId,hw.UserGroup_Id as ClassId,hw.SubjectId,hw.CreateTime,hw.HomeWork_FinishTime,hw.HomeWork_Status
,ug.UserGroup_Name as ClassName,cd.D_Name as SubjectName,fu.UserName,fu.TrueName from HomeWork hw
left join UserGroup ug on ug.UserGroup_Id=hw.UserGroup_Id
left join Common_Dict cd on cd.Common_Dict_Id=hw.SubjectId
left join F_User fu on fu.UserId=hw.HomeWork_AssignTeacher
 where hw.SubjectId='{0}' and hw.UserGroup_Id in(select ClassId from VW_ClassGradeSchool where GradeId='{1}') "
                                                  , SubjectId
                                                  , GradeId);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("SELECT * FROM ( ");
                strSql.Append(" SELECT ROW_NUMBER() OVER (");
                strSql.Append("order by T.HomeWork_FinishTime desc");
                strSql.AppendFormat(")AS Row, T.*  from ( {0} ) T ", strSqlMain);
                strSql.Append(" WHERE " + strWhere);
                strSql.Append(" ) TT");
                strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize);
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql.ToString()).Tables[0];
                StringBuilder strSqlCount = new StringBuilder();
                strSqlCount.AppendFormat("SELECT count(1)  from ( {0} ) T ", strSqlMain);
                strSqlCount.Append(" WHERE " + strWhere);

                int intRecordCount = int.Parse(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount.ToString()).ToString());

                List <object> listReturn = new List <object>();
                int           inum       = 1;
                string        temp       = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strPG = GetCorrectStudent(dt.Rows[i]["HomeWork_ID"].ToString());
                    string strTJ = GetSubmitStudent(dt.Rows[i]["HomeWork_ID"].ToString());
                    listReturn.Add(new
                    {
                        HomeWork_ID                 = dt.Rows[i]["HomeWork_ID"].ToString(),
                        HomeWork_Name               = dt.Rows[i]["HomeWork_Name"].ToString(),
                        ClassName                   = dt.Rows[i]["ClassName"].ToString(),
                        ClassNameEncode             = HttpContext.Current.Server.UrlEncode(dt.Rows[i]["ClassName"].ToString()),
                        SubjectName                 = dt.Rows[i]["SubjectName"].ToString(),
                        CreateTime                  = pfunction.ToShortDate(dt.Rows[i]["CreateTime"].ToString()),
                        ResourceToResourceFolder_Id = dt.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        TeacherID                   = dt.Rows[i]["TeacherID"].ToString(),
                        TeacherName                 = string.IsNullOrEmpty(dt.Rows[i]["TrueName"].ToString()) ? dt.Rows[i]["UserName"].ToString() : dt.Rows[i]["TrueName"].ToString(),
                        ClassID             = dt.Rows[i]["ClassID"].ToString(),
                        TJ                  = GetSubmitStudent(dt.Rows[i]["HomeWork_ID"].ToString()),
                        PG                  = strPG,
                        TJData              = strTJ.Split('/')[0],
                        IsFinish            = (dt.Rows[i]["HomeWork_Status"].ToString() == "1") ? "<font color='green'>是</font>" : "<font color='red'>否</font>",
                        HomeWork_FinishTime = pfunction.ConvertToLongDateTime(dt.Rows[i]["HomeWork_FinishTime"].ToString())
                    });
                    inum++;
                }
                if (inum > 1)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = intRecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
Beispiel #9
0
        public static string GetEachHWAnalysis(string HWName, string HomeWorkCreateTime, string HomeWorkFinishTime, string ClassID, string TeacherID, int PageIndex, int PageSize)
        {
            try
            {
                HWName             = HWName.Filter();
                HomeWorkCreateTime = HomeWorkCreateTime.Filter();
                HomeWorkFinishTime = HomeWorkFinishTime.Filter();
                ClassID            = ClassID.Filter();
                TeacherID          = TeacherID.Filter();
                string strWhere = "WHERE T.HomeWork_AssignTeacher ='" + TeacherID + "' ";
                if (!string.IsNullOrEmpty(HWName))
                {
                    strWhere += " and  T.HomeWork_Name like '%" + HWName + "%'";
                }
                if (!string.IsNullOrEmpty(HomeWorkCreateTime))
                {
                    strWhere += " and Convert(nvarchar(10),T.CreateTime,23) >= '" + HomeWorkCreateTime + "'";
                }
                if (!string.IsNullOrEmpty(HomeWorkFinishTime))
                {
                    strWhere += " and Convert(nvarchar(10),T.CreateTime,23) <= '" + HomeWorkFinishTime + "'";
                }
                if (!string.IsNullOrEmpty(ClassID))
                {
                    strWhere += " and T.UserGroup_Id = '" + ClassID + "'";
                }

                DataTable dt = new DataTable();
                BLL_StatsClassHW_Score bll  = new BLL_StatsClassHW_Score();
                CommonHandel           bllc = new CommonHandel();
                dt = bllc.GetListByPageForCommonHandel(strWhere, " T.CreateTime desc", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
                int           intRecordCount = bllc.GetRecordCountForCommonHandel(strWhere);
                List <object> listReturn     = new List <object>();
                int           inum           = 1;
                string        temp           = string.Empty;
                string        strSql         = "select COUNT(1) as ICount,HomeWork_Id from Student_HomeWork shw inner join Student_HomeWork_Submit shwSubmit on shwSubmit.Student_HomeWork_Id=shw.Student_HomeWork_Id  where shwSubmit.Student_HomeWork_Status=1 group by HomeWork_Id";
                DataTable     dtWTJ          = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] dr = dtWTJ.Select("HomeWork_Id='" + dt.Rows[i]["HomeWork_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        HomeWork_Name               = dt.Rows[i]["HomeWork_Name"].ToString(),
                        ClassName                   = dt.Rows[i]["ClassName"].ToString(),
                        HomeWork_Id                 = dt.Rows[i]["HomeWork_Id"].ToString(),
                        CreateTime                  = pfunction.ConvertToLongDateTime(dt.Rows[i]["CreateTime"].ToString()),
                        StatsClassHW_ScoreID        = dt.Rows[i]["StatsClassHW_ScoreID"].ToString(),
                        ResourceToResourceFolder_Id = dt.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        HighestScore                = dt.Rows[i]["HighestScore"].ToString() == "" ? "-" : dt.Rows[i]["HighestScore"].ToString().clearLastZero(),
                        LowestScore                 = dt.Rows[i]["LowestScore"].ToString() == "" ? "-" : dt.Rows[i]["LowestScore"].ToString().clearLastZero(),
                        AVGScore = dt.Rows[i]["AVGScore"].ToString() == "" ? "-" : dt.Rows[i]["AVGScore"].ToString().clearLastZero(),
                        Median   = dt.Rows[i]["Median"].ToString() == "" ? "-" : dt.Rows[i]["Median"].ToString().clearLastZero(),
                        Mode     = dt.Rows[i]["Mode"].ToString() == "" ? "-" : dt.Rows[i]["Mode"].ToString(),
                        WTJ      = dr.Length > 0 ? "1" : "0"
                    });
                    inum++;
                }
                if (inum > 1)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = intRecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
 public static string GetList(string GradeID, string SubjectID, string ClassID, int PageIndex, int PageSize)
 {
     try
     {
         SubjectID = SubjectID.Filter();
         ClassID   = ClassID.Filter();
         HttpContext.Current.Session["StatsGradeSubject"] = SubjectID;
         // key = key.Filter();
         string strWhere = "1=1";
         if (!string.IsNullOrEmpty(GradeID))
         {
             strWhere += " AND Gradeid = '" + GradeID + "'";
         }
         if (!string.IsNullOrEmpty(SubjectID))
         {
             strWhere += " AND SubjectID = '" + SubjectID + "'";
         }
         if (!string.IsNullOrEmpty(ClassID))
         {
             strWhere += " AND ClassID = '" + ClassID + "'";
         }
         //if (!string.IsNullOrEmpty(key))
         //{
         //    strWhere += " AND StudentName like '%" + key + "%'";
         //}
         strWhere += @" AND StatsClassHW_ScoreID IN(select StatsClassHW_ScoreID from (
         select StatsClassHW_ScoreID,
         ROW_NUMBER() over(partition by Gradeid,SubjectID,ClassID order by HomeWorkCreateTime  desc) as rowNum
         from StatsClassHW_Score where " + strWhere + " ) t where rowNum=1) ";
         DataTable dt = new DataTable();
         BLL_StatsClassHW_Score bll = new BLL_StatsClassHW_Score();
         dt = bll.GetListByPage(strWhere, "StatsClassHW_ScoreID ASC", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
         int           intRecordCount = bll.GetRecordCount(strWhere);
         List <object> listReturn     = new List <object>();
         int           inum           = 1;
         string        temp           = string.Empty;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             listReturn.Add(new
             {
                 GradeName            = dt.Rows[i]["GradeName"].ToString(),
                 SubjectName          = dt.Rows[i]["SubjectName"].ToString(),
                 ClassName            = dt.Rows[i]["ClassName"].ToString(),
                 AVGScore             = dt.Rows[i]["AVGScore"].ToString().clearLastZero(),
                 StandardDeviation    = dt.Rows[i]["StandardDeviation"].ToString().clearLastZero(),
                 StatsClassHW_ScoreID = dt.Rows[i]["StatsClassHW_ScoreID"].ToString()
             });
             inum++;
         }
         if (inum > 1)
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "null",
                 PageIndex = PageIndex,
                 PageSize = PageSize,
                 TotalCount = intRecordCount,
                 list = listReturn
             }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "暂无数据"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new
         {
             err = ex.Message.ToString()
         }));
     }
 }
Beispiel #11
0
        public static string GetEachHWAnalysis(string HWName, string HomeWorkCreateTime, string HomeWorkFinishTime, string SubjectID, string TeacherID, int PageIndex, int PageSize)
        {
            try
            {
                HWName             = HWName.Filter();
                HomeWorkCreateTime = HomeWorkCreateTime.Filter();
                HomeWorkFinishTime = HomeWorkFinishTime.Filter();
                TeacherID          = TeacherID.Filter();
                HttpContext.Current.Session["StatsClassSubject"] = SubjectID;
                string strWhere = " TeacherId='" + TeacherID + "' ";
                if (!string.IsNullOrEmpty(HWName))
                {
                    strWhere += " and  HomeWork_Name like '%" + HWName + "%'";
                }
                if (!string.IsNullOrEmpty(HomeWorkCreateTime))
                {
                    strWhere += " and CreateTime > '" + HomeWorkCreateTime + "'";
                }
                if (!string.IsNullOrEmpty(HomeWorkFinishTime))
                {
                    strWhere += " and CreateTime <= '" + HomeWorkFinishTime + "'";
                }
                if (!string.IsNullOrEmpty(SubjectID))
                {
                    strWhere += " and SubjectID = '" + SubjectID + "'";
                }
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                strWhere += StatsCommonHandle.GetStrWhereBySelfClassForTeacherData(SubjectID);

                DataTable dt = new DataTable();
                BLL_StatsClassHW_Score bll = new BLL_StatsClassHW_Score();

                string strSqlMain = string.Format(@"select hw.HomeWork_ID,hw.ResourceToResourceFolder_Id,hw.HomeWork_Name,hw.HomeWork_AssignTeacher as TeacherId,hw.UserGroup_Id as ClassId,hw.SubjectId,hw.CreateTime
,ug.UserGroup_Name as ClassName,cd.D_Name as SubjectName,fu.UserName,fu.TrueName from HomeWork hw
left join UserGroup ug on ug.UserGroup_Id=hw.UserGroup_Id
left join Common_Dict cd on cd.Common_Dict_Id=hw.SubjectId
left join F_User fu on fu.UserId=hw.HomeWork_AssignTeacher
 where hw.UserGroup_Id in(select UserGroup_Id from UserGroup_Member where UserStatus='0' and MemberShipEnum='{2}' and User_Id='{0}')
or (hw.SubjectId='{1}' and hw.HomeWork_AssignTeacher='{0}')"
                                                  , TeacherID
                                                  , SubjectID
                                                  , MembershipEnum.headmaster);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("SELECT * FROM ( ");
                strSql.Append(" SELECT ROW_NUMBER() OVER (");
                strSql.Append("order by T.CreateTime desc");
                strSql.AppendFormat(")AS Row, T.*  from ( {0} ) T ", strSqlMain);
                strSql.Append(" WHERE " + strWhere);
                strSql.Append(" ) TT");
                strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize);
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql.ToString()).Tables[0];
                StringBuilder strSqlCount = new StringBuilder();
                strSqlCount.AppendFormat("SELECT count(1)  from ( {0} ) T ", strSqlMain);
                strSqlCount.Append(" WHERE " + strWhere);

                int intRecordCount = int.Parse(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount.ToString()).ToString());
                //                string strSql = string.Format(@"select hw.*,ug.UserGroup_Name,cd.D_Name as SubjectName from HomeWork hw
                //left join UserGroup ug on ug.UserGroup_Id=hw.UserGroup_Id
                //left join Common_Dict cd on cd.Common_Dict_Id=hw.SubjectId
                // where hw.UserGroup_Id in(select UserGroup_Id from UserGroup_Member where UserStatus='0' and MemberShipEnum='{2}' and User_Id='{0}')
                //or (hw.SubjectId='{1}' and hw.HomeWork_AssignTeacher='{0}')"
                //                    , TeacherID
                //                    , SubjectID);
                //dt = bll.GetListByPage(strWhere, "HomeWorkCreateTime desc", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
                //int intRecordCount = bll.GetRecordCount(strWhere);
                List <object> listReturn = new List <object>();
                int           inum       = 1;
                string        temp       = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strPG = GetCorrectStudent(dt.Rows[i]["HomeWork_ID"].ToString());
                    string strTJ = GetSubmitStudent(dt.Rows[i]["HomeWork_ID"].ToString());
                    listReturn.Add(new
                    {
                        HomeWork_ID                 = dt.Rows[i]["HomeWork_ID"].ToString(),
                        HomeWork_Name               = dt.Rows[i]["HomeWork_Name"].ToString(),
                        ClassName                   = dt.Rows[i]["ClassName"].ToString(),
                        ClassNameEncode             = HttpContext.Current.Server.UrlEncode(dt.Rows[i]["ClassName"].ToString()),
                        SubjectName                 = dt.Rows[i]["SubjectName"].ToString(),
                        CreateTime                  = pfunction.ToShortDate(dt.Rows[i]["CreateTime"].ToString()),
                        ResourceToResourceFolder_Id = dt.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        TeacherID                   = dt.Rows[i]["TeacherID"].ToString(),
                        TeacherName                 = string.IsNullOrEmpty(dt.Rows[i]["TrueName"].ToString()) ? dt.Rows[i]["UserName"].ToString() : dt.Rows[i]["TrueName"].ToString(),
                        ClassID       = dt.Rows[i]["ClassID"].ToString(),
                        TJ            = strTJ,
                        PG            = strPG,
                        HaveTJ        = strTJ.Split('/')[0],
                        IsTeacherData = dt.Rows[i]["TeacherID"].ToString() == loginUser.UserId ? "" : "1"
                    });
                    inum++;
                }
                if (inum > 1)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = intRecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }