-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Here's the generated SQL:
SELECT [ta0_psr].[ProSupportRuleKey],
[ta0_psr].[Type],
[ta0_psr].[RuleFlag],
[ta0_psr].[Context],
[ta0_psr].[Requirement],
[ta0_psr].[Classification],
[ta0_psr].[DocumentCategory],
[ta0_psr].[FieldCategory],
[ta0_psr].[RuleMccCode],
[ta0_psr].[Title],
[ta0_psr].[Details],
[ta0_psr].[AdditionalInformation],
[ta0_psr].[Reason],
[ta0_psr].[IsNoteRequired],
[ta0_psr].[IsForFirstData],
[ta0_psr].[IsForGlobalPayments],
[ta0_psr].[IsForValitor]
FROM [app].[PRO_SUPPORT_RULES_LUT] AS ta0_psr
WHERE r.[isForFirstData] = @isForFirstData
AND r.[isForGlobalPayments] = @isForGlobalPayments
AND r.[isForValitor] = @isForValitor
;Here's the code that results in the above FrankenSQL:
[Table("[app].[PRO_SUPPORT_RULES_LUT]"), ReferenceData]
public class ProSupportRule
{
[PrimaryKey]
public int? ProSupportRuleKey { get; set; }
public RuleType Type { get; set; }
public RuleStatementFlag RuleFlag { get; set; }
public RuleContext Context { get; set; }
public RuleRequirement Requirement { get; set; }
public RuleClassification Classification { get; set; }
public DocumentCategoryEnum DocumentCategory { get; set; }
public HighlightFieldEnum? FieldCategory { get; set; }
public int? RuleMccCode { get; set; }
public string Title { get; set; }
public string Details { get; set; }
public string AdditionalInformation { get; set; }
public string Reason { get; set; }
public bool IsNoteRequired { get; set; }
public bool IsForFirstData { get; set; }
public bool IsForGlobalPayments { get; set; }
public bool IsForValitor { get; set; }
private string _ruleFireReason;
[SimpleSaveIgnore, SimpleLoadIgnore]
public bool HasFired { get; set; }
[SimpleSaveIgnore, SimpleLoadIgnore]
public string RuleFireReason
{
get
{
if (string.IsNullOrEmpty(_ruleFireReason))
{
_ruleFireReason = RuleFlag.GetDescriptions();
}
return _ruleFireReason;
}
}
}
...
...
public IEnumerable<ProSupportRule> GetAllRules(ApplicationDetailsDto application)
{
var whereClause = "";
switch (application.Acquirer)
{
case AppAcquirerEnum.FDMS:
whereClause = "r.[IsForFirstData] = @isForFirstData";
break;
case AppAcquirerEnum.Global:
whereClause = "r.[IsForGlobalPayments] = @isForGlobalPayments";
break;
case AppAcquirerEnum.Valitor:
whereClause = "r.[IsForValitor] = @isForValitor";
break;
}
var allRules = Execute(conn => conn.AutoQuery<ProSupportRule>(
new [] { "r" },
whereClause,
new
{
isForFirstData = application.Acquirer == AppAcquirerEnum.FDMS,
isForGlobalPayments = application.Acquirer == AppAcquirerEnum.Global,
isForValitor = application.Acquirer == AppAcquirerEnum.Valitor
}));
return allRules;
}
'''Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels