refactor: change into vertical slices folders
This commit is contained in:
parent
08c46f55a9
commit
3439198dad
@ -1,10 +1,11 @@
|
||||
@page "/edit-core-rule"
|
||||
@using ILoan.Tools.Domain.Entities
|
||||
|
||||
<PageTitle>Edit CoreRule</PageTitle>
|
||||
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRule</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRule" Data="@coreRule" Visible="@(coreRule != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRule" Data="@coreRule" Visible="@(coreRule != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Rule Name" Component="RuleName" style="width: 100%" />
|
55
src/iLoan.Rules.Web/Application/EditCoreRule.razor.cs
Normal file
55
src/iLoan.Rules.Web/Application/EditCoreRule.razor.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Tools.Application;
|
||||
|
||||
public partial class EditCoreRule
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int ID { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRule = await RulesService.GetCoreRuleById(ID);
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected CoreRule coreRule;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
coreRule.Update += 1;
|
||||
await RulesService.UpdateCoreRule(ID, coreRule);
|
||||
DialogService.Close(coreRule);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
}
|
@ -21,13 +21,13 @@
|
||||
</RadzenBody>
|
||||
<RadzenSidebar Expanded="@sidebarExpanded" style="z-index: 2">
|
||||
<RadzenStack AlignItems="Radzen.AlignItems.Center" class="rz-py-4 rz-py-lg-6" Style="padding: var(--rz-panel-menu-item-padding); border-bottom: var(--rz-panel-menu-item-border);">
|
||||
<RadzenText Text="iLoan.Rules.Web" TextStyle="Radzen.Blazor.TextStyle.Subtitle1" class="rz-mb-0" style="color: var(--rz-sidebar-color);" />
|
||||
<RadzenText Text="iLoan.Tools" TextStyle="Radzen.Blazor.TextStyle.Subtitle1" class="rz-mb-0" style="color: var(--rz-sidebar-color);" />
|
||||
</RadzenStack>
|
||||
<RadzenPanelMenu>
|
||||
<RadzenPanelMenuItem Text="Rules" Path="" />
|
||||
</RadzenPanelMenu>
|
||||
<RadzenStack AlignItems="Radzen.AlignItems.Center" Gap="0" class="rz-py-4 rz-py-lg-6" Style="padding: var(--rz-panel-menu-item-padding);">
|
||||
<RadzenText Text="iLoan.Rules.Web v1.0.0" TextStyle="Radzen.Blazor.TextStyle.Caption" TagName="Radzen.Blazor.TagName.P" TextAlign="Radzen.TextAlign.Center" />
|
||||
<RadzenText Text="iLoan.Tools v1.0.0" TextStyle="Radzen.Blazor.TextStyle.Caption" TagName="Radzen.Blazor.TagName.P" TextAlign="Radzen.TextAlign.Center" />
|
||||
<RadzenText Text="Copyright Ⓒ 2024" TextStyle="Radzen.Blazor.TextStyle.Caption" class="rz-mb-0" TagName="Radzen.Blazor.TagName.P" TextAlign="Radzen.TextAlign.Center" />
|
||||
</RadzenStack>
|
||||
</RadzenSidebar>
|
29
src/iLoan.Rules.Web/Application/Layout/MainLayout.razor.cs
Normal file
29
src/iLoan.Rules.Web/Application/Layout/MainLayout.razor.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace ILoan.Tools.Application.Layout;
|
||||
|
||||
public partial class MainLayout
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
|
||||
private bool sidebarExpanded = true;
|
||||
|
||||
void SidebarToggleClick()
|
||||
{
|
||||
sidebarExpanded = !sidebarExpanded;
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
@page "/add-core-rule"
|
||||
@using ILoan.Tools.Domain.Entities
|
||||
|
||||
<PageTitle>Add CoreRule</PageTitle>
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRule</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRule" Data="@coreRule" Visible="@(coreRule != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRule" Data="@coreRule" Visible="@(coreRule != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Rule Name" Component="RuleName" style="width: 100%" />
|
51
src/iLoan.Rules.Web/Application/Pages/AddCoreRule.razor.cs
Normal file
51
src/iLoan.Rules.Web/Application/Pages/AddCoreRule.razor.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Tools.Application.Pages;
|
||||
|
||||
public partial class AddCoreRule
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRule = new CoreRule();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected CoreRule coreRule;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRule(coreRule);
|
||||
DialogService.Close(coreRule);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<PageTitle>Add CoreRuleCriteriaOperator</PageTitle>
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRuleCriteriaOperator</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator" Data="@coreRuleCriteriaOperator" Visible="@(coreRuleCriteriaOperator != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRuleCriteriaOperator" Data="@coreRuleCriteriaOperator" Visible="@(coreRuleCriteriaOperator != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Core Rule" Component="CoreRule" style="width: 100%" />
|
@ -0,0 +1,75 @@
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Tools.Application.Pages;
|
||||
|
||||
public partial class AddCoreRuleCriteriaOperator
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected CoreRuleCriteriaOperator coreRuleCriteriaOperator;
|
||||
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRuleCriteriaOperator(coreRuleCriteriaOperator);
|
||||
DialogService.Close(coreRuleCriteriaOperator);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool hasRuleIDValue;
|
||||
|
||||
[Parameter]
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriteriaOperator = new CoreRuleCriteriaOperator();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
||||
if (hasRuleIDValue)
|
||||
{
|
||||
coreRuleCriteriaOperator.RuleID = hasRuleIDResult;
|
||||
}
|
||||
await base.SetParametersAsync(parameters);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<PageTitle>Add CoreRuleCriterion</PageTitle>
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRuleCriterion</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRuleCriterion" Data="@coreRuleCriterion" Visible="@(coreRuleCriterion != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRuleCriterion" Data="@coreRuleCriterion" Visible="@(coreRuleCriterion != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Core Rule" Component="CoreRule" style="width: 100%" />
|
@ -0,0 +1,85 @@
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Tools.Application.Pages;
|
||||
|
||||
public partial class AddCoreRuleCriterion
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
public List<string> Properties { get; set; }
|
||||
public List<string> Comparisons { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Properties = RulesService.GetProperties();
|
||||
Comparisons = RulesService.GetComparisons();
|
||||
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected CoreRuleCriterion coreRuleCriterion;
|
||||
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRuleCriterion(coreRuleCriterion);
|
||||
DialogService.Close(coreRuleCriterion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool hasRuleIDValue;
|
||||
|
||||
[Parameter]
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriterion = new CoreRuleCriterion();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
||||
if (hasRuleIDValue)
|
||||
{
|
||||
coreRuleCriterion.RuleID = hasRuleIDResult;
|
||||
}
|
||||
await base.SetParametersAsync(parameters);
|
||||
}
|
||||
|
||||
void OnChange(dynamic args)
|
||||
{
|
||||
coreRuleCriterion.Property = args;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
@page "/"
|
||||
@using ILoan.Tools.Domain.Entities
|
||||
|
||||
<PageTitle>CoreRules</PageTitle>
|
||||
<RadzenStack>
|
||||
@ -20,7 +21,7 @@
|
||||
<Columns>
|
||||
<RadzenDataGridColumn TItem="CoreRule" Property="ID" Title="ID">
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="CoreRule" Property="RuleName" Title="Rule Name">
|
||||
<RadzenDataGridColumn TItem="CoreRule" Property="RuleName" Title="Rule Name" Width="400px">
|
||||
</RadzenDataGridColumn>
|
||||
<RadzenDataGridColumn TItem="CoreRule" Property="Source" Title="Source">
|
||||
</RadzenDataGridColumn>
|
207
src/iLoan.Rules.Web/Application/Pages/CoreRules.razor.cs
Normal file
207
src/iLoan.Rules.Web/Application/Pages/CoreRules.razor.cs
Normal file
@ -0,0 +1,207 @@
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Tools.Application.Pages;
|
||||
|
||||
public partial class CoreRules
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public RuleFileGeneratorService RuleFileGeneratorService { get; set; }
|
||||
|
||||
protected IEnumerable<CoreRule> coreRules;
|
||||
|
||||
protected RadzenDataGrid<CoreRule> grid0;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRules = await RulesService.GetCoreRules();
|
||||
}
|
||||
|
||||
protected async Task AddButtonClick(MouseEventArgs args)
|
||||
{
|
||||
await DialogService.OpenAsync<AddCoreRule>("Add CoreRule", null);
|
||||
await grid0.Reload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute RuleFileGeneratorService to generate SQL files
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task GenerateButtonClick()
|
||||
{
|
||||
await RuleFileGeneratorService.GenerateRuleFilesAsync();
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Success,
|
||||
Summary = $"Success",
|
||||
Detail = $"Rule files generated successfully",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task EditRow(CoreRule args)
|
||||
{
|
||||
await DialogService.OpenAsync<EditCoreRule>("Edit CoreRule", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
}
|
||||
|
||||
protected async Task GridDeleteButtonClick(MouseEventArgs args, CoreRule coreRule)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRule(coreRule.ID);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await grid0.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRule"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected CoreRule coreRuleChild;
|
||||
protected async Task GetChildData(CoreRule args)
|
||||
{
|
||||
coreRuleChild = args;
|
||||
var CoreRuleCriteriaResult = await RulesService.GetCoreRuleCriteria(new Query { Filter = $@"i => i.RuleID == {args.ID}", Expand = "CoreRule" });
|
||||
if (CoreRuleCriteriaResult != null)
|
||||
{
|
||||
args.CoreRuleCriteria = CoreRuleCriteriaResult.ToList();
|
||||
}
|
||||
var CoreRuleCriteriaOperatorsResult = await RulesService.GetCoreRuleCriteriaOperators(new Query { Filter = $@"i => i.RuleID == {args.ID}", Expand = "CoreRule" });
|
||||
if (CoreRuleCriteriaOperatorsResult != null)
|
||||
{
|
||||
args.CoreRuleCriteriaOperators = CoreRuleCriteriaOperatorsResult.ToList();
|
||||
}
|
||||
}
|
||||
protected CoreRuleCriterion coreRuleCriterionCoreRuleCriteria;
|
||||
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleIDCoreRuleCriteria;
|
||||
|
||||
protected RadzenDataGrid<CoreRuleCriterion> CoreRuleCriteriaDataGrid;
|
||||
|
||||
protected async Task CoreRuleCriteriaAddButtonClick(MouseEventArgs args, CoreRule data)
|
||||
{
|
||||
|
||||
var dialogResult = await DialogService.OpenAsync<AddCoreRuleCriterion>("Add CoreRuleCriteria", new Dictionary<string, object> { {"RuleID" , data.ID} }, new DialogOptions
|
||||
{
|
||||
Width = "70%"
|
||||
});
|
||||
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaRowSelect(CoreRuleCriterion args, CoreRule data)
|
||||
{
|
||||
var dialogResult = await DialogService.OpenAsync<EditCoreRuleCriterion>("Edit CoreRuleCriteria", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaDeleteButtonClick(MouseEventArgs args, CoreRuleCriterion coreRuleCriterion)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRuleCriterion(coreRuleCriterion.ID);
|
||||
|
||||
await GetChildData(coreRuleChild);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRuleCriterion"
|
||||
});
|
||||
}
|
||||
}
|
||||
protected CoreRuleCriteriaOperator coreRuleCriteriaOperatorCoreRuleCriteriaOperators;
|
||||
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleIDCoreRuleCriteriaOperators;
|
||||
|
||||
protected RadzenDataGrid<CoreRuleCriteriaOperator> CoreRuleCriteriaOperatorsDataGrid;
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsAddButtonClick(MouseEventArgs args, CoreRule data)
|
||||
{
|
||||
|
||||
var dialogResult = await DialogService.OpenAsync<AddCoreRuleCriteriaOperator>("Add CoreRuleCriteriaOperators", new Dictionary<string, object> { {"RuleID" , data.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsRowSelect(CoreRuleCriteriaOperator args, CoreRule data)
|
||||
{
|
||||
var dialogResult = await DialogService.OpenAsync<EditCoreRuleCriteriaOperator>("Edit CoreRuleCriteriaOperators", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsDeleteButtonClick(MouseEventArgs args, CoreRuleCriteriaOperator coreRuleCriteriaOperator)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRuleCriteriaOperator(coreRuleCriteriaOperator.ID);
|
||||
|
||||
await GetChildData(coreRuleChild);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRuleCriteriaOperator"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRuleCriteriaOperator</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator" Data="@coreRuleCriteriaOperator" Visible="@(coreRuleCriteriaOperator != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRuleCriteriaOperator" Data="@coreRuleCriteriaOperator" Visible="@(coreRuleCriteriaOperator != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Core Rule" Component="CoreRule" style="width: 100%" />
|
@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
namespace ILoan.Tools.Application.Pages
|
||||
{
|
||||
public partial class EditCoreRuleCriteriaOperator
|
||||
{
|
||||
@ -41,9 +34,9 @@ namespace ILoan.Rules.Web.Components.Pages
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator coreRuleCriteriaOperator;
|
||||
protected CoreRuleCriteriaOperator coreRuleCriteriaOperator;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleID;
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
@ -74,7 +67,7 @@ namespace ILoan.Rules.Web.Components.Pages
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriteriaOperator = new ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator();
|
||||
coreRuleCriteriaOperator = new CoreRuleCriteriaOperator();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<RadzenColumn SizeMD=12>
|
||||
<RadzenAlert Shade="Shade.Lighter" Variant="Variant.Flat" Size="AlertSize.Small" AlertStyle="AlertStyle.Danger" Visible="@errorVisible">Cannot save CoreRuleCriterion</RadzenAlert>
|
||||
<RadzenTemplateForm TItem="ILoan.Rules.Web.Models.Rules.CoreRuleCriterion" Data="@coreRuleCriterion" Visible="@(coreRuleCriterion != null)" Submit="@FormSubmit">
|
||||
<RadzenTemplateForm TItem="CoreRuleCriterion" Data="@coreRuleCriterion" Visible="@(coreRuleCriterion != null)" Submit="@FormSubmit">
|
||||
<RadzenRow style="margin-bottom: 1rem">
|
||||
<RadzenColumn SizeMD="3">
|
||||
<RadzenLabel Text="Core Rule" Component="CoreRule" style="width: 100%" />
|
@ -1,13 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
namespace ILoan.Tools.Application.Pages
|
||||
{
|
||||
public partial class EditCoreRuleCriterion
|
||||
{
|
||||
@ -47,9 +40,9 @@ namespace ILoan.Rules.Web.Components.Pages
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriterion coreRuleCriterion;
|
||||
protected CoreRuleCriterion coreRuleCriterion;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleID;
|
||||
protected IEnumerable<CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
@ -80,7 +73,7 @@ namespace ILoan.Rules.Web.Components.Pages
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriterion = new ILoan.Rules.Web.Models.Rules.CoreRuleCriterion();
|
||||
coreRuleCriterion = new CoreRuleCriterion();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
@ -9,6 +9,6 @@
|
||||
@using Radzen
|
||||
@using Radzen.Blazor
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using ILoan.Rules.Web
|
||||
@using ILoan.Rules.Web.Components
|
||||
@using ILoan.Rules.Web.Components.Layout
|
||||
@using ILoan.Tools
|
||||
@using ILoan.Tools.Application
|
||||
@using ILoan.Tools.Application.Layout
|
@ -1,40 +0,0 @@
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Layout
|
||||
{
|
||||
public partial class MainLayout
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
|
||||
private bool sidebarExpanded = true;
|
||||
|
||||
void SidebarToggleClick()
|
||||
{
|
||||
sidebarExpanded = !sidebarExpanded;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
{
|
||||
public partial class AddCoreRule
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRule = new ILoan.Rules.Web.Models.Rules.CoreRule();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRule coreRule;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRule(coreRule);
|
||||
DialogService.Close(coreRule);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
{
|
||||
public partial class AddCoreRuleCriteriaOperator
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator coreRuleCriteriaOperator;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRuleCriteriaOperator(coreRuleCriteriaOperator);
|
||||
DialogService.Close(coreRuleCriteriaOperator);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool hasRuleIDValue;
|
||||
|
||||
[Parameter]
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriteriaOperator = new ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
||||
if (hasRuleIDValue)
|
||||
{
|
||||
coreRuleCriteriaOperator.RuleID = hasRuleIDResult;
|
||||
}
|
||||
await base.SetParametersAsync(parameters);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DocumentFormat.OpenXml.CustomProperties;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
{
|
||||
public partial class AddCoreRuleCriterion
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
public List<string> Properties { get; set; }
|
||||
public List<string> Comparisons { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Properties = RulesService.GetProperties();
|
||||
Comparisons = RulesService.GetComparisons();
|
||||
|
||||
coreRulesForRuleID = await RulesService.GetCoreRules();
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriterion coreRuleCriterion;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleID;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
await RulesService.CreateCoreRuleCriterion(coreRuleCriterion);
|
||||
DialogService.Close(coreRuleCriterion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool hasRuleIDValue;
|
||||
|
||||
[Parameter]
|
||||
public int? RuleID { get; set; }
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
coreRuleCriterion = new ILoan.Rules.Web.Models.Rules.CoreRuleCriterion();
|
||||
|
||||
hasRuleIDValue = parameters.TryGetValue<int?>("RuleID", out var hasRuleIDResult);
|
||||
|
||||
if (hasRuleIDValue)
|
||||
{
|
||||
coreRuleCriterion.RuleID = hasRuleIDResult;
|
||||
}
|
||||
await base.SetParametersAsync(parameters);
|
||||
}
|
||||
|
||||
void OnChange(dynamic args)
|
||||
{
|
||||
coreRuleCriterion.Property = args;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ILoan.Rules.Web.Services;
|
||||
using Microsoft.JSInterop;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Radzen.Blazor;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
{
|
||||
public partial class CoreRules
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public RuleFileGeneratorService RuleFileGeneratorService { get; set; }
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRules;
|
||||
|
||||
protected RadzenDataGrid<ILoan.Rules.Web.Models.Rules.CoreRule> grid0;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRules = await RulesService.GetCoreRules();
|
||||
}
|
||||
|
||||
protected async Task AddButtonClick(MouseEventArgs args)
|
||||
{
|
||||
await DialogService.OpenAsync<AddCoreRule>("Add CoreRule", null);
|
||||
await grid0.Reload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute RuleFileGeneratorService to generate SQL files
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task GenerateButtonClick()
|
||||
{
|
||||
await RuleFileGeneratorService.GenerateRuleFilesAsync();
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Success,
|
||||
Summary = $"Success",
|
||||
Detail = $"Rule files generated successfully",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task EditRow(ILoan.Rules.Web.Models.Rules.CoreRule args)
|
||||
{
|
||||
await DialogService.OpenAsync<EditCoreRule>("Edit CoreRule", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
}
|
||||
|
||||
protected async Task GridDeleteButtonClick(MouseEventArgs args, ILoan.Rules.Web.Models.Rules.CoreRule coreRule)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRule(coreRule.ID);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await grid0.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRule"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRule coreRuleChild;
|
||||
protected async Task GetChildData(ILoan.Rules.Web.Models.Rules.CoreRule args)
|
||||
{
|
||||
coreRuleChild = args;
|
||||
var CoreRuleCriteriaResult = await RulesService.GetCoreRuleCriteria(new Query { Filter = $@"i => i.RuleID == {args.ID}", Expand = "CoreRule" });
|
||||
if (CoreRuleCriteriaResult != null)
|
||||
{
|
||||
args.CoreRuleCriteria = CoreRuleCriteriaResult.ToList();
|
||||
}
|
||||
var CoreRuleCriteriaOperatorsResult = await RulesService.GetCoreRuleCriteriaOperators(new Query { Filter = $@"i => i.RuleID == {args.ID}", Expand = "CoreRule" });
|
||||
if (CoreRuleCriteriaOperatorsResult != null)
|
||||
{
|
||||
args.CoreRuleCriteriaOperators = CoreRuleCriteriaOperatorsResult.ToList();
|
||||
}
|
||||
}
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriterion coreRuleCriterionCoreRuleCriteria;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleIDCoreRuleCriteria;
|
||||
|
||||
protected RadzenDataGrid<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion> CoreRuleCriteriaDataGrid;
|
||||
|
||||
protected async Task CoreRuleCriteriaAddButtonClick(MouseEventArgs args, ILoan.Rules.Web.Models.Rules.CoreRule data)
|
||||
{
|
||||
|
||||
var dialogResult = await DialogService.OpenAsync<AddCoreRuleCriterion>("Add CoreRuleCriteria", new Dictionary<string, object> { {"RuleID" , data.ID} }, new DialogOptions
|
||||
{
|
||||
Width = "70%"
|
||||
});
|
||||
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaRowSelect(ILoan.Rules.Web.Models.Rules.CoreRuleCriterion args, ILoan.Rules.Web.Models.Rules.CoreRule data)
|
||||
{
|
||||
var dialogResult = await DialogService.OpenAsync<EditCoreRuleCriterion>("Edit CoreRuleCriteria", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaDeleteButtonClick(MouseEventArgs args, ILoan.Rules.Web.Models.Rules.CoreRuleCriterion coreRuleCriterion)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRuleCriterion(coreRuleCriterion.ID);
|
||||
|
||||
await GetChildData(coreRuleChild);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await CoreRuleCriteriaDataGrid.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRuleCriterion"
|
||||
});
|
||||
}
|
||||
}
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator coreRuleCriteriaOperatorCoreRuleCriteriaOperators;
|
||||
|
||||
protected IEnumerable<ILoan.Rules.Web.Models.Rules.CoreRule> coreRulesForRuleIDCoreRuleCriteriaOperators;
|
||||
|
||||
protected RadzenDataGrid<ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator> CoreRuleCriteriaOperatorsDataGrid;
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsAddButtonClick(MouseEventArgs args, ILoan.Rules.Web.Models.Rules.CoreRule data)
|
||||
{
|
||||
|
||||
var dialogResult = await DialogService.OpenAsync<AddCoreRuleCriteriaOperator>("Add CoreRuleCriteriaOperators", new Dictionary<string, object> { {"RuleID" , data.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsRowSelect(ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator args, ILoan.Rules.Web.Models.Rules.CoreRule data)
|
||||
{
|
||||
var dialogResult = await DialogService.OpenAsync<EditCoreRuleCriteriaOperator>("Edit CoreRuleCriteriaOperators", new Dictionary<string, object> { {"ID", args.ID} });
|
||||
await GetChildData(data);
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
}
|
||||
|
||||
protected async Task CoreRuleCriteriaOperatorsDeleteButtonClick(MouseEventArgs args, ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator coreRuleCriteriaOperator)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await DialogService.Confirm("Are you sure you want to delete this record?") == true)
|
||||
{
|
||||
var deleteResult = await RulesService.DeleteCoreRuleCriteriaOperator(coreRuleCriteriaOperator.ID);
|
||||
|
||||
await GetChildData(coreRuleChild);
|
||||
|
||||
if (deleteResult != null)
|
||||
{
|
||||
await CoreRuleCriteriaOperatorsDataGrid.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
NotificationService.Notify(new NotificationMessage
|
||||
{
|
||||
Severity = NotificationSeverity.Error,
|
||||
Summary = $"Error",
|
||||
Detail = $"Unable to delete CoreRuleCriteriaOperator"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
using ILoan.Rules.Web.Services;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace ILoan.Rules.Web.Components.Pages
|
||||
{
|
||||
public partial class EditCoreRule
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected TooltipService TooltipService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected ContextMenuService ContextMenuService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NotificationService NotificationService { get; set; }
|
||||
[Inject]
|
||||
public RulesService RulesService { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int ID { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
coreRule = await RulesService.GetCoreRuleById(ID);
|
||||
}
|
||||
protected bool errorVisible;
|
||||
protected ILoan.Rules.Web.Models.Rules.CoreRule coreRule;
|
||||
|
||||
protected async Task FormSubmit()
|
||||
{
|
||||
try
|
||||
{
|
||||
coreRule.Update += 1;
|
||||
await RulesService.UpdateCoreRule(ID, coreRule);
|
||||
DialogService.Close(coreRule);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task CancelButtonClick(MouseEventArgs args)
|
||||
{
|
||||
DialogService.Close(null);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ILoan.Rules.Web.Data
|
||||
{
|
||||
public class BlankTriggerAddingConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention
|
||||
{
|
||||
public virtual void ProcessModelFinalizing(
|
||||
Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionModelBuilder modelBuilder,
|
||||
Microsoft.EntityFrameworkCore.Metadata.Conventions.IConventionContext<Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionModelBuilder> context)
|
||||
{
|
||||
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
|
||||
{
|
||||
var table = Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier.Create(entityType, Microsoft.EntityFrameworkCore.Metadata.StoreObjectType.Table);
|
||||
if (table != null
|
||||
&& entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(table.Value) == null))
|
||||
{
|
||||
entityType.Builder.HasTrigger(table.Value.Name + "_Trigger");
|
||||
}
|
||||
|
||||
foreach (var fragment in entityType.GetMappingFragments(Microsoft.EntityFrameworkCore.Metadata.StoreObjectType.Table))
|
||||
{
|
||||
if (entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(fragment.StoreObject) == null))
|
||||
{
|
||||
entityType.Builder.HasTrigger(fragment.StoreObject.Name + "_Trigger");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ILoan.Rules.Web.Data
|
||||
{
|
||||
public partial class RulesContext : DbContext
|
||||
{
|
||||
public RulesContext()
|
||||
{
|
||||
}
|
||||
|
||||
public RulesContext(DbContextOptions<RulesContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
partial void OnModelBuilding(ModelBuilder builder);
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator>()
|
||||
.HasOne(i => i.CoreRule)
|
||||
.WithMany(i => i.CoreRuleCriteriaOperators)
|
||||
.HasForeignKey(i => i.RuleID)
|
||||
.HasPrincipalKey(i => i.ID);
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion>()
|
||||
.HasOne(i => i.CoreRule)
|
||||
.WithMany(i => i.CoreRuleCriteria)
|
||||
.HasForeignKey(i => i.RuleID)
|
||||
.HasPrincipalKey(i => i.ID);
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRule>()
|
||||
.Property(p => p.UseLastRecord)
|
||||
.HasDefaultValueSql(@"true");
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion>()
|
||||
.Property(p => p.ValueIsProperty)
|
||||
.HasDefaultValueSql(@"false");
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion>()
|
||||
.Property(p => p.ReturnCount)
|
||||
.HasDefaultValueSql(@"false");
|
||||
|
||||
builder.Entity<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion>()
|
||||
.Property(p => p.IsThresholdCriterium)
|
||||
.HasDefaultValueSql(@"false");
|
||||
this.OnModelBuilding(builder);
|
||||
}
|
||||
|
||||
public DbSet<ILoan.Rules.Web.Models.Rules.CoreRuleCriteriaOperator> CoreRuleCriteriaOperators { get; set; }
|
||||
|
||||
public DbSet<ILoan.Rules.Web.Models.Rules.CoreRule> CoreRules { get; set; }
|
||||
|
||||
public DbSet<ILoan.Rules.Web.Models.Rules.CoreRuleCriterion> CoreRuleCriteria { get; set; }
|
||||
|
||||
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||
{
|
||||
configurationBuilder.Conventions.Add(_ => new BlankTriggerAddingConvention());
|
||||
}
|
||||
}
|
||||
}
|
62
src/iLoan.Rules.Web/Domain/Entities/CoreRule.cs
Normal file
62
src/iLoan.Rules.Web/Domain/Entities/CoreRule.cs
Normal file
@ -0,0 +1,62 @@
|
||||
namespace ILoan.Tools.Domain.Entities;
|
||||
|
||||
[Table("Core_Rules", Schema = "core")]
|
||||
public partial class CoreRule
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
public string RuleName { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Source { get; set; }
|
||||
|
||||
public decimal? DefaultThreshold { get; set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public bool TriggersManualReview { get; set; }
|
||||
|
||||
public string SuggestedResolution { get; set; }
|
||||
|
||||
public string TriggerReason { get; set; }
|
||||
|
||||
public bool? UseLastRecord { get; set; }
|
||||
|
||||
public string ApplicantType { get; set; }
|
||||
|
||||
public string FilterOnClickthrough { get; set; }
|
||||
|
||||
public string RunBeforeStatus { get; set; }
|
||||
|
||||
public string DisplaySection { get; set; }
|
||||
|
||||
public string WarningField { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DutchRuleName { get; set; }
|
||||
|
||||
public string DutchTriggerReason { get; set; }
|
||||
|
||||
public string DutchSuggestedResolution { get; set; }
|
||||
|
||||
public string DutchFilterOnClickthrough { get; set; }
|
||||
|
||||
public string RuleExplanation { get; set; }
|
||||
|
||||
public string DutchRuleExplanation { get; set; }
|
||||
|
||||
public int? WorkItemId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public int Update { get; set; }
|
||||
|
||||
public string Scope { get; set; }
|
||||
|
||||
public ICollection<CoreRuleCriterion> CoreRuleCriteria { get; set; } = [];
|
||||
|
||||
public ICollection<CoreRuleCriteriaOperator> CoreRuleCriteriaOperators { get; set; } = [];
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
namespace ILoan.Tools.Domain.Entities;
|
||||
|
||||
[Table("Core_RuleCriteriaOperator", Schema = "core")]
|
||||
public partial class CoreRuleCriteriaOperator
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int? RuleID { get; set; }
|
||||
|
||||
public CoreRule CoreRule { get; set; }
|
||||
|
||||
[Column("Operator")]
|
||||
public string Operator1 { get; set; }
|
||||
|
||||
|
||||
public int Update { get; set; } = 0;
|
||||
}
|
28
src/iLoan.Rules.Web/Domain/Entities/CoreRuleCriterion.cs
Normal file
28
src/iLoan.Rules.Web/Domain/Entities/CoreRuleCriterion.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace ILoan.Tools.Domain.Entities;
|
||||
|
||||
[Table("Core_RuleCriteria", Schema = "core")]
|
||||
public partial class CoreRuleCriterion
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int? RuleID { get; set; }
|
||||
|
||||
public CoreRule CoreRule { get; set; }
|
||||
|
||||
public string Property { get; set; }
|
||||
|
||||
public string Comparison { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool? ValueIsProperty { get; set; }
|
||||
|
||||
public bool? ReturnCount { get; set; }
|
||||
|
||||
public bool? IsThresholdCriterium { get; set; }
|
||||
|
||||
|
||||
public int Update { get; set; }
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ILoan.Rules.Web.Models.Enums;
|
||||
namespace ILoan.Tools.Domain.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// The comparison to apply to the rule value.
|
59
src/iLoan.Rules.Web/Domain/RulesContext.cs
Normal file
59
src/iLoan.Rules.Web/Domain/RulesContext.cs
Normal file
@ -0,0 +1,59 @@
|
||||
namespace ILoan.Tools.Domain;
|
||||
|
||||
public partial class RulesContext : DbContext
|
||||
{
|
||||
public RulesContext()
|
||||
{
|
||||
}
|
||||
|
||||
public RulesContext(DbContextOptions<RulesContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
partial void OnModelBuilding(ModelBuilder builder);
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.Entity<CoreRuleCriteriaOperator>()
|
||||
.HasOne(i => i.CoreRule)
|
||||
.WithMany(i => i.CoreRuleCriteriaOperators)
|
||||
.HasForeignKey(i => i.RuleID)
|
||||
.HasPrincipalKey(i => i.ID);
|
||||
|
||||
builder.Entity<CoreRuleCriterion>()
|
||||
.HasOne(i => i.CoreRule)
|
||||
.WithMany(i => i.CoreRuleCriteria)
|
||||
.HasForeignKey(i => i.RuleID)
|
||||
.HasPrincipalKey(i => i.ID);
|
||||
|
||||
builder.Entity<CoreRule>()
|
||||
.Property(p => p.UseLastRecord)
|
||||
.HasDefaultValueSql(@"true");
|
||||
|
||||
builder.Entity<CoreRuleCriterion>()
|
||||
.Property(p => p.ValueIsProperty)
|
||||
.HasDefaultValueSql(@"false");
|
||||
|
||||
builder.Entity<CoreRuleCriterion>()
|
||||
.Property(p => p.ReturnCount)
|
||||
.HasDefaultValueSql(@"false");
|
||||
|
||||
builder.Entity<CoreRuleCriterion>()
|
||||
.Property(p => p.IsThresholdCriterium)
|
||||
.HasDefaultValueSql(@"false");
|
||||
this.OnModelBuilding(builder);
|
||||
}
|
||||
|
||||
public DbSet<CoreRuleCriteriaOperator> CoreRuleCriteriaOperators { get; set; }
|
||||
|
||||
public DbSet<CoreRule> CoreRules { get; set; }
|
||||
|
||||
public DbSet<CoreRuleCriterion> CoreRuleCriteria { get; set; }
|
||||
|
||||
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||
{
|
||||
configurationBuilder.Conventions.Add(_ => new BlankTriggerAddingConvention());
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
namespace ILoan.Tools.Domain.Triggers;
|
||||
|
||||
public class BlankTriggerAddingConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention
|
||||
{
|
||||
public virtual void ProcessModelFinalizing(
|
||||
Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionModelBuilder modelBuilder,
|
||||
Microsoft.EntityFrameworkCore.Metadata.Conventions.IConventionContext<Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionModelBuilder> context)
|
||||
{
|
||||
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
|
||||
{
|
||||
var table = Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier.Create(entityType, Microsoft.EntityFrameworkCore.Metadata.StoreObjectType.Table);
|
||||
if (table != null
|
||||
&& entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(table.Value) == null))
|
||||
{
|
||||
entityType.Builder.HasTrigger(table.Value.Name + "_Trigger");
|
||||
}
|
||||
|
||||
foreach (var fragment in entityType.GetMappingFragments(Microsoft.EntityFrameworkCore.Metadata.StoreObjectType.Table))
|
||||
{
|
||||
if (entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(fragment.StoreObject) == null))
|
||||
{
|
||||
entityType.Builder.HasTrigger(fragment.StoreObject.Name + "_Trigger");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
src/iLoan.Rules.Web/GlobalUsings.cs
Normal file
19
src/iLoan.Rules.Web/GlobalUsings.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// Global using directives
|
||||
|
||||
global using ILoan.Tools.Domain;
|
||||
global using ILoan.Tools.Domain.Entities;
|
||||
global using ILoan.Tools.Domain.Enums;
|
||||
global using ILoan.Tools.Infrastructure.Services;
|
||||
global using Microsoft.AspNetCore.Components;
|
||||
global using Microsoft.AspNetCore.Components.Web;
|
||||
global using Microsoft.EntityFrameworkCore;
|
||||
global using Microsoft.JSInterop;
|
||||
global using Radzen;
|
||||
global using Radzen.Blazor;
|
||||
global using System.ComponentModel;
|
||||
global using System.ComponentModel.DataAnnotations;
|
||||
global using System.ComponentModel.DataAnnotations.Schema;
|
||||
global using System.Linq.Dynamic.Core;
|
||||
global using System.Text.Encodings.Web;
|
||||
global using ILoan.Tools.Domain.Triggers;
|
||||
global using EnumExtensions = ILoan.Tools.Infrastructure.Extensions.EnumExtensions;
|
@ -2,8 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.0.0
|
||||
MinimumVisualStudioVersion = 17.0.0.0
|
||||
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILoan.Rules.Web", "ILoan.Rules.Web.csproj", "{E9962792-F259-417D-9699-6283FE80DB7C}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILoan.Tools", "ILoan.Tools.csproj", "{E9962792-F259-417D-9699-6283FE80DB7C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace ILoan.Rules.Web.Extensions;
|
||||
namespace ILoan.Tools.Infrastructure.Extensions;
|
||||
|
||||
public static class EnumExtensions
|
||||
{
|
@ -1,12 +1,13 @@
|
||||
using System.Text;
|
||||
|
||||
namespace ILoan.Rules.Web.Services;
|
||||
namespace ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
public class RuleFileGeneratorService(RulesContext context, IConfiguration configuration)
|
||||
{
|
||||
private readonly int _startRuleId = configuration.GetValue<int>("Parameters:StartRuleId");
|
||||
private int _startSeq = configuration.GetValue<int>("Parameters:StartSeqNo");
|
||||
private readonly string _root = configuration.GetValue<string>("Parameters:GeneratorRoot");
|
||||
private readonly string _workitem = configuration.GetValue<string>("Parameters:Workitem");
|
||||
|
||||
public async Task GenerateRuleFilesAsync()
|
||||
{
|
||||
@ -22,7 +23,7 @@ public class RuleFileGeneratorService(RulesContext context, IConfiguration confi
|
||||
.Where(rule => rule.ID >= _startRuleId)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var rule in rules.Where(r => r.ID is >= 511 and <= 513).OrderBy(x => x.ID))
|
||||
foreach (var rule in rules.Where(r => _workitem.Contains(r.WorkItemId.ToString())).OrderBy(x => x.ID))
|
||||
{
|
||||
var fileName = $"V2.{_startSeq:000}__{rule.WorkItemId}_Rules_{rule.ID}_{rule.Title}.sql";
|
||||
|
||||
@ -50,7 +51,7 @@ INSERT INTO core.""Core_Rules"" (
|
||||
""ID"", ""RuleName"", ""Source"", ""DefaultThreshold"", ""Blocked"", ""TriggersManualReview"",
|
||||
""SuggestedResolution"", ""TriggerReason"", ""UseLastRecord"", ""ApplicantType"", ""FilterOnClickthrough"",
|
||||
""RunBeforeStatus"", ""DisplaySection"", ""WarningField"", ""DutchRuleName"", ""DutchTriggerReason"",
|
||||
""DutchSuggestedResolution"", ""DutchFilterOnClickthrough"", ""RuleExplanation"", ""DutchRuleExplanation""
|
||||
""DutchSuggestedResolution"", ""DutchFilterOnClickthrough"", ""RuleExplanation"", ""DutchRuleExplanation"", ""Scope""
|
||||
) OVERRIDING SYSTEM VALUE VALUES (
|
||||
{rule.ID}, '{EscapeSingleQuote(rule.RuleName)}', '{EscapeSingleQuote(rule.Source)}', {rule.DefaultThreshold?.ToString() ?? "NULL"},
|
||||
{rule.Blocked.ToString().ToUpper()}, {rule.TriggersManualReview.ToString().ToUpper()}, '{EscapeSingleQuote(rule.SuggestedResolution)}',
|
||||
@ -58,7 +59,7 @@ INSERT INTO core.""Core_Rules"" (
|
||||
'{EscapeSingleQuote(rule.FilterOnClickthrough)}', '{EscapeSingleQuote(rule.RunBeforeStatus)}', '{EscapeSingleQuote(rule.DisplaySection)}',
|
||||
'{EscapeSingleQuote(rule.WarningField)}', '{EscapeSingleQuote(rule.DutchRuleName)}', '{EscapeSingleQuote(rule.DutchTriggerReason)}',
|
||||
'{EscapeSingleQuote(rule.DutchSuggestedResolution)}', '{EscapeSingleQuote(rule.DutchFilterOnClickthrough)}',
|
||||
'{EscapeSingleQuote(rule.RuleExplanation)}', '{EscapeSingleQuote(rule.DutchRuleExplanation)}'
|
||||
'{EscapeSingleQuote(rule.RuleExplanation)}', '{EscapeSingleQuote(rule.DutchRuleExplanation)}', '{EscapeSingleQuote(rule.Scope)}'
|
||||
);
|
||||
");
|
||||
|
||||
@ -111,7 +112,8 @@ SET
|
||||
""DutchSuggestedResolution"" = '{EscapeSingleQuote(rule.DutchSuggestedResolution)}',
|
||||
""DutchFilterOnClickthrough"" = '{EscapeSingleQuote(rule.DutchFilterOnClickthrough)}',
|
||||
""RuleExplanation"" = '{EscapeSingleQuote(rule.RuleExplanation)}',
|
||||
""DutchRuleExplanation"" = '{EscapeSingleQuote(rule.DutchRuleExplanation)}'
|
||||
""DutchRuleExplanation"" = '{EscapeSingleQuote(rule.DutchRuleExplanation)}',
|
||||
""Scope"" = '{EscapeSingleQuote(rule.Scope)}'
|
||||
WHERE ""ID"" = {rule.ID};
|
||||
");
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace ILoan.Rules.Web.Services;
|
||||
namespace ILoan.Tools.Infrastructure.Services;
|
||||
|
||||
public partial class RulesService(IDbContextFactory<RulesContext> factory, NavigationManager navigationManager)
|
||||
{
|
@ -1,66 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ILoan.Rules.Web.Models.Rules
|
||||
{
|
||||
[Table("Core_Rules", Schema = "core")]
|
||||
public partial class CoreRule
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
public string RuleName { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Source { get; set; }
|
||||
|
||||
public decimal? DefaultThreshold { get; set; }
|
||||
|
||||
public bool Blocked { get; set; }
|
||||
|
||||
public bool TriggersManualReview { get; set; }
|
||||
|
||||
public string SuggestedResolution { get; set; }
|
||||
|
||||
public string TriggerReason { get; set; }
|
||||
|
||||
public bool? UseLastRecord { get; set; }
|
||||
|
||||
public string ApplicantType { get; set; }
|
||||
|
||||
public string FilterOnClickthrough { get; set; }
|
||||
|
||||
public string RunBeforeStatus { get; set; }
|
||||
|
||||
public string DisplaySection { get; set; }
|
||||
|
||||
public string WarningField { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DutchRuleName { get; set; }
|
||||
|
||||
public string DutchTriggerReason { get; set; }
|
||||
|
||||
public string DutchSuggestedResolution { get; set; }
|
||||
|
||||
public string DutchFilterOnClickthrough { get; set; }
|
||||
|
||||
public string RuleExplanation { get; set; }
|
||||
|
||||
public string DutchRuleExplanation { get; set; }
|
||||
|
||||
public decimal? WorkItemId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public int Update { get; set; }
|
||||
|
||||
public ICollection<CoreRuleCriterion> CoreRuleCriteria { get; set; } = [];
|
||||
|
||||
public ICollection<CoreRuleCriteriaOperator> CoreRuleCriteriaOperators { get; set; } = [];
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ILoan.Rules.Web.Models.Rules
|
||||
{
|
||||
[Table("Core_RuleCriteriaOperator", Schema = "core")]
|
||||
public partial class CoreRuleCriteriaOperator
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int? RuleID { get; set; }
|
||||
|
||||
public CoreRule CoreRule { get; set; }
|
||||
|
||||
[Column("Operator")]
|
||||
public string Operator1 { get; set; }
|
||||
|
||||
|
||||
public int Update { get; set; } = 0;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ILoan.Rules.Web.Models.Rules
|
||||
{
|
||||
[Table("Core_RuleCriteria", Schema = "core")]
|
||||
public partial class CoreRuleCriterion
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int? RuleID { get; set; }
|
||||
|
||||
public CoreRule CoreRule { get; set; }
|
||||
|
||||
public string Property { get; set; }
|
||||
|
||||
public string Comparison { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool? ValueIsProperty { get; set; }
|
||||
|
||||
public bool? ReturnCount { get; set; }
|
||||
|
||||
public bool? IsThresholdCriterium { get; set; }
|
||||
|
||||
|
||||
public int Update { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
using ILoan.Rules.Web.Components;
|
||||
using ILoan.Rules.Web.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents().AddInteractiveServerComponents().AddHubOptions(options => options.MaximumReceiveMessageSize = 10 * 1024 * 1024);
|
||||
@ -9,7 +6,7 @@ builder.Services.AddRadzenComponents();
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddScoped<RulesService>();
|
||||
builder.Services.AddScoped<RuleFileGeneratorService>();
|
||||
builder.Services.AddDbContextFactory<ILoan.Rules.Web.Data.RulesContext>(options =>
|
||||
builder.Services.AddDbContextFactory<RulesContext>(options =>
|
||||
{
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("RulesConnection"));
|
||||
});
|
||||
@ -26,5 +23,5 @@ app.UseHttpsRedirection();
|
||||
app.MapControllers();
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
|
||||
app.MapRazorComponents<ILoan.Tools.Application.App>().AddInteractiveServerRenderMode();
|
||||
app.Run();
|
@ -8,7 +8,7 @@
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"ILoan.Rules.Web": {
|
||||
"ILoan.Tools": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
|
@ -1,11 +0,0 @@
|
||||
// Global using directives
|
||||
|
||||
global using ILoan.Rules.Web.Data;
|
||||
global using ILoan.Rules.Web.Extensions;
|
||||
global using ILoan.Rules.Web.Models.Enums;
|
||||
global using ILoan.Rules.Web.Models.Rules;
|
||||
global using Microsoft.AspNetCore.Components;
|
||||
global using Microsoft.EntityFrameworkCore;
|
||||
global using Radzen;
|
||||
global using System.Linq.Dynamic.Core;
|
||||
global using System.Text.Encodings.Web;
|
@ -18,7 +18,8 @@
|
||||
},
|
||||
"Parameters": {
|
||||
"GeneratorRoot": "C:\\iloan\\iloan-base-dev\\migrations",
|
||||
"StartSeqNo": 137,
|
||||
"StartRuleId": 480
|
||||
"StartSeqNo": 156,
|
||||
"StartRuleId": 480,
|
||||
"Workitem": "3262"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user