Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't understand why this:</p> <pre><code>false == false </code></pre> <p>And that:</p> <pre><code>where (0 == 1) </code></pre> <p>Then for excludes 1 and 2:</p> <pre><code> //To prepare call backs pending var phoneCallTypeId = (int) RecordEnums.TaskType.PhoneCall; var exclude1 = GetExclude(hideWithCallBacksPending, companyId, phoneCallTypeId); //To prepare appointments backs pending var appointmentTypeId = (int) RecordEnums.TaskType.Appointment; var exclude2 = GetExclude(hideWithCallBacksPending, companyId, appointmentTypeId); </code></pre> <p>using the following GetExclude method:</p> <pre><code> private object GetExclude(bool hideWithCallBacksPending, int companyId, int typeId) { return hideWithCallBacksPending ? (from l1 in db.Leads where (l1.Company_ID == companyId) from l2 // Hiding Pending Call Backs in db.Tasks.Where( o =&gt; (o.IsCompleted ?? false) &amp;&amp; (o.TaskType_ID == typeId) &amp;&amp; (o.Type_ID == (int) RecordEnums.RecordType.Lead) &amp;&amp; (o.Item_ID == l1.Lead_ID) &amp;&amp; (o.Due_Date &gt; EntityFunctions.AddDays(DateTime.Now, -1))) select l1) : (from l1 in db.Leads where (0 == 1) select l1); } </code></pre> <p>Exclude3:</p> <pre><code> //To prepare deletions var exclude3 = hidePendingDeletions ? (from d1 in db.Leads where (d1.Company_ID == companyId) from d2 // Hiding Pending Deletions in db.LeadDeletions.Where(o =&gt; (o.LeadId == d1.Lead_ID)) select d1) : (from d1 in db.Leads where (0 == 1) select d1); </code></pre> <p>Excludes 1 and 2 can be called inline as they are short:</p> <pre><code>// Either owned by the user or mode 2 (view all) ...select t1) .Except(GetExclude(hideWithCallBacksPending, companyId, phoneCallTypeId)) .Except(GetExclude(hideWithCallBacksPending, companyId, appointmentTypeId)) .Except(exclude3); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload