title: Subsonic 2.2 SqlQuery with complicated clauses
body: <p>I've written the following query for a resource scheduling calendar app.  The query is used to find any events already scheduled on the calendar that would conflict with the event of interest:</p>
  
  <pre><code>        string qry = "SELECT * FROM " + EventX.Schema.TableName + 
              " WHERE " +
                  " ( " +
                      " ( " + 
                          EventX.Columns.StartTime + " &gt;= '" + startTime + 
                          "' AND " + EventX.Columns.StartTime + " &lt; '" + endTime + 
                      "' ) " + 
                      " OR " +
                      " ( " + 
                          EventX.Columns.EndTime + " &gt; '" + startTime + 
                          "' AND " + EventX.Columns.EndTime + " &lt;= '" + endTime + 
                      "' ) " + 
                  " ) " + 
                  " AND " +
                  " ( " + 
                      EventX.Columns.EventID + " &lt;&gt; " + eventId + 
                      " AND " + EventX.Columns.StatusID + " IN " + 
                      " ( " + 
                          (int) EventStatus.Approved + " , " + 
                          (int) EventStatus.Completed + 
                      " ) " + 
                  " ) "; 
  
          QueryCommand qc = new QueryCommand(qry, EventX.Schema.Provider.Name);
  
          EventXCollection events = new EventXCollection();
          events.LoadAndCloseReader(DataService.GetReader(qc));
  </code></pre>
  
  <p>The above query works, but it's a freakishly ugly abomination in terms of aesthetics and I'd prefer not to leave a mess for whoever has to maintain this after me.  I wrote this query after having tried and failed to get it working using a SqlQuery instead.  The closest I came to getting it right before giving up on SqlQuery and writing the functional-but-ugly hack above was the following (incorrect) query:</p>
  
  <pre><code>        SqlQuery qry = new Select().From(EventX.Schema.TableName);
          qry.WhereExpression(EventX.Columns.StartTime).IsGreaterThan(startTime);
          qry.And(EventX.Columns.StartTime).IsLessThan(endTime);
          qry.OrExpression(EventX.Columns.EndTime).IsGreaterThan(startTime);
          qry.And(EventX.Columns.EndTime).IsLessThan(endTime);
          qry.AndExpression(EventX.Columns.EventID).IsNotEqualTo(eventId);
          qry.And(EventX.Columns.StatusID).In((int)EventStatus.Approved, (int)EventStatus.Completed);
  </code></pre>
  
  <p>I'm working on maintaining an application written by a developer who has since moved on and this is my first experience working with Subsonic.  Note that if event A ends at 2:00 PM and event B starts at 2:00 PM, then events A and B do not constitute a scheduling conflict and the query should reflect that.  How would you write this query using Subsonic?</p>