Skip to content

๐Ÿ‹๏ธโ€โ™‚๏ธ A console-based application Gym Management System built with C#, Entity Framework Core, and QuestPDF for managing Members, Trainers, Subscriptions, Attendance, and Payments with automated checks and exportable reports.

License

Notifications You must be signed in to change notification settings

Kenzy-Ragab/Gym-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‹๏ธโ€โ™‚๏ธ GYM Management System

๐Ÿ“– Description

The GYM Management System is a complete console-based application written in C# with Entity Framework Core and QuestPDF integration, it manages Members, Trainers, Subscriptions, Attendance, and Payments with rich set of Reports that can be exported to PDF. The system is designed with clean separations of concerns:

  • Models define domain entities and relationships.
  • Services encapsulate business logic and data access.
  • Screens (UI) handle all user interactions in the console.
  • Helpers simplify input, validation, and formatting

This project simulates a real-world gym system with CRUD operations, event-driven notification, automated subscription checking with timers, and comprehensive reporting.


โœจ Features

  • ๐Ÿ‘ค Manage Members (Add, View, Update, Delete, Assign Trainer, Find By Id/Phone)
  • ๐Ÿง‘โ€๐Ÿซ Manage Trainers (Add, View, Update)
  • ๐Ÿ“… Manage Subscriptions (Add, View, Update, Delete, Auto Renew)
  • ๐Ÿ’ฐ Manage Payments linked to subscriptions
  • ๐Ÿ“ Track Attendance with prevention of duplicate entries per day
  • ๐Ÿ“Š Generate rich Reports:
    • Members whose subscriptions are about to expire
    • Members list by trainer
    • Revenue by month with breakdown (Standard, Premium, VIP)
    • Most active members By Attendance
  • ๐Ÿ“‚ Export reports to PDF using QuestPDF
  • ๐Ÿ”” Event-driven Notification for:
    • Subscription Added
    • Subscription Ending
    • Subscription About To Expire
    • Attendance Recorded
  • ๐Ÿ’ป Clean and structured Console Menus with proper formatting

๐Ÿ“‚ Project Structure

/ GYM_System
โ”‚
โ”œโ”€ Program.cs                # Entry point -> loads MainMenuScreen
โ”‚
โ”œโ”€ Data/
โ”‚ โ””โ”€ AppDbContext.cs         # EF Core DbContext (DbSets for all Models)
โ”‚
โ”œโ”€ Models/                   # Domain models
โ”‚ โ”œโ”€ PersonModel.cs          # Base class for Member & Trainer
โ”‚ โ”œโ”€ MemberModel.cs          # Member entity with subscriptions & attendance
โ”‚ โ”œโ”€ TrainerModel.cs         # Trainer entity with salary & specialization
โ”‚ โ”œโ”€ SpecializationModel.cs  # Specialization linked to Trainer
โ”‚ โ”œโ”€ SubscriptionModel.cs    # Subscription entity with ServiceLevel & PlanType
โ”‚ โ”œโ”€ AttendanceModel.cs      # Attendance tracking for members
โ”‚ โ”œโ”€ AttendanceReportModel.cs# Report model for attendance count
โ”‚ โ”œโ”€ PaymentModel.cs         # Payment linked to subscription
โ”‚ โ”œโ”€ AddressModel.cs         # Owned type inside Member (City, Region, Street...)
โ”‚ โ””โ”€ Enums.cs                # enServiceLevel, enPlanType, enStatus, enPaymentType
โ”‚
โ”œโ”€ Services/                 # Business logic & data access
โ”‚ โ”œโ”€ BaseService.cs          # Generic CRUD + GetById/GetAllLazy
โ”‚ โ”œโ”€ MemberService.cs        # Members + Delete with cascade + IsAttendanceBefore
โ”‚ โ”œโ”€ TrainerService.cs       # Trainers CRUD
โ”‚ โ”œโ”€ SubscriptionService.cs  # Subscriptions CRUD + OnSubscriptionAdded event
โ”‚ โ”œโ”€ SubscriptionChecker.cs  # Timer-based subscription expiry check + events
โ”‚ โ”œโ”€ AttendanceService.cs    # Attendance CRUD + OnAttendanceRecorded event
โ”‚ โ”œโ”€ PaymentsService.cs      # Payments CRUD
โ”‚ โ”œโ”€ ReportService.cs        # Queries for reports
โ”‚ โ””โ”€ GymPricingService.cs    # Static price calculator by ServiceLevel & PlanType
โ”‚
โ”œโ”€ Screens/                  # Console UI
โ”‚ โ”œโ”€ MainMenuScreen.cs       # Main entry menu
โ”‚ โ”‚
โ”‚ โ”œโ”€ Member/
โ”‚ โ”‚ โ”œโ”€ MembersManagementMenu.cs
โ”‚ โ”‚ โ”œโ”€ AddMemberScreen.cs
โ”‚ โ”‚ โ”œโ”€ ViewMemberScreen.cs
โ”‚ โ”‚ โ”œโ”€ UpdateMemberScreen.cs
โ”‚ โ”‚ โ”œโ”€ DeleteMemberScreen.cs
โ”‚ โ”‚ โ”œโ”€ FindMemberScreen.cs (Find by Id/Phone)
โ”‚ โ”‚ โ”œโ”€ AssignTrainerToMemberScreen.cs
โ”‚ โ”‚ โ”œโ”€ Attendance/
โ”‚ โ”‚ โ”‚ โ”œโ”€ AttendanceManagementMenu.cs
โ”‚ โ”‚ โ”‚ โ”œโ”€ RecordAttendanceScreen.cs
โ”‚ โ”‚ โ”‚ โ””โ”€ ViewAttendanceScreen.cs
โ”‚ โ”‚ โ””โ”€ Subscription/
โ”‚ โ”‚   โ”œโ”€ SubscriptionsManagementMenu.cs
โ”‚ โ”‚   โ”œโ”€ AddSubscriptionScreen.cs
โ”‚ โ”‚   โ”œโ”€ ViewSubscriptionsScreen.cs
โ”‚ โ”‚   โ”œโ”€ UpdateSubscriptionScreen.cs
โ”‚ โ”‚   โ”œโ”€ DeleteSubscriptionScreen.cs
โ”‚ โ”‚   โ””โ”€ Payments/
โ”‚ โ”‚     โ”œโ”€ AddPaymentsScreen.cs
โ”‚ โ”‚     โ”œโ”€ ViewPaymentsScreen.cs
โ”‚ โ”‚     โ””โ”€ UpdatePaymentsScreen.cs
โ”‚ โ”‚
โ”‚ โ”œโ”€ Trainer/
โ”‚ โ”‚ โ”œโ”€ TrainersManagementMenu.cs
โ”‚ โ”‚ โ”œโ”€ AddTrainerScreen.cs
โ”‚ โ”‚ โ”œโ”€ ViewTrainersScreen.cs
โ”‚ โ”‚ โ””โ”€ UpdateTrainerScreen.cs
โ”‚ โ”‚
โ”‚ โ””โ”€ Reports/
โ”‚   โ”œโ”€ ReportMenuScreen.cs
โ”‚   โ”œโ”€ ConsoleUI/
โ”‚   โ”‚ โ”œโ”€ ReportConsoleRenderers.cs
โ”‚   โ”‚ โ””โ”€ ReportConsoleTitle.cs
โ”‚   โ”œโ”€ Core/
โ”‚   โ”‚ โ”œโ”€ ReportsCatalog.cs
โ”‚   โ”‚ โ””โ”€ ReportDifinationModel.cs
โ”‚   โ””โ”€ PDF/
โ”‚     โ”œโ”€ ReportPdfGenerator.cs
โ”‚     โ””โ”€ ReportPdfRenderers.cs
โ”‚
โ”œโ”€ Helper/
โ”‚ โ”œโ”€ CheckHelper.cs
โ”‚ โ”œโ”€ InputHelper.cs
โ”‚ โ”œโ”€ ConsoleUIHelper.cs
โ”‚ โ”œโ”€ NotificationHelper.cs
โ”‚ โ”œโ”€ PersonInputHelper.cs
โ”‚ โ”œโ”€ PersonDisplayHelper.cs
โ”‚ โ”œโ”€ MemberInputHelper.cs
โ”‚ โ”œโ”€ TrainerInputHelper.cs
โ”‚ โ”œโ”€ SubscriptionInputHelper.cs
โ”‚ โ””โ”€ PaymentInputHelper.cs
โ”‚
โ”œโ”€ Exceptions/               # Custom exceptions
โ”‚
โ”œโ”€ Migrations/               # EF Core Migrations (InitialCreate + Snapshot)
โ”‚
โ””โ”€ README.md

๐Ÿ”— Models & Relationships

  • Member โ†” Trainer โ†’ Many Members per Trainer
  • Member โ†” Subscription โ†’ One Member, Many Subscriptions
  • Member โ†” Attendance โ†’ One Member, Many Attendance Records
  • Subscription โ†” Payment โ†’ One-to-One (each subscription has one payment)
  • Trainer โ†” Specialization โ†’ One-to-One
Trainer 1 โ”€โ”€ * Member 1 โ”€โ”€ * Subscription 1 โ”€โ”€ 1 Payment
                      โ”‚
                      โ””โ”€โ”€ * Attendance

๐Ÿงพ Properties of Models

๐Ÿ‘ค MemberModel

  • Id, FullName, Phone, Email
  • DateOfBirth
  • Address (City, Region, Street, Building)
  • TrainerId, Trainer
  • ICollection
  • ICollection

๐Ÿง‘โ€๐Ÿซ TrainerModel

  • Id, FullName, Phone, Email
  • Salary
  • Specialization
  • ICollection

๐Ÿ“˜ SubscriptionModel

  • Id
  • cDateSubscription (StartDate, EndDate)
  • ServiceLevel (Standard, Premium, VIP)
  • PlanType (Monthly, Yearly)
  • Price
  • Status (Active, Inactive)
  • IsAutoRenew
  • MemberId, Member
  • Payment

๐Ÿ’ฐ PaymentModel

  • Id
  • Date
  • PaymentType (Cash, Card)
  • Amount
  • SubscriptionId, Subscription

๐Ÿ“ AttendanceModel

  • Id
  • Date
  • MemberId, Member

๐Ÿท SpecializationModel

  • Id
  • Name
  • TrainerId, Trainer

๐Ÿ  AddressModel (Owned by Member)

  • City, Region, Street, Building

๐Ÿ“Š AttendanceReportModel

  • MemberName
  • AttendanceCount

๐Ÿ›  Services Overview

  • BaseService โ†’ Generic CRUD operations
  • MemberService โ†’ Delete with cascade (Attendance + Subscriptions), check duplicate attendance
  • TrainerService โ†’ Manage trainers
  • SubscriptionService โ†’ Add/Delete subscriptions, fire OnSubscriptionAdded event
  • SubscriptionChecker โ†’ Timer-based checker for expiring subscriptions (fires OnSubscriptionEnd & OnSubscriptionAboutToExpire)
  • AttendanceService โ†’ Add attendance, fire OnAttendanceRecorded event
  • PaymentsService โ†’ Manage subscription payments
  • ReportService โ†’ Build datasets for reports (expiring, by trainer, revenue, attendance)
  • GymPricingService โ†’ Calculate price by ServiceLevel & PlanType

๐Ÿ–ฅ Console Flow

Main Menu
โ”œโ”€ Manage Members
โ”‚ โ”œโ”€ Add / View / Update / Delete
โ”‚ โ”œโ”€ Assign Trainer
โ”‚ โ”œโ”€ Find by Id/Phone
โ”‚ โ””โ”€ Manage Attendance
โ”‚   โ”œโ”€ Record Attendance
โ”‚   โ””โ”€ View Attendance
โ”‚ โ””โ”€ Manage Subscriptions
โ”‚   โ”œโ”€ Add / View / Update / Delete
โ”‚   โ””โ”€ Manage Payments (Add/View/Update)
โ”‚
โ”œโ”€ Manage Trainers (Add / View / Update)
โ”œโ”€ Reports (4 types with Console + PDF)
โ””โ”€ Exit

๐Ÿš€ Quick Start

# 1. Clone the repository
git clone https://github.com/Kenzy-Ragab/Gym-Management-System
cd Gym-Management-System

# 2. Apply EF migrations
dotnet ef database update

# 3. Build & run the project
dotnet run

# 4. Navigate the console menus ๐ŸŽ› and explore features

๐Ÿงฐ Tech Stack

  • C# .NET 8
  • Entity Framework Core 9
  • QuestPDF (report PDF generation)
  • SQL Server (EF migrations)
  • Console Application

๐Ÿ‘€ Preview

Example: of Console Menu

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                MAIN MENU                 โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘[1] Manage Members                        โ•‘
โ•‘[2] Manage Attendance                     โ•‘
โ•‘[3] Manage Subscriptions                  โ•‘
โ•‘[4] Manage Trainers                       โ•‘
โ•‘[5] Reports                               โ•‘
โ•‘[6] Exit                                  โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ“„ Sample

Example: View Trainers Screen

โ”Œโ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚IDโ”‚ Full Name        โ”‚ Phone          โ”‚ Email                 โ”‚ Salary   โ”‚ Specialization   โ”‚
โ”œโ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1โ”‚ Malak Ahmed      โ”‚ 0123456789     โ”‚ [email protected]  โ”‚ 8000     โ”‚ Cardio           โ”‚
โ””โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“Š Sample of Report

Example: Revenue in Specific Month (Console)

==========================================
           REVENUE โ€“ MONTH September
==========================================
 Service Level        |          Revenue
------------------------------------------
 Standard             |        $1,500.00
 Premium              |        $3,200.00
 VIP                  |        $5,000.00
------------------------------------------

Generated also as PDF:

Revenue_Month_5.pdf

๐Ÿงช Example

Add Subscription Flow:

  1. Select Add Subscription
  2. Choose member
  3. Enter start date
  4. Choose service level & plan type
  5. System auto-calculates end date, price, and status
  6. Subscription saved & OnSubscriptionAdded event triggered

๐Ÿ“š What I Learned

  • Structuring large console applications with clear separation of concerns
  • Using Entity Framework Core for data persistence & relationships
  • Handling events in C# (delegates for subscription/attendance notifications)
  • Implementing timers for background checks (subscription expiry)
  • Generating professional PDF reports with QuestPDF
  • Designing clean console UI with formatted tables

๐Ÿ”ฎ Future Enhancement

  • ๐ŸŒ Add GUI (WinForms/WPF/Blazor)
  • ๐Ÿ›ก Add Authentication & Roles (Admin, Trainer, Member)
  • โ˜๏ธ Host with real SQL Server / Cloud DB
  • ๐Ÿ“ฑ Mobile app integration
  • ๐Ÿ“ˆ Advanced analytics (attendance trends, revenue forecast)
  • ๐Ÿ”” Email/SMS notifications instead of console only

๐Ÿค Task Requirement in Breakin Point (Student Activity)

๐Ÿ“Ž Task Requirement (Google Drive)

Made with โค๏ธ by Kenzy Ragab

Feel free to fork, use, or contribute to this project!

About

๐Ÿ‹๏ธโ€โ™‚๏ธ A console-based application Gym Management System built with C#, Entity Framework Core, and QuestPDF for managing Members, Trainers, Subscriptions, Attendance, and Payments with automated checks and exportable reports.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages