// private static TransactionServer _server;

        public BankControl()
        {
            InitializeComponent();
            acctTextBox.DataContext      = Vm;
            errorTextBox.DataContext     = Vm;
            acctTypeComboBox.ItemsSource = Account.LoadAccountTypes();

            _server = new TransactionServer(BankControlForm.Bank);
        }
示例#2
0
 public static string ExportForEvent(this TransactionServer transactionServer)
 {
     return(s_EventExportValues[transactionServer]);
 }
示例#3
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            TransactionServer transServer = new TransactionServer();

            bool todas_informacoes_ok = true;

            try
            {
                // cartao com senha
                if (Convert.ToBoolean(CARTAO_TEM_SENHA))
                {
                    // nao digitou senha
                    if (String.IsNullOrEmpty(INPUT_SENHA.Password.ToString()))
                    {
                        todas_informacoes_ok = false;
                    }
                }

                // cartao credito, necessario escolher quantidade de parcelas
                if (COMBO_TIPO_TRANSACAO.Text.ToUpper().Equals("CRÉDITO / DÉBITO"))
                {
                    todas_informacoes_ok = false;
                }

                if (COMBO_TIPO_TRANSACAO.Text.ToUpper().Equals("CRÉDITO"))
                {
                    // nao escolher quantidade de parcelas
                    if (COMBO_NUMERO_PARCELAS.Text.ToUpper().Equals("PARCELAS") ||
                        COMBO_NUMERO_PARCELAS.Text.Equals("0"))
                    {
                        todas_informacoes_ok = false;
                    }
                }

                // nao digitou valor da compra
                if (String.IsNullOrEmpty(INPUT_VALOR.Text))
                {
                    todas_informacoes_ok = false;
                }

                // nao escolheu cartao
                if (String.IsNullOrEmpty(EscolheuCartao))
                {
                    todas_informacoes_ok = false;
                }

                if (!todas_informacoes_ok)
                {
                    MessageBox.Show("Por favor, falta informação.", "Alert", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    string parcelas = COMBO_NUMERO_PARCELAS.Text;

                    if (parcelas.ToUpper().Equals("PARCELAS"))
                    {
                        parcelas = "0";
                    }

                    var resultTransaction = await transServer.SendTransaction(
                        EscolheuCartao,
                        INPUT_SENHA.Password.ToString(),
                        INPUT_VALOR.Text,
                        COMBO_TIPO_TRANSACAO.Text,
                        parcelas,
                        CARTAO_TEM_SENHA
                        );
                }
            }
            catch (HttpRequestException ex)
            {
                MessageBox.Show("Erro de comunicação com servidor - " + ex.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }