Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This should work</p> <pre><code> var query = new UvwRequestAssignmentManagementBO().GetAll().Where(uvw =&gt; (uvw.FK_ProcessStep == 2) &amp;&amp; (uvw.FK_Entity == 1) &amp;&amp; (uvw.FK_Manager == 15)) .Select(p =&gt; new ReqSupAdminGridVm { NameFamily = p.NameFamily, RequestDate = p.RequestDate, RequestNo = p.RequestNo, RequestType = GetReqType(p.RequestType), RequestEvaluationStatus = GetReqEvalStatus(p.RequestEvaluationStatus_Aggregation), }); </code></pre> <p>if you add the following local helper functions:</p> <pre><code>private static string GetReqEvalStatus(int agg) { switch (agg) { case 1: return "a"; case 2: return "b"; case 3: return "c"; case 4: return "d"; default: return ""; } } private static string GetReqType(int type) { switch (type) { case 1: return "a"; case 2: return "b"; case 3: return "c"; case 4: return "d"; default: return ""; } } </code></pre> <p>See it working <a href="http://ideone.com/lBiDxD" rel="nofollow"><strong>Live on IdeOne</strong></a></p> <p>If you want, you can move the helper functions into another class/file (<a href="http://ideone.com/EsK6W8" rel="nofollow">http://ideone.com/EsK6W8</a>):</p> <pre><code> RequestType = ReqType.GetReqType(p.RequestType), RequestEvaluationStatus = ReqEvalStatus.GetReqEvalStatus(p.RequestEvaluationStatus_Aggregation), </code></pre> <p>And in separate file(s):</p> <pre><code>static internal class ReqEvalStatus { public static string GetReqEvalStatus(int agg) { switch (agg) { case 1: return "a"; case 2: return "b"; case 3: return "c"; case 4: return "d"; default: return ""; } } } </code></pre> <p>and</p> <pre><code>static internal class ReqType { public static string GetReqType(int type) { switch (type) { case 1: return "a"; case 2: return "b"; case 3: return "c"; case 4: return "d"; default: return ""; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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