Naming conventions
Damsy ERP inherits naming from years of incremental development. Some spellings look like typos but are fixed contracts in routes, session keys, and SQL. New code should follow existing patterns unless a deliberate migration is planned.
Introduction
Consistency reduces broken links, failed publishes, and session bugs. This page documents observed conventions in Areas, C# session keys, stored procedures, and known legacy identifiers — not aspirational style guides.
Purpose
Prevent accidental "fixes" that break production URLs and help new developers name DAL methods, BO types, and parameters in ways that match the surrounding module.
When to use
- Creating a new controller, DAL class, or stored procedure wrapper
- Debugging route 404s or session null references
- Code review on authentication or module redirect logic
How naming layers stack
MVC Areas and routes
Intentional spelling (do not rename casually)
| Folder / route | Common misspelling | Notes |
|---|---|---|
Adminisration | Administration | Missing second t — Area registration, links, bookmarks |
ManagmentDashBoard | ManagementDashboard | Missing e in Management; camel DashBoard |
URLs must match exactly:
/Adminisration/UserDashBoard
/ManagmentDashBoard/ManagmentDashBoard
Renaming Area folders without updating AreaRegistration, routes, views, and every Html.ActionLink breaks the application.
Area naming pattern
- PascalCase folder names:
Payroll,AttendancePunching,VerificationAndApproval - Dashboard controllers often named
*DashboardController - Default action
Index
PageID vs Area name
LoginController.ModuleManagement uses PageID tokens that do not always equal Area folder names:
| PageID | Redirect target Area |
|---|---|
Payroll | Payroll |
Billing | Bills |
Stock | Stock |
Registration | Registration |
When adding modules, follow the existing ModuleManagement switch pattern.
Session and C# identifiers
RoleId (session) vs RoleID (database)
| Context | Convention |
|---|---|
| Session key | RoleId — camelCase Id |
SQL column UserRole | RoleID — uppercase ID |
Session Role | Role display name string |
Custom code reading session must use:
Session["RoleId"] // correct
Session["RoleID"] // wrong — returns null
Other session keys
CompID,CompName,UserID,UserName,BranchCodedtVerifyUser— holdsBO.User(prefixdtlegacy naming)- Module context:
Module, admin re-auth:Entryflag
Controller naming
- Root:
LoginController,DashboardController,ManageErrorController - Areas:
<Feature>ControllerinAreas/<Area>/Controllers/
DAL and BO naming
DAL classes
Patterns observed:
| Pattern | Example |
|---|---|
<Feature>_DAL.cs | Login_DAL.cs |
| Module subfolder | DAL/Payroll/SalaryProcess_DAL.cs |
| Module prefix | BillDashBoard_DAL.cs |
Methods often mirror SP names:
public DataTable GetEmployeeList(...) // → dbo.GetEmployeeList
public int InsertUpdateEmployee(...) // → dbo.InsertUpdateEmployee
BO classes
- Suffix
_BO:SalaryProcess_BO.cs,UserPermissions_BO.cs - Namespace by module:
BO.Payroll,BO.Bills,BO.Administrator - Properties match column names from SP result sets (PascalCase in C#)
Stored procedure naming
Dominant prefixes in ERP schema (~887 procedures):
| Prefix | Typical purpose | Examples |
|---|---|---|
Get* | Select lists, single record, reports data | GetLoginUser, GetCompany, GetEmployee |
InsertUpdate* | Combined insert/update upsert | InsertUpdateEmployee, InsertUpdateBillHeader |
Delete* | Soft or hard deletes | Module-specific |
Rpt* / report names | Reporting procedures | Payroll statutory extracts |
Parameters often include:
@CompID— company scope@UserID/@CreatedByUserID— audit@BranchCode— branch filter
C# DAL passes parameters in the same names SQL expects.
Legacy identifiers and typos in data model
These appear in columns and flags — preserve when writing SQL or seeds:
| Name | Note |
|---|---|
BulkGenrateIRN | "Generate" misspelled Genrate |
ZContratedRates | "Contracted" misspelled Contrated |
AttendancePuncging | "Punching" misspelled on user flag column |
CompanyUser.Compid | Lowercase id in column name |
Webenroll | Registration module flag — lowercase enroll |
Module boolean columns on UserAccounts use Z prefix for some products: ZStock, ZSales, ZManagementDashboard.
Views, assets, and publish
Razor views
Index.cshtml— default action view- Partials:
_PartialName.cshtmlleading underscore - Module layouts:
_Layout.cshtml,_PayrollLayout.cshtml, etc.
CSS / JS
- Shell:
app-assets/css/shell-modern.css,sidebar-unified.css - Module dashboards:
*-dashboard.css,*-modern.css - Cache bust: layout links append
?v=YYYYMMDD
csproj Content paths
Backslashes in project file:
<Content Include="Areas\Payroll\Views\EmployeeM\Index.cshtml" />
Reports (Crystal)
.rptfiles:Rpt*prefix common —RptPFDetails.rpt- Code-behind classes mirror report name
- Viewer
.aspxunder*ReportViewerForm/folders
Examples
Example — Correct admin URL
https://server/Adminisration/UserDashBoard/Index
Not /Administration/....
Example — DAL method to SP mapping
// Login_DAL.cs conceptually
cmd.CommandText = "GetLoginUser";
cmd.CommandType = CommandType.StoredProcedure;
Example — BO property matching SP column
If SP returns EmpCode, BO property is EmpCode, not EmployeeCode, unless mapped explicitly.
Related pages
Important notes
- Consistency beats correctness for legacy spellings in public routes and column names.
- New stored procedures should still follow
Get*/InsertUpdate*for discoverability. - Search both spellings when grepping history (e.g.
AdministrationvsAdminisration).
Common mistakes
| Mistake | Impact |
|---|---|
| "Fix" Area folder spelling | All module links 404 |
Session RoleID | Authorization checks fail silently |
| New CSS without csproj Content | Missing CSS on IIS |
| Rename SP without updating DAL | Runtime SQL errors |
| Assume PageID equals Area folder | Wrong redirect in ModuleManagement |
Next steps
- Explore Folder structure with naming in mind.
- Read FAQ for onboarding pitfalls.
- Trace Module routing for PageID mapping.