Пример #1
0
 public ActionResult Results()
 {
     var cb = new SqlConnectionStringBuilder(Util.ConnectionString);
     cb.ApplicationName = "qb";
     DbUtil.Db = new CMSDataContext(cb.ConnectionString);
     var m = new QueryModel();
     try
     {
         UpdateModel<IQBUpdateable>(m);
     }
     catch (Exception ex)
     {
         return Content("Something went wrong<br><p>" + ex.Message + "</p>");
     }
     m.LoadScratchPad();
     var starttime = DateTime.Now;
     try
     {
         m.PopulateResults();
     }
     catch (Exception ex)
     {
         var ex2 = new Exception("SearchBuilder error:\n" + m.GetTopClause().ToXml(), ex);
         ErrorLog errorLog = ErrorLog.GetDefault(null);
         errorLog.Log(new Error(ex2));
         return Content("Something went wrong<br><p>" + ex.Message + "</p>");
     }
     DbUtil.LogActivity("QB Results ({0:N1}, {1})".Fmt(DateTime.Now.Subtract(starttime).TotalSeconds, m.QueryId));
     return View(m);
 }