public void InstantiateRuleList(string path) { var file = new FileInfo(path); var json = File.ReadAllText(file.FullName); var activeRuleSets = RuleInstantiations.ParseRuleSets(ref json); var ruleSet = new RuleList { RuleSets = activeRuleSets }; }
private HttpResponseMessage RunRulesPost() { var value = Request.Content.ReadAsStringAsync().Result; var startTime = DateTime.Now; string json; var errorMessages = new List <ExpandoObject>(); var destDataRows = new List <ExpandoObject>(); if (Request.Content.Headers.ContentType.ToString().ToLower() == "application/json") { json = value; value = null; } else { var httpResponseMessage = new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = "This API accepts Content-Type [application/json] only." }; throw new HttpResponseException(httpResponseMessage); } var activeRuleSets = RuleInstantiations.ParseRuleSets(ref json); var count = GetRuleCount(activeRuleSets); var ruleList = new RuleList { RuleSets = activeRuleSets }; var propertyObject = RuleInstantiations.ParseDataSet(ref json); json = null; IdentityUtil.AddIdentities(ref propertyObject); destDataRows = IterateGeneralRules(ref propertyObject, ruleList, ref destDataRows, ref errorMessages); destDataRows = IterateErrorCheckRules(ref destDataRows, ruleList, ref errorMessages); IdentityUtil.RemoveIdentities(ref destDataRows); var parsed = BuildResponse(ref errorMessages, ref destDataRows); var response = Request.CreateResponse(HttpStatusCode.OK); var endTime = DateTime.Now; var diff = endTime - startTime; response.Content = new StringContent(parsed.ToString(), Encoding.UTF8, "application/json"); AddHeaders(response, diff, ref propertyObject, ref destDataRows, count); Debug.WriteLine("End of call to " + this.GetType().Name + ". " + System.Reflection.MethodBase.GetCurrentMethod().Name + "."); return(response); }