public void clickFinancialYear(QuarterEntity quarter) { if (financialYearPopWin.IsShowing) { financialYearPopWin.Dismiss(); } if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any()) { var selected = BaseApplication.GetInstance().quarterList.FirstOrDefault(i => i.IsCurrent); if (quarter.QuarterName == selected.QuarterName) { return; } foreach (var item in BaseApplication.GetInstance().quarterList) { if (quarter.QuarterName == item.QuarterName) { item.IsCurrent = true; } else { item.IsCurrent = false; } } financialYearPopWin.SetSelectedColor(); GetRenewData(); } }
protected override void OnCreate(Bundle savedInstanceState) { BaseApplication.GetInstance().teacherList = null; LayoutReourceId = Resource.Layout.activity_teacher_list; base.OnCreate(savedInstanceState); }
/// <summary> /// 删除教师信息 /// </summary> private void DoDelete() { try { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } LoadingDialogUtil.ShowLoadingDialog(this, "删除中..."); new Thread(new ThreadStart(() => { var schoolId = CurrUserInfo.SchoolId; var type = 2; //type = 1 助教相关身份 type = 2 教师相关身份 var keyword = et_teachercode.Text; var modifier = CurrUserInfo.Name; var rd = _meService.DeleteManagerUser(schoolId, type.ToString(), keyword, modifier); RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); if (rd.State == 0) { ToastUtil.ShowErrorToast(this, (string.IsNullOrEmpty(rd.Error) ? "操作失败" : rd.Error)); } else { if (BaseApplication.GetInstance().teacherList != null) { BaseApplication.GetInstance().teacherList.Remove(currTeacher); } ToastUtil.ShowSuccessToast(this, "操作成功"); new Handler().PostDelayed(() => { Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }, 1000); } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); ToastUtil.ShowErrorToast(this, "操作失败"); } finally { LoadingDialogUtil.DismissLoadingDialog(); } }
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(); }
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().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 (categoryList != null && categoryList.Any()) { searchCagetory = categoryList[0]; tv_cagetory.Text = searchCagetory; } else { BindCategoryList(); } BindData(); }
/// <summary> /// 获取财年季度数据 /// </summary> private void LoadQuarterData() { try { new Thread(new ThreadStart(() => { BaseApplication.GetInstance().quarterList = RenewService.GetQuarter(currUserInfo.SchoolId); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); } }
/// <summary> /// 页面数据 /// </summary> protected void LoadData() { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } else { LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); if (BaseApplication.GetInstance().quarterList == null || !BaseApplication.GetInstance().quarterList.Any()) { BaseApplication.GetInstance().quarterList = RenewService.GetQuarter(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().gradeList == null) { BaseApplication.GetInstance().gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId); } GetRenewData(); // 财年选择 #region if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any()) { tv_year.Visibility = ViewStates.Visible; tv_year.Click += (sender, e) => { if (financialYearPopWin == null) { financialYearPopWin = new PopWin_IndexFinancialYear(CurrActivity, BaseApplication.GetInstance().quarterList); financialYearPopWin.clickItem += new PopWin_IndexFinancialYear.ClickItem(clickFinancialYear); } financialYearPopWin.OutsideTouchable = true; if (!financialYearPopWin.IsShowing) { financialYearPopWin.ShowAsDropDown(tv_year, 0, -15); } }; } #endregion } }
protected override void OnResume() { base.OnResume(); if (BaseApplication.GetInstance().teacherList != null) { if (teacherList.Count < BaseApplication.GetInstance().teacherList.Count) { totalCount++; } else if (teacherList.Count > BaseApplication.GetInstance().teacherList.Count) { totalCount--; } tvTeacherCount.Text = string.Format("所有教师({0}人)", totalCount >= 0 ? totalCount : 0); teacherList = BaseApplication.GetInstance().teacherList; mAdapter.SetData(teacherList); mAdapter.NotifyDataSetChanged(); } }
/// <summary> /// 页面数据 /// </summary> protected void LoadData() { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); if (BaseApplication.GetInstance().quarterList == null) { BaseApplication.GetInstance().quarterList = RenewService.GetQuarter(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().gradeList == null) { BaseApplication.GetInstance().gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().districtList == null) { BaseApplication.GetInstance().districtList = RenewService.GetDistrictList(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any()) { quarterList = BaseApplication.GetInstance().quarterList; searchQuarter = BaseApplication.GetInstance().quarterList.Find(t => t.IsCurrent); tv_btn1.Text = searchQuarter.QuarterName; } if (BaseApplication.GetInstance().gradeList != null && BaseApplication.GetInstance().gradeList.Any()) { gradeList = new List <string>(BaseApplication.GetInstance().gradeList.Select(i => i.GradeName).ToArray()); // 默认全选 searchGradeList = new List <string>(gradeList.ToArray()); } if (BaseApplication.GetInstance().districtList != null && BaseApplication.GetInstance().districtList.Any()) { districtList = new List <string>(BaseApplication.GetInstance().districtList.Select(i => i.DistrictName).ToArray()); } GetRenewInfoInGroup(); }
protected override void InitVariables() { Bundle bundle = Intent.Extras; if (bundle != null) { scopeName = bundle.GetString("scopeName"); pageFromType = bundle.GetInt("pageFromType", 1); var teacherJsonStr = bundle.GetString("teacherJsonStr"); if (!string.IsNullOrEmpty(teacherJsonStr)) { currTeacher = JsonSerializer.ToObject <TeacherListModel>(teacherJsonStr); if (pageFromType == 1 && BaseApplication.GetInstance().teacherList != null) { currTeacher = BaseApplication.GetInstance().teacherList.FirstOrDefault(i => i.Code == currTeacher.Code); } tScopeCode = currTeacher.ScopeCode ?? 0; tType = currTeacher.Type ?? 0; } } }
protected override void OnPause() { base.OnPause(); BaseApplication.GetInstance().teacherList = new List <TeacherListModel>(teacherList.ToArray()); }
/// <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(); } }
/// <summary> /// 获取数据 /// </summary> protected override void LoadData() { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); if (BaseApplication.GetInstance().quarterList == null) { BaseApplication.GetInstance().quarterList = RenewService.GetQuarter(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().gradeList == null) { BaseApplication.GetInstance().gradeList = RenewService.GetGradeList(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().districtList == null) { BaseApplication.GetInstance().districtList = RenewService.GetDistrictList(CurrUserInfo.SchoolId); } if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any()) { quarterList = BaseApplication.GetInstance().quarterList; } if (searchQuarter != null) { tv_btn1.Text = searchQuarter.QuarterName; } else { if (BaseApplication.GetInstance().quarterList != null && BaseApplication.GetInstance().quarterList.Any()) { searchQuarter = BaseApplication.GetInstance().quarterList.Find(t => t.IsCurrent); tv_btn1.Text = searchQuarter.QuarterName; } } 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_btn2.Text = selectedgrade; } else { // 默认全选 searchGradeList = new List <string>(gradeList.ToArray()); } if (BaseApplication.GetInstance().districtList != null && BaseApplication.GetInstance().districtList.Any()) { districtList = new List <string>(BaseApplication.GetInstance().districtList.Select(i => i.DistrictName).ToArray()); } if (!string.IsNullOrEmpty(searchDistrict)) { tv_btn3.Text = searchDistrict; } LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中..."); GetRenewInfoInTeacherByGroupCode(); }
/// <summary> /// 保存教师信息 /// </summary> /// <param name="isContinueAdd">isContinueAdd=true:连续保存</param> private void DoSave(bool isContinueAdd) { if (!NetUtil.CheckNetWork(CurrActivity)) { ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!"); return; } try { var tcode = et_teachercode.Text.Trim(); var tname = et_teachername.Text.Trim(); var temail = et_teacheramount.Text.Trim(); if (string.IsNullOrEmpty(tcode)) { ToastUtil.ShowWarningToast(this, "请输入教师编码"); et_teachercode.RequestFocus(); return; } if (string.IsNullOrEmpty(temail)) { ToastUtil.ShowWarningToast(this, "请输入登录账号"); et_teacheramount.RequestFocus(); return; } if (!CheckUtil.IsValidEmail(temail)) { ToastUtil.ShowWarningToast(this, "登录账号应为邮箱"); et_teacheramount.RequestFocus(); return; } if (string.IsNullOrEmpty(tname)) { ToastUtil.ShowWarningToast(this, "请输入姓名"); et_teachername.RequestFocus(); return; } if (tScopeCode == 0) { ToastUtil.ShowWarningToast(this, "请选择教研组"); return; } if (tType == 0) { ToastUtil.ShowWarningToast(this, "请选择角色"); return; } LoadingDialogUtil.ShowLoadingDialog(this, "保存中..."); new Thread(new ThreadStart(() => { //新增操作 var model = new ManagerUserInfo(); model.Code = tcode; model.Email = temail; model.Name = tname; model.UserType = tType; if (model.UserType == (int)UserType.TeacherDirector || model.UserType == (int)UserType.TeacherArea) { model.IsCanLogin = true; } else { model.IsCanLogin = false; } model.SchoolId = CurrUserInfo.SchoolId; model.Creator = CurrUserInfo.Name; model.Modifier = CurrUserInfo.Name; DataEntity.Result resultData; if (isNewAdd) { resultData = _meService.AddManagerUser(model, "", "", tScopeCode); } else { resultData = _meService.UpdateManagerUser(model, "", "", tScopeCode); } RunOnUiThread(() => { LoadingDialogUtil.DismissLoadingDialog(); if (resultData.State == 1) { ToastUtil.ShowSuccessToast(this, "操作成功"); currTeacher.Name = tname; currTeacher.Email = temail; currTeacher.Code = tcode; currTeacher.ScopeCode = tScopeCode; currTeacher.Type = tType; if (BaseApplication.GetInstance().teacherList != null) { if (isNewAdd) { BaseApplication.GetInstance().teacherList.Add(currTeacher); } else { if (scopeName != currTeacher.ScopeName) { BaseApplication.GetInstance().teacherList.Remove(currTeacher); } } } //保存并继续添加爱 if (isContinueAdd) { currTeacher = new TeacherListModel(); et_teachercode.Text = ""; et_teachername.Text = ""; et_teacheramount.Text = ""; tvRoleLabel.Text = "未设置"; tvRoleLabel.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond))); tvScoleLabel.Text = "未设置"; tvScoleLabel.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond))); } //完成 else { new Handler().PostDelayed(() => { Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }, 1000); } } else { ToastUtil.ShowErrorToast(this, (string.IsNullOrEmpty(resultData.Error) ? "操作失败" : resultData.Error)); } }); })).Start(); } catch (Exception ex) { var msg = ex.Message.ToString(); ToastUtil.ShowErrorToast(this, "操作失败"); LoadingDialogUtil.DismissLoadingDialog(); } }
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(); }