Ejemplo n.º 1
0
 public void checkIfQueryIsValid()
 {
     if (tbNLinqQuery.InvokeRequired)
     {
         tbNLinqQuery.Invoke(new EventHandler(delegate { checkIfQueryIsValid(); }));
     }
     else
     {
         tbNLinqQuery.BackColor = O2NLinkQuery.IsQueryValid(
             tbNLinqQuery.Text, "o2Findings",
             new List <O2Finding>(new[] { new O2Finding() }),
             cbShowCompilationErrorDetails.Checked)
                                      ?
                                  Color.PaleGreen
                                      : Color.MistyRose;
     }
 }
Ejemplo n.º 2
0
 private void runNLinkQuery()
 {
     nLinqQueryResults.DataSource = null;
     if (loadedO2Findings.Count > 0)
     {
         try
         {
             var timer   = new O2Timer();
             var results =
                 (List <object>)O2NLinkQuery.runQuery(tbNLinqQuery.Text, "o2Findings", loadedO2Findings);
             tryToExtractO2FindingsFromResultsForOzasmtSave(results);
             if (results == null || results.Count == 0)
             {
                 DI.log.debug("Query result was null");
                 lbNLinqQuery_NumberOfResults.Text = "..";
             }
             else
             {
                 lbNLinqQuery_NumberOfResults.Text = results.Count.ToString();
                 if (results.Count > maxNumberOfNLinqQueryRecordsToShow)
                 {
                     lbNLinqQuery_NumberOfResults.ForeColor = Color.Red;
                     lbNLinqQuery_NumberOfResults.Text     += string.Format(" Results (only showing {0} findings)",
                                                                            maxNumberOfNLinqQueryRecordsToShow);
                 }
                 else
                 {
                     lbNLinqQuery_NumberOfResults.ForeColor = Color.Black;
                     lbNLinqQuery_NumberOfResults.Text     += " Results ";
                 }
                 nLinqQueryResults.DataSource = OzasmtLinq.getDataTableFromO2FindingsLinqQuery(results,
                                                                                               maxNumberOfNLinqQueryRecordsToShow,
                                                                                               ref
                                                                                               mappingOfDataRowsToObjects);
                 //finding => new [] {results});
             }
             lbNLinqQuery_ExecutionTime.Text = timer.stop().ToString();
         }
         catch (Exception ex)
         {
             DI.log.ex(ex, " in executeNLinkQuery");
         }
     }
 }