-
Notifications
You must be signed in to change notification settings - Fork 62
/
telco-rating.ruleml.ccb
40 lines (31 loc) · 1.09 KB
/
telco-rating.ruleml.ccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace NxBRE.Examples
{
using System;
using System.Collections;
using NxBRE.InferenceEngine;
using NxBRE.InferenceEngine.IO;
using NxBRE.InferenceEngine.Rules;
public class TelcoRatingBinder:AbstractBinder {
public TelcoRatingBinder():base(BindingTypes.Control) {}
public override void ControlProcess() {
foreach(CallData cd in (ArrayList)BusinessObjects["CALLSDATA"]) {
IEF.NewWorkingMemory(WorkingMemoryTypes.Isolated);
IEF.AssertNewFactOrFail("Hour", cd, cd.Time.Hour);
IEF.AssertNewFactOrFail("Type", cd, cd.Type);
IEF.AssertNewFactOrFail("Destination", cd, cd.Destination);
IEF.AssertNewFactOrFail("Client Scheme", cd, cd.ClientScheme);
IEF.Process();
IEF.DisposeIsolatedMemory();
}
}
public override NewFactEvent OnNewFact {
get {
return new NewFactEvent(NewFactHandler);
}
}
private void NewFactHandler(NewFactEventArgs nfea) {
if (nfea.Fact.Type == "Rating Scheme")
((CallData)nfea.Fact.GetPredicateValue(0)).RatingScheme = (string)nfea.Fact.GetPredicateValue(1);
}
}
}