Exemple #1
0
        /// <summary>
        /// 获取学校和年级json字符串
        /// </summary>
        /// <returns></returns>
        public List <object> GetGradeAndClassData()
        {
            SchoolGradeBLL sbgradell = new SchoolGradeBLL();
            List <Entity.SchoolGradeEntity> sbgradelList = sbgradell.GetModelList(" IsDeleted=0");
            GradeBLL clasBll = new GradeBLL();
            List <Entity.GradeEntity> classList  = clasBll.GetModelList(" IsDeleted=0");
            List <object>             resultList = new List <object>();

            foreach (var item in sbgradelList)
            {
                List <Entity.GradeEntity> sgTemp = classList.Where(g => g.GgradeID == item.ID).ToList();
                resultList.Add(new { shcgname = item.Name, shcgid = item.ID, classes = sgTemp });
            }
            return(resultList);
        }
Exemple #2
0
        /// <summary>
        /// 获取学校和年级json字符串
        /// </summary>
        /// <returns></returns>
        public List <object> GetSchoolAndGradeData(int schId = 0)
        {
            SchoolBLL                       sbll         = new SchoolBLL();
            SchoolGradeBLL                  sbgradell    = new SchoolGradeBLL();
            List <Entity.SchoolEntity>      schList      = sbll.GetModelList(" IsDeleted=0");
            List <Entity.SchoolGradeEntity> sbgradelList = sbgradell.GetModelList(" IsDeleted=0");
            List <object>                   resultList   = new List <object>();

            foreach (var item in schList)
            {
                if (schId > 0 && item.ID != schId)
                {
                    continue;
                }
                List <Entity.SchoolGradeEntity> sgTemp = sbgradelList.Where(g => g.SchoolID == item.ID).ToList();
                resultList.Add(new { shname = item.Name, shid = item.ID, grades = sgTemp });
            }
            return(resultList);
        }