public ActionResult CreateNew(string type) { AnalyzeRule rule = null; if (type.ToLowerInvariant() == "maxtimes") { rule = new MaxAmountOfFailuresRule(); } else if (type.ToLowerInvariant() == "percent") { rule = new FailurePercentRule(); } ViewBag.buttonText = "Insert"; return(View("ruleview", rule)); }
static void Main(string[] args) { var docdb = new DocumentDBRuleStorage(ConfigurationManager.AppSettings["DocDBEndPointUrl"], ConfigurationManager.AppSettings["AuthorizationKey"], ConfigurationManager.AppSettings["RuleDatabaseId"], ConfigurationManager.AppSettings["RuleCollectionId"]); var rules = new MaxAmountOfFailuresRule(); rules.ProgramName = "Eventpump.vshost.exe"; rules.RuleName = "TestRule001"; rules.KeepOperationInPileTime = new TimeSpan(0, 30, 0); rules.MaxTimesFailureAllowed = 10; var rs = new FailurePercentRule(); rs.ProgramName = "Eventpump.vshost.exe"; rs.RuleName = "TestRule002"; rs.KeepOperationInPileTime = new TimeSpan(0, 30, 0); rs.MaxFailurePercent = 80; rs.MinimumAmountOfOperationsBeforeRuleCanBeTriggered = 20; var f = 99; }