I needed to get essentially a summary by case statement for a given date. As you can see I have defined the MAX date into a variable. This example also shows using a substring of the first character in a LET statement DateTime? maxDate = (from a in context.tbl_tslog orderby a.CurrentTime select (DateTime?) a.CurrentTime ).Max(); var dbRecords = (from c in context.tbl_testlog where (c.CurrentTime >=maxDate) let range = ( c.Usr.ToUpper().Substring(0,1) == "B" ? "US" : ...
News on the front page is always nice Quick way to drop your news into a Partial view so that you can use it anywhere Create your Partial View Just make it empty Add a Div for your News <div id="news"></div> Add script which loads the news - sidenote - I a have learned that you can not use .append lines when adding conditional data because it inherently closes your tag for you. So I am using an array instead and then appending to the news div at the very end. <script type="text/javascript"> $(document).ready(function() { $('#news').html(""); $('#L1').removeClass("hidden"); var ROOT = '@Url.Content("~/")'; if (ROOT == '/') { ROOT = '' }; $.getJSON(ROOT + '/home/SiteNews/', function (data) { ...
One way to do it when you have two lists (repYearlyData and otherdata) foreach (var yd in repYearlyData) { for(int d=0;d<otherdata.Count;d++) { if (yd.AssignedRep == otherdata[d].AssignedRep) { otherdata.RemoveAt(d); } } } var result = peopleList2 . Where ( p => ! peopleList1 . Any ( p2 => p2 . ID == p . ID )); public List<TeamAverages> GetRepMonthlyAverages() ...
Comments