private void btnLogin_Click(object sender, EventArgs e)
        {
            var username = txtUsername.Text;
            var password = txtPassword.Text;

            var status   = false;
            var customer = new Customer();

            customers.ForEach(item =>
            {
                if (item.Username == username && item.Password == password)
                {
                    status = true;

                    customer.Firstname     = item.Firstname;
                    customer.Lastname      = item.Lastname;
                    customer.AccountNumber = item.AccountNumber;
                    customer.AccountType   = item.AccountType;
                    customer.CustomerNo    = item.CustomerNo;
                    customer.Balance       = item.Balance;
                    customer.Othername     = item.Othername;
                    customer.Phone         = item.Phone;
                    customer.Username      = item.Username;
                    customer.Password      = item.Password;
                }
            });

            if (status == true)
            {
                Console.WriteLine("new customer:", customer);



                MessageBox.Show("Login Succesful");
                var dashboard = new CustomerDashboard(customer);
                dashboard.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Login Failed!! Invalid username or password ");
            }


            txtUsername.Text = "";
            txtPassword.Text = "";
        }
        public void AddUpdateCustomer(Customer C)
        {
            txtPassword.PasswordChar = '*';
            var status            = false;
            var validation        = new Validations();
            var AddUpdateCustomer = new CustomerController();

            if (validation.TextOnlyValidation(txtFirstname.Text) == false)
            {
                txtFirstname.Focus();
                errorProvider1.SetError(txtFirstname, "Enter Correct name");
                status = true;
                //   MessageBox.Show("Incorrect User Detail Try Again");
            }
            else if (validation.TextOnlyValidation(txtLastname.Text) == false)
            {
                txtLastname.Focus();
                errorProvider1.SetError(txtLastname, "Enter Correct name");
                status = true;
            }

            /* if (txtOthername.Text == null)
             * {
             *
             *   txtOthername.Focus();
             *   errorProvider1.SetError(txtOthername, "Enter Correct name");
             *   status = true;
             * }*/
            else if (validation.TextOnlyValidation(txtUsername.Text) == false)
            {
                txtUsername.Focus();
                errorProvider1.SetError(txtUsername, "Enter Correct username");
                status = true;
            }
            else if (validation.ValidateDouble(txtDeposit.Text) == false)
            {
                txtDeposit.Focus();
                errorProvider1.SetError(txtDeposit, "Enter Correct Money");
                status = true;
            }
            else if (validation.ValidatePassword(txtPassword.Text) == false)
            {
                txtPassword.Focus();
                errorProvider1.SetError(txtPassword, "Enter Correct Password at least 8 characters");
                status = true;
            }
            else if (mtxtPhonenumber.MaskFull == false)
            {
                mtxtPhonenumber.Focus();
                errorProvider1.SetError(mtxtPhonenumber, "Enter Correct Phone number");
                status = true;
            }
            else if (cmbAccounttype.SelectedIndex == -1)
            {
                cmbAccounttype.Focus();
                errorProvider1.SetError(cmbAccounttype, "Select an Account Type");
                status = true;
            }

            /*else if  ((validation.TextOnlyValidation(txtFirstname.Text) == false &&
             * validation.TextOnlyValidation(txtLastname.Text) == false &&
             * validation.TextOnlyValidation(txtUsername.Text) == false &&
             * mtxtPhonenumber.MaskFull == false &&
             * cmbAccounttype.SelectedIndex ==-1 &&
             * validation.ValidateDouble(txtDeposit.Text) == false &&
             * validation.ValidatePassword(txtPassword.Text) == false
             *    ))
             * {
             *    MessageBox.Show("Incorrect User Detail Try Again");
             *    status = true;
             * }*/

            else
            {
                C.Firstname    = txtFirstname.Text;
                C.Lastname     = txtLastname.Text;
                C.Othername    = txtOthername.Text;
                C.DateRegister = Convert.ToDateTime(dtpdate.Text);
                C.Balance      = Convert.ToDecimal(txtDeposit.Text);
                C.AccountType  = cmbAccounttype.Text;
                C.Phone        = mtxtPhonenumber.Text;
                C.Username     = txtUsername.Text;
                C.Password     = txtPassword.Text;
            }

            if (C.CustomerNo == null && status == false)
            {
                AddUpdateCustomer.AddCustomerDetail(C);
                MessageBox.Show("Registration Succesful");
                var login = new CustomerLogin();
                this.Close();
                login.Visible = true;
            }
            else if (C.CustomerNo != null && status == false)
            {
                AddUpdateCustomer.EditCustomerDetail(C);
                MessageBox.Show("Update Succesful");
                var dashboard = new CustomerDashboard(C);
                this.Close();
                dashboard.Visible = true;
            }
        }