private void btnContinue_Clicked(object sender, EventArgs e) { vm.RefernceMsg = ReferenceMessage.Text; double value; var foreignAmt = double.TryParse(AmountSentInForeignCurrecy.Text, out value) ? value : (double?)null; vm.SelectedCurrencyValue = FromCurrency.SelectedItem; vm.AmountSent = AmountSentInForeignCurrecy.Text; if (foreignAmt != null) { if (vm.SelectedCurrencyValue == "USD") { vm.AmountRecieved = (double.Parse(vm.USDCurrencyValue) * double.Parse(AmountSentInForeignCurrecy.Text)).ToString(); } else if (vm.SelectedCurrencyValue == "GBP") { vm.AmountRecieved = (double.Parse(vm.GBPCurrencyValue) * double.Parse(AmountSentInForeignCurrecy.Text)).ToString(); } else if (vm.SelectedCurrencyValue == "EUR") { vm.AmountRecieved = (double.Parse(vm.EURCurrecnyValue) * double.Parse(AmountSentInForeignCurrecy.Text)).ToString(); } } if (!vm.ValidateForm("CurrencySwapPage")) { MessageDialog.Show("Info", "You have to fill all fields before you can proceed", DialogType.Info, "OK", null, "", null); return; } Navigation.PushAsync(new CurrencySwapConclusion(vm)); }
private async void btnConfirm_Clicked(object sender, EventArgs e) { try { vm.SelectAccount = SelectedAccount.SelectedItem; if (!vm.ValidateForm("CurrencySwapConclusion")) { MessageDialog.Show("Info", "You have to fill all fields before you can proceed", DialogType.Info, "OK", null, "", null); return; } vm.CurrencyCode = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(a => a.AccountBalanceAccountType == vm.SelectAccount).currencyCode; if (vm.SelectedCurrencyValue != vm.CurrencyCode) { MessageDialog.Show("Error", "The Source Account currency and the Currency you selected do not match", DialogType.Error, "OK", null, "", null); return; } string newRate = string.Empty; if (vm.SelectedCurrencyValue == "USD") { newRate = vm.USDCurrencyValue; } if (vm.SelectedCurrencyValue == "GBP") { newRate = vm.GBPCurrencyValue; } if (vm.SelectedCurrencyValue == "EUR") { newRate = vm.EURCurrecnyValue; } vm.Nuban = GlobalStaticFields.Customer.ListOfAllAccounts.FirstOrDefault(a => a.AccountBalanceAccountType == vm.SelectAccount).nuban; string responseMsg = $"Source Account: {vm.Nuban} \n Destination Account:{vm.BeneficiaryAcc} \n Rate:{newRate} \n Amount: {string.Format("{0:N1}", vm.AmountRecieved)}"; MessageDialog.Show("Confirmation", responseMsg, DialogType.Info, "Yes", () => { Device.BeginInvokeOnMainThread(() => { if (GlobalStaticFields.Customer.IsTPin) { var tpin = new PopUps.VerifyPinPage("Confirmation", vm.AmountRecieved, "NGN", responseMsg); tpin.Validated += Tpin_Validated; Navigation.PushAsync(tpin); } else { vm.ExecuteCurrencySwap(vm.Nuban, vm.CurrencyCode); } }); }, "No", null ); } catch (Exception ex) { ex.Message.ToString(); // throw; } }