Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            int cardId;

            if (int.TryParse(txtCardNumber.Text, out cardId))
            {
                if (_mainViewModel.CardExpireDate(cardId) > DateTime.Now)
                {
                    if (_mainViewModel.Login(cardId, txtPin.Text))
                    {
                        using (frmWithdrawal newform = new frmWithdrawal(cardId))
                        {
                            newform.ShowDialog();
                            if (newform.DialogResult == DialogResult.OK)
                            {
                                txtCardNumber.Text = null;
                                txtPin.Text        = null;
                            }
                        }
                    }
                    else
                    {
                        COUNT++;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void confirmButtonbttn_Click(object sender, EventArgs e)
        {
            bool isTextInt = int.TryParse(nmrcTxtBxLogin.Text, out int login);

            if (String.IsNullOrEmpty(nmrcTxtBxLogin.Text) || String.IsNullOrEmpty(nmrcTxtBxPassword.Text) || !isTextInt)
            {
                MessageBox.Show("Please check if you filled all fields correctly");
            }
            else
            {
                CreditCard card = _atmManager.GetCreditCardByCardNumber(login);
                if (card.Id == 0)
                {
                    MessageBox.Show("WrongCard Number");
                }
                else if (card.ExpirationDate <= DateTime.Now || card.CreationCardDate >= DateTime.Now || card.IsCardBlocked)
                {
                    MessageBox.Show("Card is not Valid, please check with BankIslam Personel");
                }
                else if (card.Id != 0 && card.PasswordCard.Equals(_atmManager.CalculateMD5Hash(nmrcTxtBxPassword.Text)))
                {
                    Close();
                    using (frmWithdrawal newForm = new frmWithdrawal(card.CardNumber))
                    {
                        newForm.ShowDialog();
                    }
                }
                else
                {
                    if (cardNumber != login)
                    {
                        cardNumber = login;
                        _count     = 0;
                    }
                    _count++;
                    MessageBox.Show("Wrong password");

                    if (_count >= 3 && _atmManager.AccessCreditCard(card.CardNumber, 1))
                    {
                        MessageBox.Show("Card has been blocked, goodbye, have a nice day");
                        Close();
                    }
                }
            }
        }