Sunuer

Sunuer Manage Sunuer Easy Peripheral
Project Introduction

Project Structure


SunuerManage ├─ appsettings.json # Application configuration file, includes DB connection string and other settings ├─ bin # Compiled binary files directory │ ├─ Debug # Build output for Debug mode │ └─ Release # Build output for Release mode ├─ Code # Business logic and data access layer code │ ├─ Admin # Business logic for administrators │ │ ├─ AdminDal.cs # Data access layer for administrators │ │ ├─ AdminModel.cs # Data model for administrators │ │ ├─ AdminPowerDal.cs # Data access layer for administrator permissions │ │ ├─ AdminPowerModel.cs # Data model for administrator permissions │ │ ├─ AdminRolesDal.cs # Data access layer for administrator roles │ │ └─ AdminRolesModel.cs # Data model for administrator roles │ ├─ Articles # Business logic for articles │ │ ├─ ArticleCategoryDal.cs # Data access layer for article categories │ │ ├─ ArticleCategoryModel.cs # Data model for article categories │ │ ├─ ArticlesDal.cs # Data access layer for articles │ │ └─ ArticlesModel.cs # Data model for articles │ └─ ManageSet # Business logic for management settings │ └─ ManageSetModel.cs # Data model for management settings ├─ Controllers # Controllers (API) that handle HTTP requests │ ├─ Admin # Controllers related to administrators │ │ ├─ AdminController.cs # Administrator controller │ │ ├─ AdminPowerController.cs # Administrator permissions controller │ │ └─ AdminRolesController.cs # Administrator roles controller │ ├─ Articless # Controllers related to articles │ │ ├─ ArticleCategoryController.cs # Article category controller │ │ └─ ArticlesController.cs # Articles controller │ ├─ Files # Controllers related to file operations │ │ ├─ CaptchaController.cs # CAPTCHA controller │ │ ├─ FilesController.cs # File upload controller │ │ └─ QRCodeController.cs # QR code generation controller │ └─ ManageSets # Controllers for management settings │ └─ ManageSetController.cs # Management settings controller ├─ Data # Data access layer and database context │ ├─ ApplicationDbContext.cs # Database context for interacting with the DB │ └─ SunuerManage.sql # Database script file (backup/restore) ├─ Pages # Razor pages for frontend display │ ├─ About.cshtml # "About Us" page │ ├─ Cases.cshtml # Case studies page │ ├─ Contact.cshtml # Contact page │ ├─ Error.cshtml # Error page │ ├─ Index.cshtml # Homepage │ ├─ News.cshtml # News page │ ├─ newsview.cshtml # News detail page │ ├─ Manage # Admin backend pages │ │ ├─ Admins # Administrator management pages │ │ │ ├─ AdminAdd.cshtml # Page to add a new administrator │ │ │ ├─ AdminEdt.cshtml # Page to edit an administrator │ │ │ ├─ AdminList.cshtml # Administrator list page │ │ │ ├─ AdminPassWord.cshtml # Change administrator password page │ │ │ ├─ AdminPowerAdd.cshtml # Page to add administrator permissions │ │ │ ├─ AdminPowerEdt.cshtml # Page to edit administrator permissions │ │ │ ├─ AdminPowerList.cshtml # Administrator permissions list │ │ │ ├─ AdminRolesAdd.cshtml # Page to add administrator roles │ │ │ ├─ AdminRolesEdt.cshtml # Page to edit administrator roles │ │ │ ├─ AdminRolesList.cshtml # Administrator roles list │ │ │ ├─ Adminview.cshtml # Administrator detail page │ │ ├─ admin_index.cshtml # Admin backend home page │ │ ├─ Agreement.cshtml # User agreement page │ │ ├─ Articless # Article management pages │ │ │ ├─ ArticleCategoryAdd.cshtml # Add article category page │ │ │ ├─ ArticleCategoryEdt.cshtml # Edit article category page │ │ │ ├─ ArticleCategoryList.cshtml # Article category list page │ │ │ ├─ ArticlesAdd.cshtml # Add article page │ │ │ ├─ ArticlesEdt.cshtml # Edit article page │ │ │ ├─ ArticlesList.cshtml # Article list page │ │ ├─ consoles # Console pages │ │ │ ├─ console.cshtml # Console page │ │ ├─ Login.cshtml # Login page │ │ ├─ LoginOut.cshtml # Logout page │ │ └─ ManageSets # Management settings pages │ │ ├─ ManageSetEdt.cshtml # Edit management settings page │ ├─ Shared # Shared views and layouts │ │ ├─ Menu.cshtml # Menu view │ │ ├─ _indexLayout.cshtml # Layout for the homepage │ │ ├─ _Layout.cshtml # Default layout │ │ ├─ _ManageIndexLayout.cshtml # Layout for admin backend │ │ └─ _ValidationScriptsPartial.cshtml # Partial view for validation scripts │ ├─ _ViewImports.cshtml # View import file, used to include namespaces │ └─ _ViewStart.cshtml # View start file, sets the layout ├─ Tools # Utility classes │ ├─ ApiResponse.cs # API response utility class - unified API return format │ ├─ CBC.cs # Encryption/decryption utility │ ├─ ConfigurationHelper.cs # Retrieves values from appsettings.json │ ├─ DataTableToList.cs # Utility for converting DataTable to list │ ├─ DBHelper.cs # Database helper class │ ├─ JsEncryptHelper.cs # JS encryption helper class │ └─ Tools.cs # General utility class ├─ wwwroot # Static resources │ ├─ css # CSS files │ ├─ favicon.ico # Site icon │ ├─ images # Image resources │ ├─ js # JavaScript files │ └─ Uploadfile # Directory for uploaded files ├─ Program.cs # Application entry point ├─ Properties # Project property files │ ├─ launchSettings.json # Launch configuration file │ └─ PublishProfiles # Publish configuration files │ ├─ FolderProfile.pubxml # Folder publish profile │ └─ FolderProfile.pubxml.user # User-specific folder publish profile ├─ Sunuer Manage Disclaimer (Read Carefully).txt # Project disclaimer
├─ SunuerManage.csproj # Project file, includes configuration and dependencies ├─ SunuerManage.csproj.user # User-specific project configuration ├─ SunuerManage.sln # Solution file, contains project structure and configuration



Configuration file launchSettings.json



{ "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:32430", //http://localhost:32430,Indicates that the application will be accessed through this address. "sslPort": 0 } }, "profiles": { "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:5021", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" //Development: Development environment. Staging: Pre-release (staging) environment. Production: Production environment } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }


Configuration file appsettings.json

"ConnectionStrings": {
  "DefaultConnection": "Server=nhdSQLEXPRESS;Database=SunuerManage;User Id=sa;Password=123456;MultipleActiveResultSets=true;TrustServerCertificate=True;Max Pool Size=100;Min Pool Size=5;Pooling=true;"
},

Server=nhd/SQLEXPRESS: Specifies the database server and instance name to connect to.

Database=SunuerManage: Specifies the default database name to connect to.

User Id=sa; Password=123456: Provides the credentials (username and password) needed to log in to SQL Server.

MultipleActiveResultSets=true: Allows multiple data-reading operations to occur simultaneously within the same database connection (session). For instance, one query can read data while another query is also running in parallel. This setting is especially important when using Entity Framework; if you need to iterate over data and perform other operations in a single connection, you must set this to true.

TrustServerCertificate=True: Determines whether to trust the server certificate when using TLS/SSL encryption to connect to SQL Server. With True, even if the certificate is not signed by a trusted CA or has other validation issues, it will still be trusted and establish the encrypted connection. Security note: In a production environment using self-signed or otherwise untrusted certificates, this option allows continued connections but can pose a security risk. Configure it carefully based on your needs.

Max Pool Size=100; Min Pool Size=5; Pooling=true: Controls the database connection pool behavior.

Pooling=true: Enables connection pooling, improving performance when the application frequently accesses the database and reducing the overhead of repeatedly opening/closing connections.

Max Pool Size=100: The maximum number of idle connections to keep in the pool. If this limit is exceeded, new connection requests must wait until a connection is freed or, depending on your configuration, an exception is thrown.

Min Pool Size=5: The minimum number of idle connections to retain in the pool. When the application first connects to the database, it initializes and keeps 5 connections on standby for quicker handling of subsequent requests.