Ejemplo n.º 1
0
        public void BindData()
        {
            LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中...");

            try
            {
                var schoolId       = CurrUserInfo.SchoolId;
                var year           = searchQuarter.Year;
                var quarter        = searchQuarter.Quarter;
                var district       = searchDistrict;
                var categoryEntity = categoryEntityList.FirstOrDefault(p => p.CategoryName == searchCagetory);
                var category       = categoryEntity == null?"":categoryEntity.CategoryValue;

                //负责校区
                var areaCodes = "";                 //店长登录用
                if (CurrUserInfo.Type == (int)UserType.ShopManager)
                {
                    areaCodes = CurrUserInfo.AreaCodes;
                }
                //年级
                var gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId);
                var grade     = string.Join(",", gradeList.Select(p => p.GradeName));

                new System.Threading.Thread(new ThreadStart(() =>
                {
                    var list = NewService.GetSumNewStudentList(schoolId, year, quarter, dataType, sortType, district, category, grade, out totalCount, 1, 1, 500, areaCodes);
                    CurrActivity.RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        if (list != null)
                        {
                            var totalData      = list.TotalData;
                            this.avgGrowthRate = totalData.Rate;
                            this.sumList       = list.List;
                            var totalEntity    = new NewStudentSumAreaEntity()
                            {
                                Name = totalData.Name, StudentCount = totalData.StudentCount, Total = totalData.Total, Rate = totalData.Rate
                            };
                            this.sumList.Add(totalEntity);


                            mAdapter.SetData(this.sumList, this.avgGrowthRate);
                            mAdapter.NotifyDataSetChanged();
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
            }
        }