コード例 #1
0
        private void btnRefund_Click(object sender, EventArgs e)
        {
            String CardId = "";

            nfc = DCPOS.Factory.GetNFC();
            if (nfc.InitReader())
            {
                if (nfc.ConnectReader())
                {
                    if (nfc.ReadTagID(ref CardId))
                    {
                        Decimal FiatAmount = Convert.ToInt32(txtAmount.Text);
                        Decimal Bitcoins   = Convert.ToDecimal(txtBitcoins.Text);

                        MerchantCard ReadMerchantCard = new MerchantCard();
                        ReadMerchantCard.ShowDialog();

                        DCCommon common = new DCCommon();

                        String result = common.SendBitcoins(Program.MerchantCardId, Program.MerchantPublicKey, Program.MerchantEncryptedPrivateKey, CardId, Bitcoins, FiatAmount, cboCurrency.SelectedItem.ToString());
                        MessageBox.Show(result);
                    }
                    else
                    {
                        MessageBox.Show("Cannot Read CardId", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                    }
                }
                else
                {
                    MessageBox.Show("The Card is not Present", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                }
            }

            else
            {
                MessageBox.Show("The Reader cannot be Initalised", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
            }
        }
コード例 #2
0
        private void btnSell_Click(object sender, EventArgs e)
        {
            String CardId = "";

            nfc = DCPOS.Factory.GetNFC();
            if (nfc.InitReader())
            {
                if (nfc.ConnectReader())
                {
                    if (nfc.ReadTagID(ref CardId))
                    {
                        Decimal FiatAmount          = Convert.ToInt32(txtAmount.Text);
                        Decimal Bitcoins            = Convert.ToDecimal(txtBitcoins.Text);
                        String  encryptedPrivateKey = "";

                        if (nfc.readPrivateKey(ref encryptedPrivateKey))
                        {
                            String FromCardPublicAddress = "";
                            if (nfc.readPublicKey(ref FromCardPublicAddress))
                            {
                                if (ChkPINLimit(CardId, FiatAmount, cboCurrency.SelectedItem.ToString()) == "01")
                                {
                                    PinPad pinform = new PinPad();
                                    pinform.ShowDialog();

                                    if (checkPin(CardId, Program.Pin) == "00")
                                    {
                                        DCCommon common = new DCCommon();

                                        MerchantCard ReadMerchantCard = new MerchantCard();
                                        ReadMerchantCard.ShowDialog();

                                        String result = common.SendBitcoins(CardId, FromCardPublicAddress, encryptedPrivateKey, Program.MerchantCardId, Bitcoins, FiatAmount, cboCurrency.SelectedItem.ToString());
                                        MessageBox.Show(result);
                                    }
                                }
                                else
                                {
                                    DCCommon     common           = new DCCommon();
                                    MerchantCard ReadMerchantCard = new MerchantCard();
                                    ReadMerchantCard.ShowDialog();
                                    String result = common.SendBitcoins(CardId, FromCardPublicAddress, encryptedPrivateKey, Program.MerchantCardId, Bitcoins, FiatAmount, cboCurrency.SelectedItem.ToString());
                                    MessageBox.Show(result);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Cannot read Public Key", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Cannot read Private Key", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Card not on Reader or cannot read card ", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                    }
                }
                else
                {
                    MessageBox.Show("The Reader cannot be Initalised", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                }
            }

            else
            {
                MessageBox.Show("The Reader cannot be Initalised", "DC PC POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
            }
        }
コード例 #3
0
        private void setMerchantToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MerchantCard ReadMerchantCard = new MerchantCard();

            ReadMerchantCard.ShowDialog();
        }