protected override void LoadData()
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                return;
            }
            //年级数据
            if (BaseApplication.GetInstance().gradeList == null)
            {
                BaseApplication.GetInstance().gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId);
            }
            if (BaseApplication.GetInstance().gradeList != null && BaseApplication.GetInstance().gradeList.Any())
            {
                gradeList = new List <string>(BaseApplication.GetInstance().gradeList.Select(i => i.GradeName).ToArray());
            }
            //默认年级全选
            if (searchGradeList != null && searchGradeList.Any())
            {
                var selectedgrade = "全部年级";
                if (searchGradeList.Count > 0 && searchGradeList.Count != gradeList.Count)
                {
                    selectedgrade = string.Join(",", searchGradeList.ToArray());
                }

                tv_grade.Text = selectedgrade;
            }
            else
            {
                searchGradeList = new List <string>(gradeList.ToArray());
            }

            //科目数据
            if (BaseApplication.GetInstance().courseList == null)
            {
                BaseApplication.GetInstance().courseList = DistrictService.GetCourseList(CurrUserInfo.SchoolId);
            }
            if (BaseApplication.GetInstance().courseList != null && BaseApplication.GetInstance().courseList.Any())
            {
                courseList = new List <string>(BaseApplication.GetInstance().courseList.Select(t => t.CourseName).ToArray());
            }
            //默认科目
            if (!string.IsNullOrEmpty(searchCourse))
            {
                tv_course.Text = searchCourse;
            }
            else
            {
                searchCourse   = BaseApplication.GetInstance().courseList[0].CourseName;
                tv_course.Text = searchCourse;
            }


            BindData();
        }
Esempio n. 2
0
        protected void LoadData()
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                return;
            }

            //财年数据
            if (BaseApplication.GetInstance().quarterList == null)
            {
                BaseApplication.GetInstance().quarterList = RenewService.GetQuarter(CurrUserInfo.SchoolId);
            }
            //区域数据
            if (BaseApplication.GetInstance().districtList == null)
            {
                BaseApplication.GetInstance().districtList = RenewService.GetDistrictList(CurrUserInfo.SchoolId);
            }
            //年级数据
            if (BaseApplication.GetInstance().gradeList == null)
            {
                BaseApplication.GetInstance().gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId);
            }
            //科目数据
            if (BaseApplication.GetInstance().courseList == null)
            {
                BaseApplication.GetInstance().courseList = DistrictService.GetCourseList(CurrUserInfo.SchoolId);
            }

            //默认财年
            if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any())
            {
                quarterList   = BaseApplication.GetInstance().quarterList;
                searchQuarter = BaseApplication.GetInstance().quarterList.Find(t => t.IsCurrent);
                tv_year.Text  = searchQuarter.QuarterName;
            }
            //默认区域
            if (BaseApplication.GetInstance().districtList != null && BaseApplication.GetInstance().districtList.Any())
            {
                districtList = new List <string>(BaseApplication.GetInstance().districtList.Select(i => i.DistrictName).ToArray());
                //加区域的权限判断--区域经理登录
                if (CurrUserInfo.Type == (int)UserType.AreaManager)
                {
                    districtList     = districtList.Where(p => p == CurrUserInfo.DistrictName).ToList();
                    tv_district.Text = CurrUserInfo.DistrictName;
                    searchDistrict   = CurrUserInfo.DistrictName;
                }
            }
            //默认年级
            if (BaseApplication.GetInstance().gradeList != null && BaseApplication.GetInstance().gradeList.Any())
            {
                gradeList = new List <string>(BaseApplication.GetInstance().gradeList.Select(i => i.GradeName).ToArray());
            }
            if (searchGradeList != null && searchGradeList.Any())
            {
                var selectedgrade = "全部年级";
                if (searchGradeList.Count > 0 && searchGradeList.Count != gradeList.Count)
                {
                    selectedgrade = string.Join(",", searchGradeList.ToArray());
                }

                tv_grade.Text = selectedgrade;
            }
            else
            {
                // 默认全选
                searchGradeList = new List <string>(gradeList.ToArray());
            }
            //默认科目
            if (BaseApplication.GetInstance().courseList != null && BaseApplication.GetInstance().courseList.Any())
            {
                courseList     = new List <string>(BaseApplication.GetInstance().courseList.Select(t => t.CourseName).ToArray());
                searchCourse   = BaseApplication.GetInstance().courseList[0].CourseName;
                tv_course.Text = searchCourse;
            }

            BindData();
        }