Beispiel #1
0
        public EmailForm()
        {
            InitializeComponent();
            comboLanguage.SelectedIndex = 0;

            _validator = RuntimeEngine.FromXml(File.OpenRead("LocalisedValidationRule.xml"));
            // Prepare engine for different culture messaging
            _validator.OnRunning = (eng) => SetupLocalisation(eng.ExecutorSetup);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var app = new Program();
            var eng = RuntimeEngine.FromXml(File.OpenRead("ApplicationWorkflow.xml"));

            app.AskOptions(eng, new Application());

            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var app = new Program();
            var eng = RuntimeEngine.FromXml(File.OpenRead("LetterWorkflow.xml"));

            app.AskUserForDetails(eng, new Letter());

            Console.ReadLine();
        }
Beispiel #4
0
        private static void DinkingUsingValidation()
        {
            Console.WriteLine("Drinking regulation using Validation Tree...");
            var engine = RuntimeEngine.FromXml(File.OpenRead("DrinkingValidation.xml"));

            Check_Young_Female(engine);
            Check_Adult_Female(engine);
            Check_Adult_Pregnant_Female(engine);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var app = new Program();
            var eng = RuntimeEngine.FromXml(File.OpenRead("VotingWorkflow.xml"));

            eng.Workflow.Registry.AddService <ITaskService>(new TaskRepository());
            eng.Workflow.Registry.AddService <IDirectoryService>(new UserRepository());
            app.Vote(eng);

            Console.ReadLine();
        }
Beispiel #6
0
        private static void RunFromFileAddress()
        {
            var engine = RuntimeEngine.FromXml(File.OpenRead("CarsDiscountFlow.xml"));
            var result = engine.Run(ConnectionString);
            var cars   = result.Context.VariableContainer["cars"] as IEnumerable;

            foreach (IDictionary <string, object> car in cars)
            {
                Console.WriteLine("{0} {1} {2} Discount: {3}", car["Made"], car["Model"], car["Year"], car["Discount"]);
            }
        }
Beispiel #7
0
 private static void BuildDiscountDecision()
 {
     DiscountDecision = RuntimeEngine.FromXml(InMemoryFileStore.GetByName("DiscountDecision.xml").AsBytes());
     // Capture events
     DiscountDecision.Events = EventNames.All;
     // registering custom function
     DiscountDecision.RegisterFunction(typeof(AgeExtensions));
     // build validation plan for executing decision table
     // Creates a reader to access an excel file
     DiscountDecision.Entries.Add("Y", "true", true);
     DiscountDecision.Entries.Add("N", "false", true);
 }
Beispiel #8
0
        private static void RunByXmlDecisionTable()
        {
            Console.WriteLine("Decision table using XML...");
            // Loading decision table from excel document
            IRuntimeEngine engine = RuntimeEngine.FromXml(File.OpenRead("AgeTitle.xml"), "Sheet1");

            // set events to be captured
            engine.EnableFullLog = true;

            // executing the decision table
            ExecuteDecisionTable(engine);
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            // initializing License for faster execution
            // so the other parts of framework will work with the
            // initialized license during execution
            FlexRule.License.UserLicense.Initialize();

            var p      = new Program();
            var engine = RuntimeEngine.FromXml(File.OpenRead(RulePath));

            p.RunEngine(engine);

            Console.ReadLine();
        }
Beispiel #10
0
        private static void ValidatePersonIdentity_StructuredRoutine()
        {
            var engine = RuntimeEngine.FromXml(File.OpenRead("PersonRule.nl"));

            var per    = GetPerson();
            var result = engine.Run(new RunParameter("person has identity"), per);

            if (!result.Outcome.Value)
            {
                // Check errors
                foreach (var notice in result.Context.Notifications.Default.Notices)
                {
                    Console.WriteLine("{0}: {1}", notice.Message, notice.Tag);
                }
            }
        }
Beispiel #11
0
        static void Main()
        {
            License.UserLicense.Initialize();

            // This rule loads data from access file so make sure you have the driver installed
            // download it (ACE engine) from: http://www.microsoft.com/download/en/details.aspx?id=13255
            var engine = RuntimeEngine.FromXml(File.OpenRead("ReadMsAccessData.xml"));
            var result = engine.Run();

            // list variable contains rows
            var list = (IList <FlexRule.Data.IMetaObject>)result.Context.VariableContainer["list"];

            foreach (var obj in list)
            {
                string [] allProperties = obj.GetProperties();
                foreach (string p in allProperties)
                {
                    Console.WriteLine("{0}={1}", p, obj.GetValue(p));
                }

                Console.WriteLine();
            }
        }
Beispiel #12
0
 private static void BuildValidator()
 {
     InputValidator = RuntimeEngine.FromXml(InMemoryFileStore.GetByName("inputValidator.xml").AsBytes());
 }