public JsonResult Calculate(int customerId, string pricingModelModel) { var oLog = new SafeILog(this); oLog.Debug("Model received: {0}", pricingModelModel); PricingModelModel inputModel = JsonConvert.DeserializeObject <PricingModelModel>(pricingModelModel); oLog.Debug("Parsed model: {0}", JsonConvert.SerializeObject(inputModel)); PricingModelModelActionResult pricingModelCalculateResponse = this.serviceClient.Instance.PricingModelCalculate(customerId, this.context.UserId, inputModel); oLog.Debug("Calculated model: {0}", JsonConvert.SerializeObject(pricingModelCalculateResponse.Value)); return(Json(pricingModelCalculateResponse.Value, JsonRequestBehavior.AllowGet)); } // Calculate
public JsonResult Index(int id, bool getFromLog = false, long?logId = null) { var log = new SafeILog(this); log.Debug("Loading a credit bureau model for customer {0}, getFromLog = {1}, logId = {2}.", id, getFromLog, logId); var customer = _customers.Get(id); var model = _creditBureauModelBuilder.Create(customer, getFromLog, logId); return(Json(model, JsonRequestBehavior.AllowGet)); }
} // Usage private Program(string[] args) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; m_aryArgs = args; m_oEnv = null; try { m_oEnv = new Ezbob.Context.Environment(); } catch (Exception e) { throw new NullReferenceException("Failed to determine current environment.", e); } // try var oLog4NetCfg = new Log4Net(m_oEnv).Init(); m_oLog = new SafeILog(this); NotifyStartStop("started"); m_oLog.Debug("Current environment: {0}", m_oEnv.Context); m_oLog.Debug("Error emails will be sent to: {0}", oLog4NetCfg.ErrorMailRecipient); m_oLog.Debug("ServicePointManager.SecurityProtocol = {0}", ServicePointManager.SecurityProtocol); NHibernateManager.FluentAssemblies.Add(typeof(User).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(Customer).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(eBayDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(AmazonDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(PayPalDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(EkmDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(DatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(YodleeDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(PayPointDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(FreeAgentDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(SageDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(CompanyFilesDatabaseMarketPlace).Assembly); } // constructor
} // Get public Customer ReallyTryGet(int clientId) { try { return Get(clientId); } catch (Exception e) { var oLog = new SafeILog(this); oLog.Warn(e, "Could not retrieve customer by id {0}.", clientId); var os = new StringBuilder(); StackTrace st = new StackTrace(true); for (int i = 0; i < st.FrameCount; i++) { StackFrame sf = st.GetFrame(i); os.AppendFormat("{0} at {1}:{2}\n", sf.GetMethod(), sf.GetFileName(), sf.GetFileLineNumber()); } // for oLog.Debug("Stack trace:\n{0}", os.ToString()); return null; } // try } // ReallyTryGet