// goto company page private async void OnCompanyClicked(object sender, EventArgs e) { await UserLogged.ReloadProfile(); var appShell = (AppShell)Shell.Current; appShell.AddMenu_QuanLyCongTy(); if (string.IsNullOrEmpty(UserLogged.CompanyId)) { string action = await DisplayActionSheet(Language.cong_ty, Language.huy, null, Language.dang_ky_cong_ty, Language.dang_ky_nhan_vien); if (action == Language.dang_ky_cong_ty) { await Navigation.PushAsync(new AddCompanyPage()); } else if (action == Language.dang_ky_nhan_vien) { enNumPhone.Text = ""; await ModalRegisterEmployee.Show(); } } else { await Shell.Current.GoToAsync("//" + AppShell.QUANLYCONGTY); } }
private async void OnClick_SendConFirm(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(enNumPhone.Text)) { await DisplayAlert("", Language.vui_long_nhap_so_dien_thoai, Language.dong); return; } ICompanyService companyService = DependencyService.Get <ICompanyService>(); InviteUser inviteUser = companyService.FindInviteUser(UserLogged.Phone, enNumPhone.Text); if (inviteUser == null) { await DisplayAlert("", Language.otp_khong_hop_le, Language.dong); return; } ApiResponse apiResponse = await ApiHelper.Get <User>($"{ApiRouter.EMPLOYEE_GET_EMPLOYEE_BY_PHONE}/" + inviteUser.PhoneNumber, true); if (apiResponse.Content != null) { User user = apiResponse.Content as User; user.CompanyId = Guid.Parse(inviteUser.CompanyId); ApiResponse responseUser = await ApiHelper.Put($"{ApiRouter.EMPLOYEE_CONFIRM_COMPANNY}", user, true); if (responseUser.IsSuccess) { companyService.DeleteInvitedUser(inviteUser.Id);// delete inviteruser khi da xac nhan UserLogged.CompanyId = inviteUser.CompanyId; await ModalRegisterEmployee.Hide(); enNumPhone.Text = null; this.OnCompanyClicked(sender, e); ToastMessageHelper.ShortMessage(Language.dang_ky_thanh_cong); } } }