Пример #1
0
        private void btnCaptureWithPinpad_Click(object sender, RoutedEventArgs e)
        {
            string param     = "";
            int    minLength = 0;
            int    maxLength = 0;

            SelectUserDataWindow selectUserDataWindow = new SelectUserDataWindow();

            selectUserDataWindow.ShowDialog(ref param, ref minLength, ref maxLength);

            if (minLength > 0)
            {
                E_PWUserDataMessages message = (E_PWUserDataMessages)Enum.Parse(typeof(E_PWUserDataMessages), param);

                PGWLib.PGWLib eft            = new PGWLib.PGWLib();
                string        userTypedValue = "";

                int ret = eft.getInputFromPP(ref userTypedValue, message, minLength, maxLength);
                if (ret != 0)
                {
                    MessageBox.Show(string.Format("Erro ao executar a captura de dado no PINPad: {0}{1}{2}", ret, Environment.NewLine, ((E_PWRET)ret).ToString()));
                    return;
                }

                MessageBox.Show(string.Format("Dado capturado no PINPad: {0}{1}", Environment.NewLine, userTypedValue));
            }
        }
Пример #2
0
        private int executeTransaction()
        {
            E_PWOPER operation = (E_PWOPER)Enum.Parse(typeof(E_PWOPER), cmbOper.SelectedValue.ToString());

            PGWLib.PGWLib eft = new PGWLib.PGWLib();
            int           ret = eft.startTransaction(operation, lstParameters.Items.Cast <PW_Parameter>().ToList());

            if (ret != 0)
            {
                string sError = ((E_PWRET)ret).ToString();
                int    iError = ret;

                // verifica se deu erro de transacao anterior pendente
                if (ret == (int)E_PWRET.PWRET_FROMHOSTPENDTRN)
                {
                    // confirma a transacao que estava pendente

                    E_PWCNF transactionStatus = E_PWCNF.PWCNF_REV_AUTO_ABORT;
                    ret = eft.confirmPendTransaction(transactionStatus, getTransactionResult());
                    MessageBox.Show(string.Format("Erro ao executar a transação: {0}{1}{2}{3}{4}", iError, Environment.NewLine, sError, Environment.NewLine,
                                                  ">> TRANSACAO PENDENTE RESOLVIDA <<"));
                }
                else
                {
                    MessageBox.Show(string.Format("Erro ao executar a transação: {0}{1}{2}", iError, Environment.NewLine, sError));
                }
            }
            return(ret);
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();

            eft = new PGWLib.PGWLib();

            foreach (string item in Enum.GetNames(typeof(E_PWOPER)))
            {
                cmbOper.Items.Add(item);
            }
            addMandatoryParameters();
        }
        public MainWindow()
        {
            InitializeComponent();

            // Inicializa a instancia de acesso a biblioteca
            eft = new PGWLib.PGWLib();

            // Preenche o combo com as opções de operação
            foreach (string item in Enum.GetNames(typeof(E_PWOPER)))
            {
                cmbOper.Items.Add(item);
            }

            // Define a operação de venda como default
            cmbOper.SelectedItem = E_PWOPER.PWOPER_SALE.ToString();

            AddMandatoryParameters();

            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }