Exemple #1
0
        private async void FXTransactionsGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            //here we set the trade selected in the picker popup
            if ((string)e.Column.Header == "Trade")
            {
                if (e.EditAction == DataGridEditAction.Commit)
                {
                    var fxt           = (FXTransaction)FXTransactionsGrid.SelectedItem;
                    var items         = FxGridTradePickerListBox.Items.Cast <CheckListItem <Trade> >().ToList();
                    var selectedTrade = items.FirstOrDefault(x => x.IsChecked);

                    if (selectedTrade == null)
                    {
                        await TradesRepository.RemoveFXTransaction(fxt.Trade, fxt).ConfigureAwait(true);
                    }
                    else
                    {
                        await TradesRepository.AddFXTransaction(selectedTrade.Item, fxt).ConfigureAwait(true);
                    }
                }
                await Context.SaveChangesAsync().ConfigureAwait(true);

                FxTransactionsGridTradePickerPopup.IsOpen = false;
            }
        }
        private async void DeleteFxTransactions(IList fxts)
        {
            if (fxts == null || fxts.Count == 0)
            {
                return;
            }

            var res = await DialogService.ShowMessageAsync(
                "Delete Order(s)",
                string.Format("Are you sure you want to delete {0} FX transaction(s)?", fxts.Count),
                MessageDialogStyle.AffirmativeAndNegative);

            if (res == MessageDialogResult.Affirmative)
            {
                foreach (FXTransaction fxt in fxts)
                {
                    if (fxt.Trade != null)
                    {
                        TradesRepository.RemoveFXTransaction(fxt.Trade, fxt);
                    }
                    Context.FXTransactions.Remove(fxt);
                }
                Context.SaveChanges();
            }
        }
Exemple #3
0
 public async Task RemoveFxTransactionFromTrade(Trade trade, FXTransaction fxTransaction)
 {
     await TradesRepository.RemoveFXTransaction(trade, fxTransaction);
 }