private async Task CallTransactWebService(string fromAccountNumber, string toAccountNumber, string cardSerialNumberFrom, string cardSerialNumberTo, int?amount, TransactionType transactionType) { Device.BeginInvokeOnMainThread(() => { gridProgress.IsVisible = true; }); try { XServerApiClient client = SessionSingleton.GenXServerApiClient(); using (SessionSingleton.HttpClient) { Transaction tx = new Transaction() { Amount = amount.Value, TransactionType = transactionType, AccountFrom = fromAccountNumber, AccountTo = toAccountNumber, CardSerialFrom = cardSerialNumberFrom, CardSerialTo = cardSerialNumberTo }; await client.TransactionTransferPostAsync(tx.ToJsonString()); } } catch (Exception ex) { throw ex; } finally { Device.BeginInvokeOnMainThread(() => { gridProgress.IsVisible = false; }); } }
private async void cmdOk_Clicked(object sender, EventArgs e) { try { gridProgress.IsVisible = true; InventoryGroup group = (pickGroup.SelectedItem as InventoryGroup); InventoryItem.InventoryGroupIdRef = group.InventoryGroupId; InventoryItem ii = new InventoryItem() { Name = InventoryItem.Name, Description = InventoryItem.Description, Barcode = InventoryItem.Barcode, InventoryGroupIdRef = InventoryItem.InventoryGroupIdRef, Price = Validate.AmountToCents(InventoryItem.Price) }; XServerApiClient client = SessionSingleton.GenXServerApiClient(); using (SessionSingleton.HttpClient) { switch (updateType) { case UpdateType.Add: int id = await client.StoreInventoryitemPostAsync(ii.ToJsonString()); InventoryItem.InventoryItemId = id; break; case UpdateType.Update: InventoryItem.InventoryGroupIdRef = group.InventoryGroupId; ii.InventoryItemId = InventoryItem.InventoryItemId; await client.StoreInventoryitemPutAsync(ii.ToJsonString()); break; } } IsCancelled = false; ClosePage(); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); } finally { gridProgress.IsVisible = false; } }
private async void cmdOk_Clicked(object sender, EventArgs e) { try { gridProgress.IsVisible = true; InventoryGroup ig = new InventoryGroup() { Name = InventoryGroup.Name, Description = InventoryGroup.Description, }; XServerApiClient client = SessionSingleton.GenXServerApiClient(); using (SessionSingleton.HttpClient) { switch (updateType) { case UpdateType.Add: int id = await client.StoreInventorygroupPostAsync(ig.ToJsonString()); InventoryGroup.InventoryGroupId = id; break; case UpdateType.Update: ig.InventoryGroupId = InventoryGroup.InventoryGroupId; await client.StoreInventorygroupPutAsync(ig.ToJsonString()); break; } } IsCancelled = false; ClosePage(); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); } finally { gridProgress.IsVisible = false; } }
private async void cmdOk_Clicked(object sender, EventArgs e) { try { gridProgress.IsVisible = true; await Task.Run(async() => { XServerApiClient client = SessionSingleton.GenXServerApiClient(); using (SessionSingleton.HttpClient) { await client.ProfileAddphonenumberPostAsync(txtPhoneNumber.Text); Device.BeginInvokeOnMainThread(() => { gridProgress.IsVisible = false; ConfirmCodeView vpn = new ConfirmCodeView(CodeType.PhoneNumber, txtPhoneNumber.Text); vpn.Disappearing += (sender2, e2) => { if (!vpn.IsCancelled) { PhoneNumber = txtPhoneNumber.Text; IsCancelled = false; ClosePage(); } }; OpenPage(vpn); }); } }); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); } finally { gridProgress.IsVisible = false; } }
private async Task CallPosTransactWebService(string fromAccountNumber, string toAccountNumber, string cardSerialNumberFrom, string cardSerialNumberTo, int?amount, TransactionType transactionType, String emvData) { Device.BeginInvokeOnMainThread(() => { gridProgress.IsVisible = true; }); try { XServerApiClient client = SessionSingleton.GenXServerApiClient(); using (SessionSingleton.HttpClient) { POSTransaction posTx = new POSTransaction(); posTx.InvItems = posTransactionItems; Transaction tx = new Transaction() { Amount = Validate.AmountToCents(totalAmount.Total), AccountFrom = fromAccountNumber, AccountTo = toAccountNumber, CardSerialFrom = cardSerialNumberFrom, CardSerialTo = cardSerialNumberTo, CardFromEMVData = emvData, }; await client.StoreSalePostAsync(tx.ToJsonString(), posTx.ToJsonString()); } } catch (Exception ex) { throw ex; } finally { Device.BeginInvokeOnMainThread(() => { gridProgress.IsVisible = false; }); } }