📂 IrbyImaging.UI.Models.HRDocumentCategories
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Key Functional Areas
- Data Models
- UML Class Diagram
- Sample Code Snippets
- Usage Examples
- Error Handling & Validation
- Third‑Party Integrations
- Conclusion
🎯 Overview & Purpose
The HRDocumentCategories model and its nested HRDocumentCategoryDetail class are part of the IrbyImaging.UI assembly. They define the structure and behavior of HR‑related document categorization and indexing within the UI layer.
- Primary goals
- Represent high‑level document category metadata
- Support indexing and multi‑value tags for advanced searching
- Nest detailed document entries under each category
Use these classes to pass HR document configuration data between server and client or across UI components (e.g., in Razor pages, Web APIs, or view models).
🛠️ Dependencies & Technologies
| Technology / Package | Version / Notes |
|---|---|
| .NET / C# | ≥ .NET Core 3.1 / .NET 5+ |
| IrbyImaging.UI Assembly | Contains UI View Models and Helpers |
| System.Collections.Generic | For using List<T> |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IrbyImaging.UI.Models
{
// ...
}
🔑 Key Functional Areas
-
Category Metadata
Group documents by a human‑readable category (e.g., “Onboarding”, “Payroll”). -
Document Type
Specify sub‑types within each category (e.g., “Form”, “Policy”). -
Indexing
Support indexing fields so the UI can filter and display based on index type/value. -
Multi‑Value Support
Allow indexes which accept multiple values (tags, flags). -
Detail Listing
Nested list of detailed configurations or individual documents under each category.
📊 Data Models
HRDocumentCategories
Represents a top‑level grouping of HR documents with indexing and sub‑lists.
| Property | Type | Description |
|---|---|---|
| DocumentCategory | string |
High‑level category name (e.g., “Benefits”, “Compliance”). |
| DocumentType | string |
Type within the category (e.g., “Guide”, “Form”). |
| IndexName | string |
Name of the index used for filtering/searching (e.g., “DepartmentCode”). |
| IndexType | string |
Data type or UI control to render (e.g., “Dropdown”, “Text”). |
| IndexValue | string |
Current or default value for the index. |
| MultiValueIndex | bool |
Whether the index can hold multiple values (true = multi‑select). |
| DocumentList | List<HRDocumentCategoryDetail> |
List of detailed document entries under this category. |
public class HRDocumentCategories
{
public string DocumentCategory { get; set; }
public string DocumentType { get; set; }
public string IndexName { get; set; }
public string IndexType { get; set; }
public string IndexValue { get; set; }
public bool MultiValueIndex { get; set; }
public List<HRDocumentCategoryDetail> DocumentList { get; set; }
}
HRDocumentCategoryDetail
Defines the individual document entry details within a category. Shares the same core properties for consistency.
| Property | Type | Description |
|---|---|---|
| DocumentCategory | string |
Category name (mirrors parent). |
| DocumentType | string |
Document subtype (mirrors parent). |
| IndexName | string |
Index field name for this specific document. |
| IndexType | string |
Index field type or UI control. |
| IndexValue | string |
Value of the index for this document. |
| MultiValueIndex | bool |
Indicates if multiple values are allowed for this document’s index. |
public class HRDocumentCategoryDetail
{
public string DocumentCategory { get; set; }
public string DocumentType { get; set; }
public string IndexName { get; set; }
public string IndexType { get; set; }
public string IndexValue { get; set; }
public bool MultiValueIndex { get; set; }
}
📈 UML Class Diagram
classDiagram
class HRDocumentCategories {
+string DocumentCategory
+string DocumentType
+string IndexName
+string IndexType
+string IndexValue
+bool MultiValueIndex
+List<HRDocumentCategoryDetail> DocumentList
}
class HRDocumentCategoryDetail {
+string DocumentCategory
+string DocumentType
+string IndexName
+string IndexType
+string IndexValue
+bool MultiValueIndex
}
HRDocumentCategories "1" -- "0..*" HRDocumentCategoryDetail : contains >
🧩 Sample Code Snippets
Initializing a Category with Details
var onboardingCategory = new HRDocumentCategories
{
DocumentCategory = "Onboarding",
DocumentType = "Form",
IndexName = "Department",
IndexType = "Dropdown",
IndexValue = "HR",
MultiValueIndex = false,
DocumentList = new List<HRDocumentCategoryDetail>
{
new HRDocumentCategoryDetail
{
DocumentCategory = "Onboarding",
DocumentType = "Form",
IndexName = "Department",
IndexType = "Dropdown",
IndexValue = "IT",
MultiValueIndex = false
},
new HRDocumentCategoryDetail
{
DocumentCategory = "Onboarding",
DocumentType = "Policy",
IndexName = "Region",
IndexType = "MultiSelect",
IndexValue = "NA;EMEA",
MultiValueIndex = true
}
}
};
🔍 Usage Examples
-
Populate a drop‑down filter
// In your Razor page or API controller: ViewBag.Categories = onboardingCategory.DocumentList .Select(d => new SelectListItem { Value = d.IndexValue, Text = d.IndexName }) .ToList(); -
Serialize to JSON for API
var json = JsonConvert.SerializeObject(onboardingCategory); // Send json to client -
Filter documents by tag
var multiValueDocs = onboardingCategory.DocumentList .Where(d => d.MultiValueIndex && d.IndexValue.Contains("EMEA")) .ToList();
⚠️ Error Handling & Validation
-
Null Checks
EnsureDocumentListis initialized before use to avoidNullReferenceException.DocumentList = DocumentList ?? new List<HRDocumentCategoryDetail>(); -
IndexValue Format
ForMultiValueIndex = true, agree on a delimiter (e.g.,;) and validate splitting logic. -
Data Annotation (Optional)
Consider[Required]or custom validation attributes to enforce non‑empty fields.
🌐 Third‑Party Integrations
-
Newtonsoft.Json / System.Text.Json
For JSON serialization of these models in Web API responses or local storage. -
SelectListItem (Microsoft.AspNetCore.Mvc.Rendering)
If you convert these models directly into UI select/drop‑down lists.
🏁 Conclusion
The HRDocumentCategories and HRDocumentCategoryDetail classes provide a lightweight, extensible structure for representing HR document metadata in your UI. They allow grouping, indexing, and multi‑value tagging of HR documents, making it easy to:
- Build dynamic filters and drop lists
- Serialize/deserialize configuration payloads
- Manage nested document details in a strongly typed way
Use these models as part of your view models, API contracts, or any UI component that requires flexible HR document categorization.
Happy coding! 🚀