/// <summary> /// 获取报表数据 /// </summary> private void GetClassListOfStudentFromDataMart() { try { new Thread(new ThreadStart(() => { classList = RenewService.GetClassListOfStudent(CurrUserInfo.SchoolId, studentCode, classStatus); CurrActivity.RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; if (classList != null && classList.Count > 0) { mAdapter.SetData(classList); mAdapter.NotifyDataSetChanged(); } else { mSwipeRefreshLayout.Visibility = ViewStates.Gone; ll_none.Visibility = ViewStates.Visible; } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); LoadingDialogUtil.DismissLoadingDialog(); } }
public void OnItemClick(View itemView, int position) { var reportItem = teachReportList[position]; if (!string.IsNullOrEmpty(reportItem.Item2)) { //Toast.MakeText(CurrActivity, reportItem.Item3, ToastLength.Short).Show(); Intent intent = new Intent(CurrActivity, typeof(ReportListByGroup)); intent.PutExtra("reportJsonStr", JsonSerializer.ToJsonString(reportItem)); // 搜索条件 intent.PutExtra("searchQuarter", JsonSerializer.ToJsonString <QuarterEntity>(searchQuarter)); var selectedgrade = ""; if (searchGradeList.Count != gradeList.Count) { selectedgrade = string.Join(",", searchGradeList.ToArray()); } intent.PutExtra("searchGradeList", selectedgrade); intent.PutExtra("searchDistrict", searchDistrict); intent.PutExtra("avgRenewRate", reportItem.Item6.ToString()); intent.PutExtra("classStatus", classStatus); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); } }
public void BindData() { LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); try { var schoolId = CurrUserInfo.SchoolId; var year = searchQuarter.Year; var quarter = searchQuarter.Quarter; var district = searchDistrict; var course = searchCourse; var grade = ""; if (searchGradeList.Any()) { grade = string.Join(",", searchGradeList.ToArray()); } var areaCodes = ""; //店长登录用 if (CurrUserInfo.Type == (int)UserType.ShopManager) { areaCodes = CurrUserInfo.AreaCodes; } new System.Threading.Thread(new ThreadStart(() => { var list = SumService.GetSumPaymentListByArea(schoolId, year, quarter, dataType, sortType, district, grade, course, out totalCount, 1, 1, 500, areaCodes); CurrActivity.RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; if (list != null) { var totalData = list.TotalData; this.avgGrowthRate = totalData.GrowthRate; this.sumList = list.List; var totalEntity = new PaymentSumAreaEntity() { Name = "总计", CurrentSum = totalData.CurrentSum, LastYearSum = totalData.LastYearSum, GrowthRate = totalData.GrowthRate }; this.sumList.Add(totalEntity); var gradeListParam = ""; if (searchGradeList.Count != gradeList.Count) { gradeListParam = string.Join(",", searchGradeList.ToArray()); } mAdapter.SetData(this.sumList, this.avgGrowthRate, this.searchQuarter, this.dataType, this.searchCourse); mAdapter.NotifyDataSetChanged(); } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; } }
/// <summary> /// 页面事件 /// </summary> protected override void InitEvents() { // 返回 FindViewById <ImageButton>(Resource.Id.imgBtn_back).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; // 点击头部菜单 FindViewById <TextView>(Resource.Id.tv_ing).Click += (sender, e) => { SetSelected(0); mViewPager.SetCurrentItem(0, true); }; FindViewById <TextView>(Resource.Id.tv_will).Click += (sender, e) => { SetSelected(1); mViewPager.SetCurrentItem(1, true); }; FindViewById <TextView>(Resource.Id.tv_end).Click += (sender, e) => { SetSelected(2); mViewPager.SetCurrentItem(2, true); }; mViewPager.AddOnPageChangeListener(this); }
protected override void InitEvents() { // 返回 FindViewById <ImageButton>(Resource.Id.imgBtn_back).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; }
public void OnItemClick(View itemView, int position) { var assistantItem = assistantList[position]; Intent intent = new Intent(CurrActivity, typeof(AssistantAddActivity)); intent.PutExtra("assistantJsonStr", JsonSerializer.ToJsonString(assistantItem)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }
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; } }
/// <summary> /// 退出登录 /// </summary> public void DoLogout() { SharedPreferencesUtil.SetParam(CurrActivity, AppConfig.SP_USERINFO, ""); Intent intent = new Intent(CurrActivity, typeof(Login)); StartActivity(intent); CurrActivity.Finish(); CurrActivity.OverridePendingTransition(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut); }
public void OnItemClick(View itemView, int position) { var teacherItem = teacherList[position]; Intent intent = new Intent(CurrActivity, typeof(TeacherAddActivity)); intent.PutExtra("scopeName", teacherItem.ScopeName); intent.PutExtra("teacherJsonStr", JsonSerializer.ToJsonString(teacherItem)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }
/// <summary> /// 行点击事件 /// </summary> public void OnItemClick(View itemView, int position) { var data = shopManagerList[position]; Intent intent = new Intent(CurrActivity, typeof(ShopManagerAddActivity)); intent.PutExtra("areaCodes", data.AreaCodes); intent.PutExtra("areaNames", data.AreaNames); intent.PutExtra("ShopManagerJsonStr", JsonSerializer.ToJsonString(data)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }
public void OnItemClick(View itemView, int position) { var scopeItem = teachScopeList[position]; Intent intent = new Intent(CurrActivity, typeof(TeacherListActivity)); intent.PutExtra("scopeId", scopeItem.Id); intent.PutExtra("scopeName", scopeItem.Name); intent.PutExtra("teacherCount", scopeItem.TeacherCount ?? 0); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }
/// <summary> /// 页面事件 /// </summary> protected void InitEvents() { // 教师管理 rlTeacherManage.Click += (sender, e) => { if (CurrUserInfo.Type == (int)UserType.TeacherDirector) { Intent intent = new Intent(CurrActivity, typeof(TeacherListActivity)); intent.PutExtra("scopeId", int.Parse(CurrUserInfo.ScopeCode ?? "0")); intent.PutExtra("scopeName", CurrUserInfo.ScopeName); var teacherTotalCount = 0; var scopeTeacherList = new DataService.MeService().GetTeacherListByScope(CurrUserInfo.SchoolId, int.Parse(CurrUserInfo.ScopeCode), 1, 1, out teacherTotalCount); intent.PutExtra("teacherCount", teacherTotalCount); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); } else { Intent intent = new Intent(CurrActivity, typeof(TeacherManage)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); } }; // 教学主管 rlDirector.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(DirectorListActivity)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; // 助教组长 rlAssistantLeader.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(AssistantLeaderList)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; // 店长管理 rlShopManager.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(ShopManagerListActivity)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; // 退出操作 rlLogout.Click += (sender, e) => { var callbackFunc = new AppUtils.ShowDialogClick(CallbackFun); AppUtils.ShowDialog(CurrActivity, "提示", "您确认要退出账号吗?", 2, callbackFunc); }; }
public void BindData() { try { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); var schoolId = CurrUserInfo.SchoolId; var grade = ""; if (searchGradeList.Any()) { grade = string.Join(",", searchGradeList.ToArray()); } //加校区查询权限判断--店长登录 var areaCodes = ""; if (CurrUserInfo.Type == (int)UserType.ShopManager) { areaCodes = CurrUserInfo.AreaCodes; } new Thread(new ThreadStart(() => { var list = SumService.GetSumPaymentListByTeacher(schoolId, year, quarter, dataType, sortType, areaCode, grade, searchCourse); CurrActivity.RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; if (list != null) { sumTeacherList = list.List; //添加合计行 sumTeacherList.Add(list.TotalData); mAdapter.SetData(sumTeacherList); mAdapter.NotifyDataSetChanged(); } }); })).Start(); } catch (Exception ex) { //var msg = ex.Message.ToString(); LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; } }
public void OnItemClick(View itemView, int position) { var renewItem = renewInfoList[position]; if (renewItem.ID > 0) { Intent intent = new Intent(CurrActivity, typeof(ClassRenewInfo)); intent.PutExtra("renewJsonStr", JsonSerializer.ToJsonString(renewItem)); intent.PutExtra("classStatus", classStatus); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); } }
/// <summary> /// 初始化事件 /// </summary> protected override void InitEvents() { // 返回 FindViewById <ImageButton>(Resource.Id.imgBtn_back).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; llAdd.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(ShopManagerAddActivity)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; }
/// <summary> /// 获取报表数据 /// </summary> public void BindData() { try { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); var schoolId = CurrUserInfo.SchoolId; var year = searchQuarter.Year; var quarter = searchQuarter.Quarter; var district = searchDistrict; //加校区查询权限判断--店长登录 var areaCodes = ""; if (CurrUserInfo.Type == (int)UserType.ShopManager) { areaCodes = CurrUserInfo.AreaCodes; } new Thread(new ThreadStart(() => { var list = BudgetService.GetAreaPaymentList(schoolId, year, quarter, district, sortType, dataType, areaCodes); CurrActivity.RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; if (list != null) { paymentList = list; mAdapter.SetData(paymentList); mAdapter.NotifyDataSetChanged(); } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; } }
protected override void InitEvents() { // 返回 FindViewById <ImageButton>(Resource.Id.imgBtn_back).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; llAdd.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(TeacherAddActivity)); intent.PutExtra("scopeName", scopeName); StartActivity(intent); OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; mSwipeRefreshLayout.SetOnRefreshListener(this); RecyclerViewItemOnGestureListener viewOnGestureListener = new RecyclerViewItemOnGestureListener(mRecyclerView, this); mRecyclerView.AddOnItemTouchListener(new RecyclerViewItemOnItemTouchListener(mRecyclerView, viewOnGestureListener)); // 加载更多 var onScrollListener = new XamarinRecyclerViewOnScrollListener(linearLayoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { if (totalCount > teacherList.Count) { if (!loadingData) { loadingData = true; GetTeacherListByScope(); } } else if (totalCount == teacherList.Count) { Toast.MakeText(this, "没有更多了", ToastLength.Short).Show(); } }; mRecyclerView.AddOnScrollListener(onScrollListener); }
protected override void InitEvents() { // 返回 imgbtnBack.Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; // 选择教研组 rlGroup.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(TeacherScopeSelectActivity)); intent.PutExtra("scopeId", tScopeCode); StartActivityForResult(intent, 1); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; // 选择角色 rlRole.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(TeacherRoleSelectActivity)); intent.PutExtra("roleId", tType); StartActivityForResult(intent, 0); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; btnAdd.Click += (sender, e) => { DoSave(true); }; tvSave.Click += (sender, e) => { DoSave(false); }; btnDelete.Click += (sender, e) => { var callbackFunc = new AppUtils.ShowDialogClick(CallbackFun); AppUtils.ShowDialog(CurrActivity, "提示", "您确认要删除此信息吗?", 2, callbackFunc); }; }
protected override void InitEvents() { // 返回 FindViewById <ImageButton>(Resource.Id.imgBtn_back).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; tv_btn1.SetOnClickListener(this); tv_btn2.SetOnClickListener(this); tv_btn3.SetOnClickListener(this); //开课中/全部切换事件 FindViewById <ImageButton>(Resource.Id.imgBtn_lessonIng).Click += (sender, e) => { var imgButton = (sender as ImageButton); SetClassStatusImg(imgButton, "clickButton"); }; }
protected override void InitEvents() { // 取消 FindViewById <TextView>(Resource.Id.tv_cancel).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; // 选择学区 rlArea.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(AreaSelectActivity)); intent.PutExtra("sname", currAssistant.AreaName); StartActivityForResult(intent, 0); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; btnAdd.Click += (sender, e) => { DoSave(true); }; tvSave.Click += (sender, e) => { if (isNewAdd) { DoSave(false); } else { DoUpdate(); } }; btnDelete.Click += (sender, e) => { var callbackFunc = new AppUtils.ShowDialogClick(CallbackFun); AppUtils.ShowDialog(CurrActivity, "提示", "您确认要删除此账号吗?", 2, callbackFunc); }; }
protected override void InitEvents() { // 返回 ((ImageButton)FindViewById(Resource.Id.imgBtn_back)).Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; llBox.RemoveAllViews(); List <TeacherRoleEntity> roleList = AppUtils.GetTeacherRoleList(); foreach (var role in roleList) { var itemBox = LayoutInflater.From(CurrContext).Inflate(Resource.Layout.item_role_select, llBox, false); var itemWrapper = itemBox.FindViewById <RelativeLayout>(Resource.Id.ll_wrapper); var roleLabel = itemBox.FindViewById <TextView>(Resource.Id.iv_role_label); var roleIcon = itemBox.FindViewById <ImageView>(Resource.Id.iv_role_icon); roleLabel.Text = role.RoleName; roleIcon.SetImageResource(Resource.Drawable.icn_selected); if (role.RoleId == roleId) { roleIcon.Visibility = ViewStates.Visible; roleLabel.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh))); } llBox.AddView(itemBox); itemWrapper.Click += (sender, e) => { fromIntent.SetClass(this, typeof(TeacherAddActivity)); fromIntent.PutExtra("roleId", role.RoleId.ToString()); fromIntent.PutExtra("roleName", role.RoleName); SetResult(Result.Ok, fromIntent); Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; } }
/// <summary> /// 获取报表数据 /// </summary> private void GetRenewInfoInGroup() { try { new Thread(new ThreadStart(() => { var gradeStr = ""; if (searchGradeList.Any()) { gradeStr = string.Join(",", searchGradeList.ToArray()); } var districtStr = ""; if (!string.IsNullOrEmpty(searchDistrict) && !searchDistrict.Equals("全部区域")) { districtStr = searchDistrict; } var result = RenewService.GetRenewInfoInGroup(CurrUserInfo.SchoolId, searchQuarter.Year, searchQuarter.Quarter, gradeStr, districtStr, 1, 6, 1, 30, classStatus); CurrActivity.RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; if (result != null) { teachReportList = result.RenewInfo; mAdapter.SetData(teachReportList); mAdapter.NotifyDataSetChanged(); } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); LoadingDialogUtil.DismissLoadingDialog(); mSwipeRefreshLayout.Refreshing = false; } }
/// <summary> /// 初始化事件 /// </summary> protected override void InitEvents() { // 返回 imgbtnBack.Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; // 选择负责校区 rlAreas.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(AreaSelectMultiActivity)); if (currShopManager != null) { intent.PutExtra("areaCodes", AreaCodes); } StartActivityForResult(intent, 1); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; //保存并继续添加 btnAdd.Click += (sender, e) => { DoSave(true); }; //完成 tvSave.Click += (sender, e) => { DoSave(false); }; //删除 btnDelete.Click += (sender, e) => { var callbackFunc = new AppUtils.ShowDialogClick(CallbackFun); AppUtils.ShowDialog(CurrActivity, "提示", "您确认要删除此信息吗?", 2, callbackFunc); }; }
/// <summary> /// 获取续班率,返回如:{"State":1,"Data":[{"SchoolId":1,"Year":2017,"Season":2,"Type":1,"RenewRate":0.3209},{"SchoolId":1,"Year":2017,"Season":2,"Type":2,"RenewRate":0.2541},{"SchoolId":1,"Year":2017,"Season":2,"Type":3,"RenewRate":0.2920}],"Error":null,"DataCount":0} /// </summary> private void GetRenewData() { var schoolId = CurrUserInfo.SchoolId; try { var currQuarter = BaseApplication.GetInstance().quarterList.FirstOrDefault(p => p.IsCurrent); if (currQuarter != null) { year = currQuarter.Year; quarter = currQuarter.Quarter; } tvTitle1.Text = string.Format("{0}财年Q{1}续班率", year, quarter); tvTitle2.Text = string.Format("{0}财年Q{1}续班率排名", year, quarter); tvBudgetTitle.Text = string.Format("{0}财年{1}预算完成率", year, quarter); try { #region 教学模块 new Thread(new ThreadStart(() => { var renewList = RenewService.GetIndexRenewInfoByDepartment(schoolId, year, quarter); CurrActivity.RunOnUiThread(() => { //初中续班率 var middleInfo = renewList.FirstOrDefault(p => p.Type == 1); if (middleInfo != null) { tvRate1.Text = (middleInfo.RenewRate * 100).ToString("f1") + "%"; } else { tvRate1.Text = "0.0%"; } //高中续班率 var hightInfo = renewList.FirstOrDefault(p => p.Type == 2); if (hightInfo != null) { tvRate2.Text = (hightInfo.RenewRate * 100).ToString("f1") + "%"; } else { tvRate2.Text = "0.0%"; } }); })).Start(); var grade = ""; if (BaseApplication.GetInstance().gradeList != null) { grade = string.Join(",", BaseApplication.GetInstance().gradeList.Select(t => t.GradeName).ToArray()); } // 前三名 new Thread(new ThreadStart(() => { var beforeList = RenewService.GetIndexRenewInfoInGroup(schoolId, year, quarter, grade, "", 0, 6, 1, 3); CurrActivity.RunOnUiThread(() => { InitRenewViews(beforeList, 6); }); })).Start(); // 后三名 new Thread(new ThreadStart(() => { var lastList = RenewService.GetIndexRenewInfoInGroup(schoolId, year, quarter, grade, "", 0, 5, 1, 3); CurrActivity.RunOnUiThread(() => { InitRenewViews(lastList, 5); }); })).Start(); #endregion #region 区域模块 new Thread(new ThreadStart(() => { //query //6-按预算完成率倒序排 int sortType = 6; //1-预收款 int dataType = 1; var allBudgetlist = BudgetService.GetAreaPaymentList(schoolId, year, quarter, "", sortType, dataType); //预收款与完成率 取总计行 var budget = "0"; var completionRate = "0.0%"; var totalModel = allBudgetlist.FirstOrDefault(p => p.AreaName == "总计"); if (totalModel != null) { budget = (totalModel.Budget / 10000).ToString("f1"); completionRate = (totalModel.CompletionRate * 100).ToString("f1") + "%"; } PaymentEntity[] budgetBefore = new PaymentEntity[3]; PaymentEntity[] budgetAfter = new PaymentEntity[3]; if (allBudgetlist.Count > 0) { //移除总计行后,取前三名&后三名 allBudgetlist.RemoveAt(allBudgetlist.Count - 1); //移除营收目标=0的行 allBudgetlist.RemoveAll(p => p.Budget == 0); } var budgetCount = allBudgetlist.Count; if (allBudgetlist.Count > 3) { budgetCount = 3; } if (budgetCount > 0) { allBudgetlist.CopyTo(0, budgetBefore, 0, budgetCount); allBudgetlist.CopyTo(allBudgetlist.Count - budgetCount, budgetAfter, 0, budgetCount); budgetBefore = budgetBefore.Where(t => t != null).ToArray(); budgetAfter = budgetAfter.Where(t => t != null).ToArray(); } CurrActivity.RunOnUiThread(() => { //预收款 tvBudget.Text = budget; //预收款完成率 tvBudgetRate.Text = ((totalModel != null && totalModel.Budget == 0) ? "--" : completionRate); //前三名 InitBudgetViews(budgetBefore.ToList(), true); //后三名 InitBudgetViews(budgetAfter.Reverse().ToList(), false); mSwipeRefreshLayout.Refreshing = false; }); })).Start(); #endregion } catch (Exception ex) { var msg = ex.Message.ToString(); } } catch (Exception ex) { var msg = ex.Message.ToString(); } }
private void LoadStudents() { var screenWidth = Resources.DisplayMetrics.WidthPixels; var screenHeight = Resources.DisplayMetrics.HeightPixels; var view = FindViewById <RelativeLayout>(Resource.Id.ll_top); view.Measure(0, 0); var height = view.MeasuredHeight; height = screenHeight - height - AppUtils.dip2px(CurrContext, 45 + 30 + 30); if ((int)(Build.VERSION.SdkInt) < 21) { { Rect frame = new Rect(); Window.DecorView.GetWindowVisibleDisplayFrame(frame); var statusBarHeight = frame.Top; height = height - statusBarHeight; } } // 计算头像的高度(容器高度-上下padding-姓名的view高度)*0.8 var avatarHeihgt = (int)(((height / 2 - AppUtils.dip2px(CurrContext, (2 * 15 + 2 * 30))) / 2)); var wrapperWidth = screenWidth - AppUtils.dip2px(CurrContext, 24); var itemWidth = avatarHeihgt;//(int)Math.Round((wrapperWidth / avatarColumns) * 0.8); var marginRight = (wrapperWidth - itemWidth * avatarColumns) / 3; // 设置scrollview高度(2行高度) var scrollviewHeight = (itemWidth + AppUtils.dip2px(CurrContext, 30)) * 2; LinearLayout.LayoutParams scrollParas = new LinearLayout.LayoutParams(wrapperWidth, scrollviewHeight); scrolllview_1.LayoutParameters = scrollParas; scrolllview_2.LayoutParameters = scrollParas; tv_renewNum.Text = string.Format("已续班({0}人)", renewStudentList.Count); for (var i = 0; i < renewStudentList.Count; i++) { var student = renewStudentList[i]; var itemBox = LayoutInflater.From(CurrContext).Inflate(Resource.Layout.item_renew_avatar, gridlayout_1, false); ImageView ivAvatar = itemBox.FindViewById <ImageView>(Resource.Id.iv_avatar); // 设置照片宽度和高度 var avatarWidth = itemWidth; var avatarHeight = avatarWidth; LinearLayout.LayoutParams parasAvatar = new LinearLayout.LayoutParams(avatarWidth, avatarHeight); parasAvatar.Gravity = GravityFlags.Center; ivAvatar.LayoutParameters = parasAvatar; if (!string.IsNullOrEmpty(student.avatar)) { picasso.Load(student.avatar).Placeholder(Resource.Drawable.avatar_student).Error(Resource.Drawable.avatar_student) .Transform(new CircleImageTransformation(picasso)) .Into(ivAvatar); } else { picasso.Load(Resource.Drawable.avatar_student).Placeholder(Resource.Drawable.avatar_student).Error(Resource.Drawable.avatar_student) .Transform(new CircleImageTransformation(picasso)) .Into(ivAvatar); } TextView tvName = itemBox.FindViewById <TextView>(Resource.Id.tv_name); tvName.Text = student.name; if (avatarHeihgt < 60) { tvName.SetTextSize(Android.Util.ComplexUnitType.Sp, 11); } GridLayout.LayoutParams parasBox = new GridLayout.LayoutParams(); parasBox.Width = itemWidth; if (i % avatarColumns != 3) { parasBox.RightMargin = marginRight; } itemBox.LayoutParameters = parasBox; gridlayout_1.AddView(itemBox); // 添加点击事件 itemBox.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(StuentClassActivity)); intent.PutExtra("studentJsonStr", JsonSerializer.ToJsonString(student)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; } tv_noRenewNum.Text = string.Format("未续班({0}人)", notRenewStudentList.Count); for (var i = 0; i < notRenewStudentList.Count; i++) { var student = notRenewStudentList[i]; var itemBox = LayoutInflater.From(CurrContext).Inflate(Resource.Layout.item_renew_avatar, gridlayout_2, false); ImageView ivAvatar = itemBox.FindViewById <ImageView>(Resource.Id.iv_avatar); // 设置照片宽度和高度 var avatarWidth = itemWidth; var avatarHeight = avatarWidth; LinearLayout.LayoutParams parasAvatar = new LinearLayout.LayoutParams(avatarWidth, avatarHeight); parasAvatar.Gravity = GravityFlags.Center; ivAvatar.LayoutParameters = parasAvatar; if (!string.IsNullOrEmpty(student.avatar)) { picasso.Load(student.avatar).Placeholder(Resource.Drawable.avatar_student).Error(Resource.Drawable.avatar_student) .Transform(new CircleImageTransformation(picasso)) .Into(ivAvatar); } TextView tvName = itemBox.FindViewById <TextView>(Resource.Id.tv_name); tvName.Text = student.name; GridLayout.LayoutParams parasBox = new GridLayout.LayoutParams(); parasBox.Width = itemWidth; if (i % avatarColumns != 3) { parasBox.RightMargin = marginRight; } itemBox.LayoutParameters = parasBox; gridlayout_2.AddView(itemBox); // 添加点击事件 itemBox.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(StuentClassActivity)); intent.PutExtra("studentJsonStr", JsonSerializer.ToJsonString(student)); StartActivity(intent); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; } }