Example #1
0
        public void withdrawAmount(int acNo, int pin, float amount)
        {
            String sql = "update Customer set customerBalance = customerBalance - " + amount + " where customerACNo = " + acNo + " and customerPin = " + pin;

            dbConnection.manipulate(sql);

            DepositBLL depositBLL = new DepositBLL();
            int        customerId = depositBLL.getCustomerIdByACNo(acNo);

            sql = "insert into Transactions(customerId, transactionStatus, transactionAmount) values(" + customerId + ", 'Withdraw'," + amount + ");";
            dbConnection.manipulate(sql);
        }
Example #2
0
        private void btnPinChange_Click(object sender, EventArgs e)
        {
            if (txtCustomerACNo.Text == "")
            {
                MessageBox.Show("Enter account number !!!");
                txtCustomerACNo.Focus();
                return;
            }
            else if (txtOldPinNo.Text == "")
            {
                MessageBox.Show("Enter old pin number !!!");
                txtOldPinNo.Focus();
                return;
            }
            else if (txtNewPinNo.Text == "")
            {
                MessageBox.Show("Enter new pin number !!!");
                txtNewPinNo.Focus();
                return;
            }
            else if (txtConfirmNewPin.Text == "")
            {
                MessageBox.Show("Confirm your new pin number !!!");
            }
            else
            {
                int accountNo = int.Parse(txtCustomerACNo.Text);

                DepositBLL depositBLL     = new DepositBLL();
                bool       customerStatus = depositBLL.validateCustomerByACNo(accountNo);

                if (customerStatus)
                {
                    int  oldPin    = int.Parse(txtOldPinNo.Text);
                    bool pinStatus = pinBLL.validatePin(oldPin, accountNo);

                    if (pinStatus)
                    {
                        int newPin     = int.Parse(txtNewPinNo.Text);
                        int confirmPin = int.Parse(txtConfirmNewPin.Text);

                        if (newPin == confirmPin)
                        {
                            pinBLL.updatePin(accountNo, newPin);
                            MessageBox.Show("Pin changed successfully" + "\nNew pin number: " + newPin);
                        }
                        else
                        {
                            MessageBox.Show("Pin number do not match !!!");
                            txtConfirmNewPin.Text = "";
                            txtConfirmNewPin.Focus();
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong old pin number !!!");
                        txtOldPinNo.Text = "";
                        txtOldPinNo.Focus();
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Invalid customer account number !!!");
                    txtCustomerACNo.Text = txtOldPinNo.Text = txtNewPinNo.Text = txtConfirmNewPin.Text = "";
                    txtCustomerACNo.Focus();
                    return;
                }
            }
        }