Ejemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            PaymentCard card = LoggedClient.FindCard(dataGridView1.CurrentRow.Cells["Nr"].Value.ToString());

            card.Pay(Convert.ToDouble($"{intFundsBox.Text},{floatFundsBox.Text}"));
            dataGridView1.CurrentRow.Cells["Funds"].Value = card.CheckFunds();
        }
Ejemplo n.º 2
0
 private void PaymentBtn_Click(object sender, EventArgs e)
 {
     try
     {
         PaymentCard card   = LoggedClient.FindCard(dataGridView1.CurrentRow.Cells["Nr"].Value.ToString());
         double      amount = Convert.ToDouble($"{intPay.Text},{floatPay.Text}");
         Payment     pay    = new Payment(LoggedClient.GetKRS(), card.GetNr(), amount.ToString(), RecievierNamePay.Text, RecievierCardPay.Text, TitlePay.Text, DateTime.Now.ToString());
         LoggedClient.RequestAuthorization(pay, card);
         card.Pay(amount);
         dataGridView1.CurrentRow.Cells["Funds"].Value = card.CheckFunds();
         dataGridView2.Rows.Add(pay.Title, pay.FromKRS, pay.Amount, pay.ToKRS, pay.ToCard, pay.Date);
         //PaymentCardServiceCenter.DB.Write(pay);
     }
     catch (FormatException)
     {
         ErrorLabel.Text = " Not a valid input";
     }
     catch (InvalidValueException)
     {
         ErrorLabel.Text = "Enter a positive value.";
     }
     catch (RequestRejectedException ex)
     {
         ErrorLabel.Text = $"Bank {ex.BankName} has rejected Your request";
     }
     catch (ClientNotFoundException ex)
     {
         ErrorLabel.Text = $"{ex.KRS} not found";
     }
     catch (CardNotFoundException ex)
     {
         ErrorLabel.Text = $"{ex.nr} not found";
     }
 }
Ejemplo n.º 3
0
 private void Creditbtn_Click(object sender, EventArgs e)
 {
     try
     {
         PaymentCard card = PaymentCardServiceCenter.FindBank(BankNameBox.Text).AuthorizeCard(LoggedClient.GetName(), LoggedClient.GetKRS(), 2);
         dataGridView1.Rows.Add(card.GetNr(), card.CheckFunds(), card.GetBank(), card.CardType());
         LoggedClient.AddCard(card);
     }
     catch (RequestRejectedException ex)
     {
         ErrorLabel.Text = $"Bank {ex.BankName} has rejected Your request";
     }
     catch (BanknotFoundException ex)
     {
         ErrorLabel.Text = $"Bank {ex.bank} not found";
     }
 }
Ejemplo n.º 4
0
        private void buttonDebit_Click(object sender, EventArgs e)
        {
            PaymentCard newCard = LoggedBank.AuthorizeCard(LoggedBank.FindClient(CardKRSBox.Text).GetName(), 1);

            dataGridView2.Rows.Add(newCard.GetOwner(), CardKRSBox.Text, newCard.CheckFunds().ToString(), newCard.GetType());
        }