private async void GoiVay_Clicked(object sender, EventArgs e)
        {
            var response = await ApiHelper.Post(ApiRouter.BANK_EMPLOYEE_CHECK, null, true);

            if (response.IsSuccess && response.Content != null)
            {
                bool isEmployee = (bool)response.Content;
                if (isEmployee)
                {
                    // chuyen qua man hinh danh sach goi vay
                    await Navigation.PushAsync(new MyGoiVayListPage());
                }
                else
                {
                    await DisplayAlert("", Language.dang_ky_nhan_vien_ngan_hang, Language.dong);

                    var dangKyNhanVienView = new DangKyNhanVienNganHangView(LookUpModal);
                    dangKyNhanVienView.OnCancel += async(s, e2) => await ModalBankEmployeeRegister.Hide();

                    dangKyNhanVienView.OnSaved += async(s, e2) =>
                    {
                        await ModalBankEmployeeRegister.Hide();

                        await Navigation.PushAsync(new MyGoiVayListPage());

                        ToastMessageHelper.ShortMessage(Language.dang_ky_thanh_cong);
                    };
                    ModalBankEmployeeRegister.Body = dangKyNhanVienView;
                    await ModalBankEmployeeRegister.Show();
                }
            }
        }
Exemple #2
0
        private async void AddLoan_Clicked(object sender, EventArgs e)
        {
            if (!UserLogged.IsLogged)
            {
                await Shell.Current.DisplayAlert("", Language.vui_long_dang_nhap, Language.dong);

                ((AppShell)Shell.Current).SetLoginPageActive();
                return;
            }

            var resonse = await ApiHelper.Get <BankEmployee>(ApiRouter.BANK_EMPLOYEE_DETAIL + UserLogged.Id);

            if (resonse.IsSuccess && resonse.Content != null)
            {
                var view = new AddLoanView(LookUpModal);
                view.OnCancel += async(sender1, e1) => await MainCenterModal.Hide();

                view.OnSaved += async(sender1, e1) =>
                {
                    loadingPopup.IsVisible = true;
                    await MainCenterModal.Hide();

                    await viewModel.LoadOnRefreshCommandAsync();

                    loadingPopup.IsVisible = false;
                };
                MainCenterModal.Title = Language.dang_goi_vay;
                MainCenterModal.Body  = view;
                await MainCenterModal.Show();
            }
            else
            {
                await Shell.Current.DisplayAlert("", Language.dang_ky_nhan_vien_ngan_hang, Language.dong);

                var dangKyNhanVienView = new DangKyNhanVienNganHangView(LookUpModal);
                dangKyNhanVienView.OnCancel += async(s, e2) => await ModalBankEmployeeRegister.Hide();

                dangKyNhanVienView.OnSaved += async(s, e2) =>
                {
                    await ModalBankEmployeeRegister.Hide();

                    ToastMessageHelper.ShortMessage(Language.dang_ky_nhan_vien_thanh_cong);
                    AddLoan_Clicked(sender, EventArgs.Empty);
                };
                ModalBankEmployeeRegister.Body = dangKyNhanVienView;
                await ModalBankEmployeeRegister.Show();
            }
        }