📄 Table of Contents
- 🚀 Overview & Purpose
- 🔧 Dependencies & Technologies
- 🚦 Key Functional Areas
- 🗂️ View Models & Data Models
- 🔗 Third‑Party Integrations
- 💡 Sample Code Blocks & Usage Examples
- 📊 UML Class Diagram
- 📝 Conclusion
🚀 Overview & Purpose
The DocumentAttributeView.cs file defines POCO (Plain Old CLR Objects) classes used by the ASP.NET Core MVC UI of the IrbyImaging application. These view models represent metadata and classification of documents in the imaging system, including:
- ✔️ Custom attributes (name, type, multi‑value, required flag, etc.)
- ✔️ Category flags (Legal, Safety, IT, Accounting, Bidding)
- ✔️ Linkage to employees, jobs, or customers
- ✔️ Document‑type selections and multi‑value options
Intended Use:
These classes are passed from Controllers → Razor Views to render forms, grids and selection lists for managing document attributes.
🔧 Dependencies & Technologies
| Category | Details |
|---|---|
| Language | C# (.NET 6+/Standard) |
| Framework | ASP.NET Core MVC |
| Key Namespaces | System, System.ComponentModel.DataAnnotations, Microsoft.AspNetCore.Mvc.Rendering |
| Domain References | IrbyImaging.DomainClasses (for AttributeType, ImagingType enums) |
| UI Components | SelectListItem |
🚦 Key Functional Areas
- Attribute Definition
- Stores GUID, display name, backend type, and human‑readable type.
- Validation & Requirements
- Flags:
IsMultiValue,IsRequired,IsAvailable,IsDeleted
- Flags:
- Categorization
- Boolean properties:
IsLegal,IsSafety,IsIT,IsAccounting,IsBidding
- Boolean properties:
- Linkage
LinkEmployeeData,LinkJobData,LinkCustomerData
- Document Types & Values
DocTypes: list of available document types with selectionMultiValueTypes: drop‑down list for multi‑value attributes
- Audit Trail
AddedBy,AddedDate,ModifiedBy,ModifiedDateproperties
🗂️ View Models & Data Models
DocumentAttributeView
Represents the main DTO for creating or editing a document attribute in the UI.
| Property | Type | Description |
|---|---|---|
| Id | Guid |
Unique identifier. |
| AttributeName | string |
Friendly name of the attribute. |
| AttributeType | AttributeType (enum) |
Backend data type (e.g., String, Integer, Date). |
| AttrType | string |
Human‑readable data type name. |
| IsMultiValue | bool |
If true, multiple values allowed. |
| IsRequired | bool |
If true, the attribute must be provided. |
| IsAvailable | bool |
If false, hidden from selection. |
| IsDeleted | bool |
Soft‑delete flag. |
| Category Flags | bool |
IsLegal, IsSafety, IsIT, IsAccounting, IsBidding. |
| ImagingType | ImagingType (enum) |
Application‑specific imaging category. |
| LinkEmployeeData | bool |
Associates this attribute with an employee. |
| LinkJobData | bool |
Associates with a job. |
| LinkCustomerData | bool |
Associates with a customer. |
| Values | string |
Comma‑delimited options (for multi‑value scenarios). |
| DocumentType | string |
Selected document type. |
| DocList | List<DocumentAttributeViewDetail> |
Sub‑attributes or related attribute details. |
| DocTypes | List<DocumentTypes> |
Available document types for selection. |
| MultiValues | string[] |
Array of selected multi‑value entries. |
| MultiValueTypes | List<SelectListItem> |
UI list for multi‑value drop‑down. |
| IndexValue | string |
Ordering or lookup key. |
| Audit Fields | N/A | AddedBy, AddedDate, ModifiedBy, ModifiedDate. |
DocumentTypes
A simple POCO to represent each document type in a checklist or drop‑down.
| Property | Type | Description |
|---|---|---|
| Name | string |
Display name (e.g., "Invoice", "Contract"). |
| Id | string |
Identifier (could mirror a GUID or code). |
| IsSelected | bool |
Indicates if the type is currently chosen. |
EmployeeAndJob
Utility class for linking attributes to employees or jobs.
| Property | Type | Description |
|---|---|---|
| Id | Guid |
Unique identifier of employee/job. |
| Name | string |
Display name. |
DocumentAttributeViewDetail
Represents child attributes or historical entries related to a parent DocumentAttributeView.
Note: Shares many properties with the parent, but adds an
IsHRflag.
| Property | Type | Description |
|---|---|---|
| (Most are same as DocumentAttributeView) | ||
| IsHR | bool |
Marks attribute as HR‑specific. |
🔗 Third‑Party Integrations
- Microsoft.AspNetCore.Mvc.Rendering
- Provides
SelectListItemfor building<select>controls dynamically.
- Provides
- DataAnnotations
[Display(Name = "...")]for friendly labels in Razor.
💡 Sample Code Blocks & Usage Examples
1. Controller Action Example
public class DocumentAttributeController : Controller
{
public IActionResult Edit(Guid id)
{
// Fetch from domain/repository (pseudo-code)
var entity = _attributeService.GetById(id);
// Map to ViewModel
var vm = new DocumentAttributeView
{
Id = entity.Id,
AttributeName = entity.Name,
AttrType = entity.Type.ToString(),
AttributeType = entity.Type,
IsRequired = entity.IsRequired,
// …fill other flags…
DocTypes = GetDocumentTypeList(),
MultiValueTypes = GetMultiValueSelectList()
};
return View(vm);
}
}
2. Razor View Snippet
<form asp-action="Edit">
<input asp-for="AttributeName" class="form-control" />
<select asp-for="AttrType" asp-items="Model.MultiValueTypes"></select>
<div>
<label>
<input asp-for="IsRequired" type="checkbox" /> Required
</label>
</div>
<button type="submit" class="btn btn-primary">Save</button>
</form>
3. Initializing Multi‑Value Types
private List<SelectListItem> GetMultiValueSelectList()
{
return new List<SelectListItem>
{
new SelectListItem("Option A", "A"),
new SelectListItem("Option B", "B"),
new SelectListItem("Option C", "C"),
};
}
📊 UML Class Diagram
classDiagram
class DocumentAttributeView {
+Guid Id
+string AttributeName
+AttributeType AttributeType
+string AttrType
+bool IsMultiValue
+bool IsRequired
+bool IsLegal
+bool IsSafety
+bool IsIT
+bool IsAccounting
+bool IsBidding
+ImagingType ImagingType
+bool LinkEmployeeData
+bool LinkJobData
+bool LinkCustomerData
+string Values
+string DocumentType
+bool IsAvailable
+bool IsDeleted
+string AddedBy
+DateTime AddedDate
+string ModifiedBy
+DateTime ModifiedDate
+List~DocumentAttributeViewDetail~ DocList
+List~DocumentTypes~ DocTypes
+string[] MultiValues
+List~SelectListItem~ MultiValueTypes
+string IndexValue
}
class DocumentAttributeViewDetail {
+Guid Id
+string AttributeName
+AttributeType AttributeType
+string AttrType
+bool IsMultiValue
+string Values
+string DocumentType
+bool IsAvailable
+bool IsDeleted
+bool IsLegal
+bool IsSafety
+bool IsIT
+bool IsAccounting
+bool IsBidding
+ImagingType ImagingType
+bool IsHR
+string AddedBy
+DateTime AddedDate
+string ModifiedBy
+DateTime ModifiedDate
+string[] MultiValues
+List~SelectListItem~ MultiValueTypes
+string IndexValue
+bool LinkEmployeeData
+bool LinkJobData
+bool LinkCustomerData
+bool IsRequired
}
class DocumentTypes {
+string Name
+string Id
+bool IsSelected
}
class EmployeeAndJob {
+Guid Id
+string Name
}
DocumentAttributeView --> "0..*" DocumentAttributeViewDetail
DocumentAttributeView --> "0..*" DocumentTypes
📝 Conclusion
🎯 DocumentAttributeView.cs empowers the IrbyImaging UI layer with rich metadata models for document attribute management. By combining flag‑based categorization, multi‑value capabilities, audit trails, and dynamic selection lists, you can:
- Build flexible forms for adding/editing document attributes
- Present filtered checklists of document types
- Associate attributes seamlessly with Employees, Jobs, or Customers
- Leverage built‑in DataAnnotations for form validation and labeling
Use these view models as the contract between your Controllers and Razor Views to deliver a robust and user‑friendly document management experience. 🚀