Beispiel #1
0
		public IBRE NewBRE() {
			if (bref == null)
				throw new BREException("BRECloneFactory is not correctly initialized.");

			if (bre == null)
				bre = bref.NewBRE(rulesDriver);
			
			if (bre == null)
				throw new BREException("BRECloneFactory could not instantiate an valid IBRE implementation.");
			
			return (IBRE)bre.Clone();
		}
Beispiel #2
0
		public CalculateTotal(string aXMLFile, int errorLevel, int logLevel)
		{
			bre = new BREFactoryConsole(errorLevel, logLevel).NewBRE(new XBusinessRulesFileDriver(aXMLFile));
			if (bre == null) throw new Exception("BRE Not Properly Initialized!");
			
			bre.RuleContext.SetFactory(APPLIED_DISCOUNT,
			    						           new BRERuleFactory(new ExecuteRuleDelegate(AppliedDiscount)));
			
			// example on how to export native rules file
			FileStream fs = new FileStream("discount.bre", FileMode.Create);
			Misc.IdentityXSLT.Transform(bre.XmlDocumentRules, null, fs, null);
			fs.Flush();
			fs.Close();
		}
Beispiel #3
0
		/// <summary>This is what your code would call to check the login
		/// </summary>
		public virtual bool checkLogin(IBRE aBRE)
		{
			aBRE.Process();
			return lockLogin;
		}
Beispiel #4
0
		private void Init(IRulesDriver driver) {
			bre = new BREFactory(new DispatchException(HandleExceptionEvent)).NewBRE(driver);
			
			if (bre == null)
				throw new BREException("The initialization of the Flow Engine Binder failed.");
		}
Beispiel #5
0
		// private methods ------------------------------------------------------
		
		private void NewWorkingBRE() {
			working_bre = (IBRE)prepared_bre.Clone();
		}
		/// <summary>
		/// </summary>
		public void Initialise(RunAt runat, string rulesXml, string objectsXml)
		{
			try
			{

				if (m_CachedActions != null && m_CachedActions.Count > 0)
					m_CachedActions = new CachedActions();

				if (m_PolicySetCache == null || !m_PolicySetCache.IsAlreadyCached(rulesXml, objectsXml))
				{
					m_PolicySetCache = new PolicySetCache(rulesXml, objectsXml);

					CurrentRunAtMode = runat;
					LoadObjectsTable(objectsXml);
				}

				m_NxBre = GetBREForRules(rulesXml);

				LoadPresetActionsInfo(rulesXml);
				InitialiseObjects();
				InitialiseFactories();
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
				m_CachedActions = null;
				m_PolicySetCache = null;
				m_NxBre = null;
				throw ex;
			}
		}