Exemple #1
0
        /// <summary>
        /// 获取数据
        /// </summary>
        protected override void LoadData()
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                return;
            }
            try
            {
                LoadingDialogUtil.ShowLoadingDialog(this, "数据获取中...");

                new Thread(new ThreadStart(() =>
                {
                    var schoolId = CurrUserInfo.SchoolId;
                    var grade    = CurrUserInfo.Grade;
                    scopeList    = _meService.GetScopeByGrade(schoolId, grade ?? 0);

                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        InitList();
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                ToastUtil.ShowErrorToast(this, "操作失败");
            }
            finally
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
        /// <summary>
        /// 获取报表数据
        /// </summary>
        private void GetStudentRenewInfoListByClassCode()
        {
            try
            {
                new Thread(new ThreadStart(() =>
                {
                    var result = RenewService.GetStudentRenewInfoListByClassCode(CurrUserInfo.SchoolId, currRenewInfo.ClassCode);
                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();

                        if (result != null)
                        {
                            renewStudentList    = result.RenewStudents;
                            notRenewStudentList = result.NotRenewStudents;

                            LoadStudents();
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
        /// <summary>
        /// 获取助教组长列表
        /// </summary>
        private void GetTeacherListByScope()
        {
            try
            {
                var grade    = CurrUserInfo.Grade;
                var schoolId = CurrUserInfo.SchoolId;
                new Thread(new ThreadStart(() =>
                {
                    teacherList = new MeService().GetTeacherDirectorListByGrade(schoolId, grade ?? 0);
                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        tvTeacherCount.Text = string.Format("所有教学主管({0}人)", teacherList.Count);

                        mAdapter.SetData(teacherList);
                        mAdapter.NotifyDataSetChanged();
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
            }
        }
        private void BindData()
        {
            try
            {
                var schoolId     = CurrUserInfo.SchoolId;
                var districtCode = CurrUserInfo.DistrictCode;
                new Thread(new ThreadStart(() =>
                {
                    areaList = new MeService().GetAreaByDistrict(schoolId, districtCode);

                    RunOnUiThread(() =>
                    {
                        InitList();
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                ToastUtil.ShowErrorToast(this, "操作失败");
            }
            finally
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
        /// <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();
            }
        }
        /// <summary>
        /// 获取助教组长列表
        /// </summary>
        private void GetTeacherListByScope()
        {
            try
            {
                var schoolId     = CurrUserInfo.SchoolId;
                var districtCode = CurrUserInfo.DistrictCode;
                new Thread(new ThreadStart(() =>
                {
                    assistantList = MeService.GetAssistantLeaderList(schoolId, districtCode);
                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        tvTeacherCount.Text = string.Format("助教组长({0}人)", assistantList.Count);

                        mAdapter.SetData(assistantList);
                        mAdapter.NotifyDataSetChanged();
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
            }
        }
        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;
            }
        }
        private void InitList()
        {
            llBox.RemoveAllViews();
            foreach (var area in schoolAreaList)
            {
                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 = area.sName;
                roleIcon.SetImageResource(Resource.Drawable.icn_selected);

                if (area.sName == sName)
                {
                    roleIcon.Visibility = ViewStates.Visible;
                    roleLabel.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                }

                llBox.AddView(itemBox);

                itemWrapper.Click += (sender, e) =>
                {
                    //Intent myIntent = new Intent(this, typeof(AssistantAddActivity));
                    fromIntent.SetClass(this, typeof(AssistantAddActivity));
                    fromIntent.PutExtra("scode", area.sCode);
                    fromIntent.PutExtra("sname", area.sName);
                    SetResult(Android.App.Result.Ok, fromIntent);
                    Finish();
                    OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out);
                };
            }
            LoadingDialogUtil.DismissLoadingDialog();
        }
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void BindData()
 {
     try
     {
         var districtCode = CurrUserInfo.DistrictCode;
         var schoolId     = CurrUserInfo.SchoolId;
         new Thread(new ThreadStart(() =>
         {
             shopManagerList = new MeService().GetShopManagerList(schoolId, districtCode);
             RunOnUiThread(() =>
             {
                 LoadingDialogUtil.DismissLoadingDialog();
                 //总人数
                 tvCount.Text = CurrUserInfo.DistrictName + "店长(" + shopManagerList.Count + "人)";
                 mAdapter.SetData(shopManagerList);
                 mAdapter.NotifyDataSetChanged();
                 mSwipeRefreshLayout.Refreshing = false;
             });
         })).Start();
     }
     catch (Exception ex)
     {
         var msg = ex.Message.ToString();
         LoadingDialogUtil.DismissLoadingDialog();
         mSwipeRefreshLayout.Refreshing = false;
     }
 }
        /// <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();
            }
        }
        /// <summary>
        /// 更新操作
        /// </summary>
        private void DoUpdate()
        {
            try
            {
                if (!NetUtil.CheckNetWork(CurrActivity))
                {
                    ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                    return;
                }


                LoadingDialogUtil.ShowLoadingDialog(this, "提交中...");

                new Thread(new ThreadStart(() =>
                {
                    var relation             = new UserAreaRelationModel();
                    relation.AreaCode        = currAssistant.AreaCode;
                    relation.AreaName        = currAssistant.AreaName;
                    relation.AssistantMobile = currAssistant.Mobile;
                    relation.UserType        = (int)UserType.AssistantLeader;
                    relation.Creator         = CurrUserInfo.Name;
                    relation.Modifier        = CurrUserInfo.Name;
                    relation.SchoolId        = CurrUserInfo.SchoolId;
                    var list = new List <UserAreaRelationModel>();
                    list.Add(relation);
                    var rd = _meService.SaveUserArea(list);

                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        if (rd.State == 1)
                        {
                            ToastUtil.ShowSuccessToast(this, "操作成功");
                            new Handler().PostDelayed(() =>
                            {
                                Finish();
                                OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out);
                            }, 1000);
                        }
                        else
                        {
                            ToastUtil.ShowErrorToast(this, (string.IsNullOrEmpty(rd.Error) ? "操作失败" : rd.Error));
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                ToastUtil.ShowErrorToast(this, "操作失败");
            }
            finally
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
Exemple #12
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;
            }
        }
Exemple #13
0
        private void IsDissDialog()
        {
            if (LoadedRenewInfoInGroup5 && LoadedRenewInfoInGroup6)
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }

            if (LoadedBudgetInfoBefore && LoadedBudgetInfoAfter)
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
        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;
            }
        }
Exemple #15
0
        /// <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;
            }
        }
Exemple #16
0
        /// <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;
            }
        }
Exemple #17
0
        /// <summary>
        /// 获取教师列表
        /// </summary>
        private void GetTeacherListByScope()
        {
            try
            {
                new Thread(new ThreadStart(() =>
                {
                    var schoolId  = CurrUserInfo.SchoolId;
                    var pagerList = _meService.GetTeacherListByScope(schoolId, scopeId, pageIndex, pageSize, out totalCount);
                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        mSwipeRefreshLayout.Refreshing = false;

                        tvTeacherCount.Text = string.Format("所有教师({0}人)", totalCount);

                        if (pageIndex == 1)
                        {
                            teacherList.Clear();
                        }
                        teacherList.AddRange(pagerList);
                        pageIndex++;
                        mAdapter.HideFootere(teacherList.Count >= totalCount);

                        mAdapter.SetData(teacherList);
                        mAdapter.NotifyDataSetChanged();

                        loadingData = false;
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                mSwipeRefreshLayout.Refreshing = false;
                loadingData = false;
            }
        }
Exemple #18
0
        /// <summary>
        /// 登录操作
        /// </summary>
        public void DoLogin()
        {
            var account = etAccount.Text.Trim();

            if (string.IsNullOrEmpty(account))
            {
                ToastUtil.ShowWarningToast(this, "请输入您的手机号码或者邮箱");
                etAccount.RequestFocus();
                return;
            }
            if (!CheckUtil.IsValidEmail(account) && !CheckUtil.IsValidPhone(account))
            {
                ToastUtil.ShowWarningToast(this, "登录账号错误");
                etAccount.RequestFocus();
                return;
            }

            var passwrod = etPassword.Text.Trim();

            if (string.IsNullOrEmpty(passwrod))
            {
                ToastUtil.ShowWarningToast(this, "请输入您的登录密码");
                etPassword.RequestFocus();
                return;
            }

            if (!NetUtil.CheckNetWork(this))
            {
                ToastUtil.ShowWarningToast(this, "网络未连接!");
                return;
            }


            LoadingDialogUtil.ShowLoadingDialog(this, "登录中...");

            try
            {
                new Thread(new ThreadStart(() =>
                {
                    var result = DataService.UserService.GetUser(account, passwrod);
                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        if (result.State == 1 && result.Data != null)
                        {
                            var loginUserJson = Helper.ToJsonItem(result.Data);
                            SharedPreferencesUtil.SetParam(this, AppConfig.SP_LAST_LOGIN_ACCOUNT, account);
                            SharedPreferencesUtil.SetParam(this, AppConfig.SP_USERINFO, loginUserJson);

                            Intent intent = new Intent(this, typeof(Main));
                            StartActivity(intent);
                            OverridePendingTransition(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut);
                            this.Finish();
                        }
                        else
                        {
                            ToastUtil.ShowWarningToast(this, result.Error ?? "登录失败");
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                LoadingDialogUtil.DismissLoadingDialog();
                ToastUtil.ShowWarningToast(this, msg);
            }
        }
 public override void OnPageFinished(WebView view, string url)
 {
     //base.OnPageFinished(view, url);
     LoadingDialogUtil.DismissLoadingDialog();
 }
Exemple #20
0
        /// <summary>
        /// 添加/编辑店长信息
        /// </summary>
        /// <param name="isContinueAdd">isContinueAdd=true:连续保存</param>
        private void DoSave(bool isContinueAdd)
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                return;
            }
            try
            {
                var tname  = etName.Text.Trim();
                var temail = etEmail.Text.Trim();

                if (string.IsNullOrEmpty(tname))
                {
                    ToastUtil.ShowWarningToast(this, "请输入姓名");
                    etName.RequestFocus();
                    return;
                }
                if (!CheckUtil.IsValidEmail(temail))
                {
                    ToastUtil.ShowWarningToast(this, "邮箱格式不正确");
                    etEmail.RequestFocus();
                    return;
                }

                if (string.IsNullOrEmpty(tvAreaCodes.Text.Trim()))
                {
                    ToastUtil.ShowWarningToast(this, "请选择门店");
                    return;
                }



                LoadingDialogUtil.ShowLoadingDialog(this, "保存中...");

                new Thread(new ThreadStart(() =>
                {
                    //新增操作
                    var model          = new ManagerUserInfo();
                    model.Email        = etEmail.Text;
                    model.Name         = etName.Text;
                    model.UserType     = Convert.ToInt32(UserType.ShopManager);
                    model.IsCanLogin   = true;
                    model.SchoolId     = CurrUserInfo.SchoolId;
                    model.Creator      = CurrUserInfo.Name;
                    model.Modifier     = CurrUserInfo.Name;
                    model.DistrictCode = CurrUserInfo.DistrictCode;



                    DataEntity.Result resultData = new DataEntity.Result();

                    if (isNewAdd)
                    {
                        resultData = _meService.AddShopManager(model, AreaCodes, AreaNames);
                    }
                    else
                    {
                        var codeArr = AreaCodes.Split(',');
                        var nameArr = AreaNames.Split(',');
                        var list    = new List <UserAreaRelationModel>();
                        for (int i = 0; i < codeArr.Length; i++)
                        {
                            var relation      = new UserAreaRelationModel();
                            relation.AreaCode = codeArr[i];
                            relation.AreaName = nameArr[i];
                            relation.Email    = etEmail.Text;
                            relation.UserType = (int)UserType.ShopManager;
                            relation.Creator  = CurrUserInfo.Name;
                            relation.Modifier = CurrUserInfo.Name;
                            relation.SchoolId = CurrUserInfo.SchoolId;
                            list.Add(relation);
                        }
                        resultData = _meService.SaveUserArea(list);
                    }

                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        if (resultData.State == 1)
                        {
                            ToastUtil.ShowSuccessToast(this, "操作成功");
                            //保存并继续添加
                            if (isContinueAdd)
                            {
                                currShopManager  = new ShopManagerList();
                                etName.Text      = "";
                                etEmail.Text     = "";
                                tvAreaNames.Text = "未设置";
                            }
                            //完成
                            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();
            }
        }
        /// <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();
            }
        }
        /// <summary>
        /// 保存教师信息
        /// </summary>
        /// <param name="isContinueAdd">isContinueAdd=true:连续保存</param>
        private void DoSave(bool isContinueAdd)
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                return;
            }
            try
            {
                currAssistant.Name   = etName.Text.Trim();
                currAssistant.Mobile = etAmount.Text.Trim();
                if (string.IsNullOrEmpty(currAssistant.Name))
                {
                    ToastUtil.ShowWarningToast(this, "请输入姓名");
                    etName.RequestFocus();
                    return;
                }

                if (!Helper.IsMobile(currAssistant.Mobile))
                {
                    ToastUtil.ShowWarningToast(this, "请输入正确的手机号");
                    etAmount.RequestFocus();
                    return;
                }
                if (string.IsNullOrEmpty(currAssistant.AreaCode))
                {
                    ToastUtil.ShowWarningToast(this, "请选择教学区");
                    etAmount.RequestFocus();
                    return;
                }

                LoadingDialogUtil.ShowLoadingDialog(this, "保存中...");

                new Thread(new ThreadStart(() =>
                {
                    //新增操作
                    var model        = new ManagerUserInfo();
                    model.Mobile     = currAssistant.Mobile;
                    model.Name       = currAssistant.Name;
                    model.IsCanLogin = false;
                    model.UserType   = (int)UserType.AssistantLeader;
                    model.SchoolId   = CurrUserInfo.SchoolId;
                    model.Creator    = CurrUserInfo.Name;
                    model.Modifier   = CurrUserInfo.Name;
                    var resultData   = _meService.AddManagerUser(model, currAssistant.AreaCode, currAssistant.AreaName, 0);

                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        if (resultData.State == 1)
                        {
                            ToastUtil.ShowSuccessToast(this, "操作成功");
                            //保存并继续添加爱
                            if (isContinueAdd)
                            {
                                currAssistant = new AstLeaderListModel();
                                etName.Text   = "";
                                etAmount.Text = "";
                                tvArea.Text   = "未设置";
                                tvArea.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, "操作失败");
            }
            finally
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }