Skip to content

Commit 755d520

Browse files
author
Jani Giannoudis
committed
extended XML documentation
extended index page
1 parent 640e1f3 commit 755d520

32 files changed

Lines changed: 2826 additions & 914 deletions

Client.Scripting/Function/CaseAvailableFunction.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,39 @@
1010

1111
namespace PayrollEngine.Client.Scripting.Function;
1212

13-
/// <summary>Test if a case is available (default: true), optionally considering related source case values</summary>
13+
/// <summary>
14+
/// Determines whether a case is available for input (default: <c>true</c>).
15+
/// </summary>
16+
/// <remarks>
17+
/// This function runs before the case input form is shown. Returning <c>false</c> hides the
18+
/// case entirely from the user. Returning <c>true</c> or <c>null</c> makes the case visible.
19+
/// <para>Typical uses:</para>
20+
/// <list type="bullet">
21+
/// <item>Role-based visibility: show a case only to employees with a specific attribute.</item>
22+
/// <item>Condition-based visibility: show a case only if a prerequisite case value exists.</item>
23+
/// <item>Period-based visibility: restrict input to specific months or cycle phases.</item>
24+
/// </list>
25+
/// <para><strong>Low-Code / No-Code:</strong> Case availability can also be controlled through
26+
/// action expressions using <c>CaseAvailableAction</c> attributes — no C# scripting required.
27+
/// The <see cref="IsAvailable"/> entry point invokes all registered actions before executing
28+
/// any inline script body.</para>
29+
/// </remarks>
1430
/// <example>
1531
/// <code language="c#">
16-
/// // Example with case value
32+
/// // Available only for employees with level 2 or higher
1733
/// (int)Employee["Level"] >= 2
1834
/// </code>
1935
/// <code language="c#">
20-
/// // Example with related case value
36+
/// // Available only if the Wage case value exists in the current period
2137
/// HasCaseValue("Wage")
2238
/// </code>
2339
/// <code language="c#">
24-
/// // Example with optional related case value
40+
/// // Combine both: require Wage value AND minimum level
2541
/// HasCaseValue("Wage") ? (int)Employee["Level"] >= 2 : false
2642
/// </code>
2743
/// </example>
44+
/// <seealso cref="CaseBuildFunction"/>
45+
/// <seealso cref="CaseValidateFunction"/>
2846
// ReSharper disable once PartialTypeWithSinglePart
2947
public partial class CaseAvailableFunction : CaseFunction
3048
{

Client.Scripting/Function/CaseBuildFunction.cs

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,41 @@
1111

1212
namespace PayrollEngine.Client.Scripting.Function;
1313

14-
/// <summary>Build a case (default: true), optionally considering related source cases</summary>
14+
/// <summary>
15+
/// Populates case fields before the input form is displayed to the user.
16+
/// </summary>
17+
/// <remarks>
18+
/// This function executes every time the case form is opened or refreshed. It is used to
19+
/// pre-fill default values, derive field content from existing case data, apply lookups,
20+
/// compute dates, and control which fields are shown or hidden.
21+
/// <para>Typical uses:</para>
22+
/// <list type="bullet">
23+
/// <item>Set <c>Start["Field"]</c> and <c>End["Field"]</c> to default the value period.</item>
24+
/// <item>Pre-fill <c>Value["Field"]</c> from existing case values or lookups.</item>
25+
/// <item>Show or hide fields with <see cref="CaseChangeFunction.ShowCaseField"/> / <see cref="CaseChangeFunction.HideCaseField"/>.</item>
26+
/// <item>Mark the form as invalid with <see cref="BuildInvalid"/> to block submission.</item>
27+
/// </list>
28+
/// <para><strong>Return value:</strong> Return <c>null</c> to indicate a successful build.
29+
/// Return <c>false</c> to mark the case as not buildable (equivalent to <see cref="BuildInvalid"/>).</para>
30+
/// <para><strong>Low-Code / No-Code:</strong> Field population can also be expressed through
31+
/// action expressions using <c>CaseBuildAction</c> attributes — no C# scripting required.
32+
/// The <see cref="Build"/> entry point invokes all registered actions before executing
33+
/// any inline script body.</para>
34+
/// </remarks>
1535
/// <example>
1636
/// <code language="c#">
17-
/// // Example with case value
18-
/// (int)Employee["Level"] >= 2
37+
/// // Set the start date to today and derive a salary value
38+
/// Start["Salary"] = PeriodStart;
39+
/// Value["Salary"] = GetCaseValue&lt;decimal&gt;("BaseSalary") * 1.05m;
1940
/// </code>
2041
/// <code language="c#">
21-
/// // Example with related case value
22-
/// HasCaseValue("Wage")
23-
/// </code>
24-
/// <code language="c#">
25-
/// // Example with optional related case value
26-
/// HasCaseValue("Wage") ? (int)Employee["Level"] >= 2 : false
42+
/// // Hide a field that is not applicable
43+
/// if ((string)Employee["ContractType"] != "Management")
44+
/// HideCaseField("ManagementBonus");
2745
/// </code>
2846
/// </example>
47+
/// <seealso cref="CaseAvailableFunction"/>
48+
/// <seealso cref="CaseValidateFunction"/>
2949
// ReSharper disable once PartialTypeWithSinglePart
3050
public partial class CaseBuildFunction : CaseChangeFunction
3151
{
@@ -46,32 +66,24 @@ protected CaseBuildFunction(string sourceFileName) :
4666

4767
#region Validation
4868

49-
/// <summary>
50-
/// Set case build to valid
51-
/// </summary>
69+
/// <summary>Marks the case form as valid; submission is permitted</summary>
5270
public void BuildValid() => BuildValidity(true);
5371

54-
/// <summary>
55-
/// Set case build to invalid
56-
/// </summary>
72+
/// <summary>Marks the case form as invalid; submission is blocked</summary>
5773
public void BuildInvalid() => BuildValidity(false);
5874

59-
/// <summary>
60-
/// Set case build validity
61-
/// </summary>
62-
/// <param name="valid">Build validity</param>
75+
/// <summary>Sets the validity state of the case form</summary>
76+
/// <param name="valid"><c>true</c> to permit submission; <c>false</c> to block it</param>
6377
public void BuildValidity(bool valid) =>
6478
SetCaseAttribute(InputAttributes.Validity, valid);
6579

6680
#endregion
6781

6882
#region Info
6983

70-
/// <summary>
71-
/// Add build info
72-
/// </summary>
73-
/// <param name="name">Info name</param>
74-
/// <param name="value">Info value</param>
84+
/// <summary>Adds or updates a named entry in the case form's edit-info attribute</summary>
85+
/// <param name="name">The info entry name</param>
86+
/// <param name="value">The info entry value</param>
7587
public void AddInfo(string name, object value)
7688
{
7789
// info values
@@ -87,10 +99,8 @@ public void AddInfo(string name, object value)
8799
SetCaseAttribute(InputAttributes.EditInfo, JsonSerializer.Serialize(values));
88100
}
89101

90-
/// <summary>
91-
/// Remove build info
92-
/// </summary>
93-
/// <param name="name">Info name</param>
102+
/// <summary>Removes a named entry from the case form's edit-info attribute</summary>
103+
/// <param name="name">The info entry name to remove</param>
94104
public void RemoveInfo(string name)
95105
{
96106
// info values

0 commit comments

Comments
 (0)