How 3adrot-shot/crm-system-server works
Main Components
• UI Layer: This is composed of the WPF XAML files like MainWindow.xaml, WindowMain.xaml, Page1.xaml, and the UserControls (Main_UC.xaml). They form the graphical interface that displays the log report of sent/received messages, response times, sender addresses, and contents.
• Backend/Logic Layer: Managed in the “Back” folder, this includes:
• Socket_Controller.cs: Handles the TCP communications (listening on port 8081).
• ProcessingMessage.cs: Processes and routes inbound messages.
• PostgresSQL_Controller.cs: Manages connectivity with the PostgreSQL 14 database.
• Configuration & Project Setup: Files like App.config in the project (which may contain settings such as TCP port and database configuration) along with the .sln and .csproj files.
• Auxiliary Components: Threads and data processing outlines and possibly additional utility functions hidden in the code (like logging and settings management).
Relationships and Interactions
• The UI layer interacts with the backend via data binding and service calls – for example, displaying the report data updated in real time as messages are processed.
• The TCP Server component (Socket_Controller) continuously listens on the global TCP port (default port 8081). When a message arrives, it hands off the message to ProcessingMessage.
• ProcessingMessage handles the business logic and may call the PostgresSQL_Controller to record or query data against the local (or potentially remote) PostgreSQL database.
• The response (or log/status update) is then propagated back to the UI for visualization.
Architectural Patterns and Design Principles
• Separation of Concerns: The division of UI and backend logic is clearly established (WPF UI versus TCP/database handling).
• Multi-threading: The README mentions that the core functions of the server run on a separate thread, so indicate that the server’s listening and processing operations are decoupled from the UI thread.
• Client-Server Interaction: Even though this is an internal system, highlighting the request-response model (for TCP communication) is key.
Technologies and Frameworks
• WPF (Windows Presentation Foundation) for the UI.
• .NET (as indicated by the .sln and .csproj files).
• PostgreSQL for data persistence.
• TCP/IP networking fundamentals implemented in the backend.