Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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();
            }
        }