void LoadOrgs()
        {
            try
            {
                CashMode mode = FilterSuppliers.IsChecked == true ? CashMode.Expense : CashMode.Neutral;

                switch (mode)
                {
                case CashMode.Expense:
                    textAccountCode.ItemsSource = tcBitcoin.NodeCash.vwOrgLists
                                                  .Where(tb => tb.CashModeCode == (short)mode && (tb.OrganisationStatusCode == 1 || tb.OrganisationStatusCode == 2))
                                                  .OrderBy(tb => tb.AccountCode)
                                                  .Select(account => TCBitcoin.EmbedKey(account.AccountCode, $"{account.AccountName} ({account.OrganisationType})"))
                                                  .ToList();
                    break;

                default:
                    textAccountCode.ItemsSource = tcBitcoin.NodeCash.vwOrgLists
                                                  .OrderBy(tb => tb.AccountCode)
                                                  .Select(account => TCBitcoin.EmbedKey(account.AccountCode, $"{account.AccountName} ({account.OrganisationType})"))
                                                  .ToList();
                    break;
                }
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
        public TxControl(TreeView treeView, TCBitcoin bitcoin)
        {
            InitializeComponent();

            tvWallet  = treeView;
            tcBitcoin = bitcoin;
        }
        public PayOutWindow(TCBitcoin bitcoin, AccountKey key)
        {
            tcBitcoin  = bitcoin;
            accountKey = key;

            InitializeComponent();
        }
        void LoadOrg()
        {
            try
            {
                vwOrgList org = tcBitcoin.NodeCash.vwOrgLists
                                .Where(tb => tb.AccountCode == AccountCode)
                                .Select(tb => tb).First();

                vwCashCode cash_code = tcBitcoin.NodeCash.vwCashCodes
                                       .Where(tb => tb.CashCode == org.CashCode)
                                       .Select(tb => tb)
                                       .FirstOrDefault();

                if (cash_code != null)
                {
                    textCashCode.Text = TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})");
                }

                vwTaxCode tax_code = tcBitcoin.NodeCash.vwTaxCodes
                                     .Where(tb => tb.TaxCode == org.TaxCode)
                                     .Select(tb => tb)
                                     .FirstOrDefault();

                if (tax_code != null)
                {
                    textTaxCode.Text = TCBitcoin.EmbedKey(tax_code.TaxCode, $"{tax_code.TaxDescription} ({tax_code.TaxType})");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public PayInWindow(TCBitcoin ttextitcoin, fnTxResult txid)
        {
            tcBitcoin = ttextitcoin;
            txId      = txid;

            InitializeComponent();
        }
        public KeyTransferWindow(TCBitcoin bitcoin, AccountKey key)
        {
            tcBitcoin  = bitcoin;
            accountKey = key;

            InitializeComponent();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                dpPaidOn.SelectedDate = DateTime.Today;
                textPaidInValue.Text  = $"{txId.MoneyIn - txId.MoneyOut}";

                textUserName.Text = tcBitcoin.NodeCash.vwUserCredentials
                                    .Select(tb => tb.UserName)
                                    .First();

                textCashCode.ItemsSource = tcBitcoin.NodeCash.vwCashCodes
                                           .Where(tb => tb.CashModeCode != (short)CashMode.Expense)
                                           .OrderBy(tb => tb.CashCode)
                                           .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                           .ToList();

                textTaxCode.ItemsSource = tcBitcoin.NodeCash.vwTaxCodes
                                          .OrderBy(tb => tb.TaxCode)
                                          .Select(tax_code => TCBitcoin.EmbedKey(tax_code.TaxCode, $"{tax_code.TaxDescription} ({tax_code.TaxType})"))
                                          .ToList();

                LoadOrgs();

                textPaymentReference.Text = txId.TxMessage;

                textAccountCode.Focus();
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textKeyName.Text = accountKey.KeyName;
                balance          = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                textBalance.Text     = $"{balance} {TCBitcoin.MILLI_BITCOIN_NAME}";
                textAccountName.Text = invoice.AccountName;
                PaymentAddress       = invoice.PaymentAddress;
                balanceOutstanding   = await tcBitcoin.NodeCash.AccountBalance(invoice.AccountCode);

                textOutstandingAmount.Text = $"{balanceOutstanding} {TCBitcoin.MILLI_BITCOIN_NAME}";
                AmountToPay = balanceOutstanding <= balance ? (decimal)balanceOutstanding : (decimal)balance;

                textCashCodeForChange.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                                    .Where(text => text.CashModeCode == (short)CashMode.Income)
                                                    .OrderBy(text => text.CashCode)
                                                    .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                                    .ToList();

                if (textCashCodeForChange.Items.Count > 0)
                {
                    textCashCodeForChange.SelectedIndex = 0;
                }

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }
 public PayAccountWindow(TCBitcoin bitcoin, AccountKey extendedKey, vwInvoicedPayments invoiceToPay)
 {
     InitializeComponent();
     tcBitcoin  = bitcoin;
     accountKey = extendedKey;
     invoice    = invoiceToPay;
 }
        public ChangeControl(TreeView treeView, TCBitcoin bitcoin, CoinChangeType coinChangeType)
        {
            InitializeComponent();

            tvWallet   = treeView;
            tcBitcoin  = bitcoin;
            ChangeType = coinChangeType;
        }
Beispiel #11
0
        public InvoicesControl(TreeView treeView, TCBitcoin bitcoin, CashMode cashMode)
        {
            tvWallet  = treeView;
            tcBitcoin = bitcoin;
            Polarity  = cashMode;

            InitializeComponent();
        }
Beispiel #12
0
 private void Receiver_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         TCBitcoin bitcoin = (TCBitcoin)e.Argument;
         bitcoin.ReceiveCoins(sender as BackgroundWorker);
     }
     catch (Exception err)
     {
         MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textAmount.Focus();
                textKeyNameFrom.Text = accountKey.KeyName;
                TransferAmount       = 0;

                textKeyNameTo.ItemsSource = tcBitcoin.NodeCash.vwNamespaces
                                            .Where(text => text.CashAccountCode == tcBitcoin.CashAccountCode && text.KeyLevel > 0 && text.KeyName != accountKey.KeyName)
                                            .OrderBy(text => text.KeyName)
                                            .Select(text => text.KeyName).ToList <string>();

                if (textKeyNameTo.Items.Count > 0)
                {
                    textKeyNameTo.SelectedIndex = 0;
                }

                textCashCodeFrom.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                               .Where(text => text.CashModeCode == (short)CashMode.Expense)
                                               .OrderBy(text => text.CashCode)
                                               .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                               .ToList();

                if (textCashCodeFrom.Items.Count > 0)
                {
                    textCashCodeFrom.SelectedIndex = 0;
                }

                textCashCodeTo.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                             .Where(text => text.CashModeCode == (short)CashMode.Income)
                                             .OrderBy(text => text.CashCode)
                                             .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                             .ToList();

                if (textCashCodeTo.Items.Count > 0)
                {
                    textCashCodeTo.SelectedIndex = 0;
                }

                var balance = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                Balance = (decimal)balance;

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textAmount.Focus();
                textKeyNameFrom.Text = accountKey.KeyName;
                AmountToPay          = 0;

                textPaymentAddress.Focus();

                textCashCode.ItemsSource = tcBitcoin.NodeCash.vwCashCodes
                                           .Where(tb => tb.CashModeCode == (short)CashMode.Expense)
                                           .OrderBy(tb => tb.CashCode)
                                           .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                           .ToList();

                textTaxCode.ItemsSource = tcBitcoin.NodeCash.vwTaxCodes
                                          .OrderBy(tb => tb.TaxCode)
                                          .Select(tax_code => TCBitcoin.EmbedKey(tax_code.TaxCode, $"{tax_code.TaxDescription} ({tax_code.TaxType})"))
                                          .ToList();

                LoadOrgs();

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);

                var balance = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                Balance = (decimal)balance;
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }
 public ChangePropertiesWindow(fnChangeResult changeResult, TCBitcoin bitcoin)
 {
     InitializeComponent();
     tcBitcoin = bitcoin;
     change    = changeResult;
 }