✅ DETAILED PROMPT FOR CREATING A DINER POS SYSTEM IN WPF (.
NET C#)
_Last updated: with order-saving logic, billing table, receipts, multi-language
support, and settings screen._
🎯 OBJECTIVE
Build a full-featured POS system for a diner using WPF (.NET C#) and SQL Server.
The system should support dine-in (with table structure), takeaway, and delivery.
It must include:
- Inventory management
- Customer loyalty (points/rewards)
- Discount handling
- Secure user roles (Admin, Supervisor, Waiter)
- Receipt generation
- Multilingual support (EN/AR)
- Configurable settings (currency, tax, etc.)
🧩 CORE FEATURES OVERVIEW
- Dine-in with table layout and table assignment
- Takeaway and Delivery order workflows
- Customer management with saved addresses
- Order confirmation saves to Orders table
- Payment confirmation saves to Bills table
- Inventory tracking and adjustments
- Loyalty and reward points
- Discount and promotional handling
- Multi-language UI support (EN/AR)
- Receipt printing or PDF export after payment
- Settings screen (currency, tax percentage, etc.)
- Role-based access control
🏗 ARCHITECTURE
- Design Pattern: MVVM or MBC
- Layers:
- Core (Entities)
- Infrastructure (EF Core Repositories)
- Application (Business Logic Services)
- UI (WPF Views)
🧾 ENTITIES TO IMPLEMENT
1. USER
| Field | Type |
|--------------|-----------|
| UserId | int (PK) |
| FullName | string |
| Username | string |
| PasswordHash | string |
| Role | enum | (Admin, Supervisor, Waiter)
| IsActive | bool |
2. CUSTOMER
| Field | Type |
|---------------|----------|
| CustomerId | int (PK) |
| Name | string |
| PhoneNumber | string |
| Email | string |
| Points | int |
| TotalSpent | decimal |
| Membership | enum | (Silver, Gold, VIP)
3. CUSTOMER_ADDRESS
| Field | Type |
|--------------|-----------|
| AddressId | int (PK) |
| CustomerId | int (FK) |
| Street | string |
| City | string |
| Notes | string |
4. TABLE
| Field | Type |
|-----------|----------|
| TableId | int (PK) |
| Number | string |
| Seats | int |
| Status | enum | (Available, Occupied)
5. CATEGORY
| Field | Type |
|------------|----------|
| CategoryId | int (PK) |
| Name | string |
6. ITEM
| Field | Type |
|------------------|----------|
| ItemId | int (PK) |
| Name | string |
| Barcode | string |
| CategoryId | int (FK) |
| UnitPrice | decimal |
| CostPrice | decimal |
| QuantityInStock | int |
| LowStockAlert | int |
| IsActive | bool |
7. SALES_ORDER
| Field | Type |
|--------------|-----------|
| OrderId | int (PK) |
| CustomerId | int (FK) |
| UserId | int (FK) |
| OrderType | enum | (DineIn, Takeaway, Delivery)
| TableId | int (FK) |
| AddressId | int (FK) |
| OrderDate | datetime |
| TotalAmount | decimal |
| Discount | decimal |
| FinalAmount | decimal |
| PaymentMethod| string |
8. SALES_ORDER_ITEM
| Field | Type |
|--------------|----------|
| OrderItemId | int (PK) |
| OrderId | int (FK) |
| ItemId | int (FK) |
| Quantity | int |
| UnitPrice | decimal |
| TotalPrice | decimal |
9. DISCOUNT
| Field | Type |
|----------------|-----------|
| DiscountId | int (PK) |
| Type | enum | (Fixed, Percentage)
| Value | decimal |
| MinimumPurchase| decimal |
| StartDate | datetime |
| EndDate | datetime |
| IsActive | bool |
10. INVENTORY_LOG
| Field | Type |
|----------------|----------|
| LogId | int (PK) |
| ItemId | int (FK) |
| QuantityChange | int |
| Reason | string |
| UserId | int (FK) |
| Date | datetime |
11. BILL
| Field | Type |
|---------------|----------|
| BillId | int (PK) |
| OrderId | int (FK) |
| PaymentDate | datetime |
| PaymentMethod | string |
| TotalPaid | decimal |
| ReceiptPath | string |
| Currency | string |
| TaxApplied | decimal |
| IsPrinted | bool |
12. SETTINGS
| Field | Type |
|---------------|----------|
| SettingId | int (PK) |
| Currency | string |
| TaxRate | decimal |
| DefaultLang | enum | (EN, AR)
| ReceiptFooter | string |
🚀 ORDER & PAYMENT FLOW
1. Start Order ➡ Select Order Type (Dine-in, Takeaway, Delivery)
2. If Delivery:
- Select or register Customer
- Add or choose Address
3. Navigate to Ordering Screen:
- Right: Item categories in rounded box cards
- Left: Live Cart (Items, Qty, Total)
- Apply Discount or Redeem Points
4. Confirm Order:
- Saves order to SalesOrder and SalesOrderItem tables
- Table assignment if Dine-in
- ✅ Order Saved in System
5. Proceed to Payment Screen:
- Select payment method (Cash, Card, etc.)
- Enter received amount
- Final confirmation ➡ Save to Bill table
- Generate and save receipt (PDF)
- Option to print receipt
- ✅ Bill Saved in System
🖼 UI DESIGN HIGHLIGHTS
- EN/AR language toggle in top-right
- Rounded item cards with image and price
- Left Cart panel
- Bottom totals: Subtotal, Tax, Discount, Total
- Receipt preview modal with print/export
- Settings screen:
- Currency selection
- Tax rate input
- Receipt footer editor
- Language preference
🛡 USER ROLE PERMISSIONS
| Feature | Admin | Supervisor | Waiter |
|----------------------------|-------|------------|--------|
| User Management | ✅ | ❌ | ❌ |
| Discounts & Settings | ✅ | ✅ | ❌ |
| Inventory Control | ✅ | ✅ | ❌ |
| Create/View Orders | ✅ | ✅ | ✅ |
| Process Payments | ✅ | ✅ | ✅ |
| View Reports | ✅ | ✅ | ❌ |
| Print/Export Receipts | ✅ | ✅ | ✅ |
📊 REPORTING FEATURES
- Sales summary by day/week/month
- Low stock inventory alerts
- Top spending customers and loyalty tiers
- Most/least sold items
- PDF export of reports