public async Task <ConcurrentBag <string> > Quote2(IndexModel model) { Connection.UpdateWebServiceBaseAddress(model.ApiServer); QuoteRequestWithStringContent quoter = new QuoteRequestWithStringContent(); this.Session?.Add(typeof(QuoteRequestWithStringContent).FullName, quoter); string clientDefinedIdPrefix = "BR-" + StringUtilities.CreateRandomString(8); Stopwatch sw = new Stopwatch(); sw.Start(); try { if (model.WaitUntilCompleted) { return(await quoter.Quote(model.Form, clientDefinedIdPrefix, 0, false)); } Task.Run(() => quoter.Quote(model.Form, clientDefinedIdPrefix, 0, false)).ConfigureAwait(false); } catch (Exception ex) { Debug.WriteLine(ex.Message); } sw.Stop(); Debug.WriteLine("total time to quote2:" + sw.ElapsedMilliseconds); return(null); }
public string GetCounts2() { try { QuoteRequestWithStringContent quoter = this.Session[typeof(QuoteRequestWithStringContent).FullName] as QuoteRequestWithStringContent; if (quoter != null) { return(JsonConvert.SerializeObject(quoter, Global.JsonSettings)); } } catch (Exception e) { Debug.WriteLine(e); } return(null); }
public string GetResults2() { try { QuoteRequestWithStringContent quoter = this.Session[typeof(QuoteRequestWithStringContent).FullName] as QuoteRequestWithStringContent; if (quoter != null) { return(quoter.GetResult()); } } catch (Exception e) { Debug.WriteLine(e); } return(null); }