Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏦 BankApp

A full-featured, multi-branch bank management system

Built with Avalonia UI (.NET) on the front end and MySQL on the back end — every piece of business logic (approvals, balance checks, interest calculation, transfers) lives in stored procedures, not in ORM magic.

.NET Avalonia UI MySQL License


📖 Table of Contents


🧭 Overview

BankApp simulates the internal system a real bank would use to run its day-to-day operations across multiple branches — onboarding customers, opening accounts, processing deposits/withdrawals/transfers, issuing and repaying loans, managing staff, and keeping a full audit trail of who did what and when.

It was built as a database management course project, but grew well past a typical CRUD assignment: it models a realistic loan approval pipeline, branch-scoped access control, automatic interest-bearing installment scheduling, and a two-layer activity/audit logging system — all backed by 95 stored procedures and zero ORM.


✨ Features

👤 Customer & Account Management

  • Full CRUD on customer records with search
  • Multiple account types (Savings, Checking, Fixed Deposit, Business), each with its own interest rate
  • Open / edit / close accounts, with a hard rule: an account can't be closed unless its balance is zero

💸 Transactions

  • Deposits, withdrawals, and transfers between any two accounts
  • Every transaction is recorded with a before/after balance snapshot, never just the delta
  • Transfers lock both accounts (in a consistent order) to stay safe under concurrent access and avoid deadlocks

💰 Loans & Installments

  • Loan request → approval workflow: a Branch Manager-created loan goes active immediately; an Employee-created loan starts Pending and needs manager sign-off
  • Automatic installment schedule generation (flat interest, evenly split, last installment absorbs rounding)
  • Pay the next installment, pay N installments, or pay off the whole loan — from any of the customer's accounts
  • A loan auto-closes once its last installment is paid

🏢 Branches & Staff

  • Bank Manager can manage every branch; Branch Managers are scoped to their own
  • Hiring an employee automatically provisions their login (with a default password) and assigns the Employee role
  • Deactivate / reactivate employees without deleting history

🔐 Roles & Access Control

  • Three roles — Bank Manager, Branch Manager, Employee — each seeing a different slice of the data, enforced both in the UI and inside the stored procedures themselves
  • Users & Roles admin page for managing logins, resetting passwords, and toggling active status

🕵️ Activity Log & Audit Trail

  • Every significant action (create, update, delete, approve, login…) is logged with who / what / when
  • Sensitive fields (salary, credentials, contact info) get a field-level before/after diff, linked back to the log entry that caused them

🎛️ Quality-of-life

  • Global command palette (⌘K-style) for jumping to any page or action instantly
  • Live dashboard with bank-wide and branch-level KPIs
  • Toast notifications, confirmation dialogs, and a polished dark UI throughout

🏗️ Architecture

BankApp is a 2-project solution following clean separation between UI and core logic:

┌─────────────────────────────────────────────────────────┐
│                      BankApp.UI                          │
│   Avalonia · MVVM · CommunityToolkit.Mvvm                │
│   Views ←→ ViewModels ←→ (DI) ←→ Repositories             │
└───────────────────────────┬───────────────────────────────┘
                             │
┌────────────────────────────▼──────────────────────────────┐
│                     BankApp.Core                          │
│   Repositories · Models · Security (BCrypt)                │
│   MySqlConnector — parameterized calls only, no ORM         │
└───────────────────────────┬───────────────────────────────┘
                             │
┌────────────────────────────▼──────────────────────────────┐
│                         MySQL                              │
│   14 tables · 95 stored procedures                          │
│   All business rules enforced here — balance checks,        │
│   approval gating, uniqueness, transactional integrity      │
└─────────────────────────────────────────────────────────────┘

Key architectural decisions:

  • MVVM throughout, powered by CommunityToolkit.Mvvm's source generators ([ObservableProperty], [RelayCommand]) — no hand-written boilerplate.
  • Constructor-based dependency injection via Microsoft.Extensions.DependencyInjection. Every repository and page-level ViewModel is resolved through the container (ServiceCollectionExtensions.cs), configured once at startup in App.axaml.cs.
  • No ORM. Every single database call goes through a stored procedure, invoked with typed MySqlParameter objects — this was a hard project requirement, and it also means the SQL layer can be reasoned about, tested, and secured independently of the application code.
  • Repository pattern — one repository per aggregate (AccountRepository, LoanRepository, EmployeeRepository, …), each responsible for mapping stored procedure result sets onto plain C# models.
  • Role-scoping lives in SQL, not just in the UI. A Branch Manager's queries are scoped inside the stored procedure itself (by resolving their branch from their employee ID), not merely hidden by the client — so the access boundary holds even if a procedure is called directly.

🛠️ Tech Stack

Layer Technology
UI Framework Avalonia UI 12.0 (cross-platform, XAML-based)
Pattern MVVM via CommunityToolkit.Mvvm 8.4
Dependency Injection Microsoft.Extensions.DependencyInjection
Language / Runtime C# / .NET 10
Database MySQL 8.0 (InnoDB, utf8mb4)
Data Access MySqlConnector 2.6 — raw parameterized ADO.NET-style calls, no ORM
Password Hashing BCrypt.Net-Next (salted, adaptive, work factor 12)
Fonts Lato, Roboto, Phosphor Icons

🗃️ Database Design

The schema is fully normalized to 3NF, with one deliberate exception documented below.

Entity-Relationship Diagram

14 tables, grouped by area:

  • Core banking: customers, branch, employee, account_type, account, transaction_type, transaction, loan, installment
  • Security: role, system_user, user_role
  • Auditing: activity_log, audit_trail

A single deliberate denormalization: transaction.BalanceBefore / transaction.BalanceAfter are stored explicitly rather than derived, because a bank ledger must preserve the balance as it was at the moment of the transaction as an immutable historical fact — not a value that could shift if earlier rows were ever touched.

Full documentation — ER diagram, relational schema, normalization report, and annotated SQL examples — is in Reports/BankManagement_DOC.pdf.


🔐 Security

  • Authentication — username/password login; passwords are hashed with BCrypt and never stored or compared as plaintext.
  • Authorization — three roles (BankManager, BranchManager, Employee) stored relationally, not as a hardcoded flag. Sensitive stored procedures (e.g. loan approval) re-validate the caller's role server-side.
  • SQL injection prevention — every database call in the app is a parameterized stored procedure call; user input is never concatenated into SQL, anywhere, by construction of the data-access layer.
  • Auditability — the activity log + audit trail combination means every sensitive change (who changed an employee's salary, when, from what to what) is reconstructable after the fact.

🚀 Getting Started

Prerequisites

  • .NET 10 SDK
  • MySQL Server 8.0+
  • A MySQL client (MySQL Workbench, DBeaver, or the mysql CLI) to run the schema script

1. Clone the repository

git clone https://github.com/<your-username>/BankApp.git
cd BankApp

2. Set up the database

Create the database and load the schema (tables, seed data, and all 95 stored procedures) from the provided dump:

mysql -u root -p -e "CREATE DATABASE bankmanagement_db;"
mysql -u root -p bankmanagement_db < Database/BankManagement.sql

3. Configure your connection string

Open BankApp.Core/Data/DbConfig.cs and fill in your local MySQL credentials:

private const string Host = "localhost";
private const string Port = "3306";
private const string Database = "bankmanagement_db";
private const string Username = "root";
private const string Password = "<your-password-here>";

⚠️ Note: credentials are hardcoded here for simplicity, which is fine for local development but should never be committed with real values to a public repo. If you fork this project, consider moving these into an appsettings.json read via Microsoft.Extensions.Configuration, or environment variables, before pushing.

4. Run it

dotnet restore
dotnet run --project BankApp.UI

The app will open on the login screen. See seed accounts below for what's pre-loaded in the sample data, or create your own via the database directly.


🧑‍💼 Role-Based Access at a Glance

Bank Manager Branch Manager Employee
View own branch's customers/accounts/loans
View all branches
Create / edit / delete branches
Hire employees ✅ (any branch) ✅ (own branch only)
Approve / reject loan requests ✅ (own branch)
Loans they create go active immediately ❌ (needs approval)
Manage system users & roles
View activity log ✅ (all) ✅ (own branch)

📁 Project Structure

BankApp/
├── BankApp.Core/                # Domain layer — no UI dependencies
│   ├── Data/                    # DbConfig, DatabaseService (thin ADO.NET wrapper)
│   ├── Models/                  # Plain C# models mapped from stored procedure results
│   ├── Repositories/            # One repository per aggregate (11 total)
│   └── Security/                # PasswordHasher (BCrypt wrapper)
│
├── BankApp.UI/                  # Avalonia MVVM application
│   ├── Views/                   # 26 XAML views (pages + dialogs)
│   ├── ViewModels/               # One ViewModel per view, DI-constructed
│   ├── Services/                 # NavigationService, DialogService, SessionService, ...
│   ├── Converters/                # XAML value converters
│   ├── Styles/                    # Shared Fluent-theme overrides
│   └── ServiceCollectionExtensions.cs   # DI container registration
│
├── Database/
│   └── BankManagement.sql       # Full schema + seed data + all stored procedures
│
└── Reports/
    ├── BankManagement_DOC.pdf   # Full design document (ER, schema, normalization, SQL)
    ├── BankManagement_ER.jpg    # ER diagram
    └── bankmanagement_db.png    # Schema diagram

📚 Documentation

The full project write-up — requirements analysis, ER diagram, relational schema, normalization report (up to 3NF), and annotated SQL examples for constraint enforcement, transactional integrity, and role-scoped queries — is available in Reports/BankManagement_DOC.pdf.


📸 Screenshots

Login Dashboard
Customers Transactions
ActivityLog Profile

🗺️ Roadmap

Ideas that didn't make it into this version but would be natural next steps:

  • Toggle Dark / Light theme
  • Database backup/restore from within the app
  • Encryption at rest for national ID numbers
  • Full amortized (rather than flat) interest calculation for loans
  • Exportable PDF statements per account
  • Two-factor authentication

👥 Contributors


📄 License

This project was built for educational purposes as part of a Database Management Systems course.

About

Multi-branch bank management system built with Avalonia UI and MySQL — loan approvals, branch-scoped roles, and a full audit trail, all backed by 95 stored procedures.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages