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" : ...
I have a tricky dynamic table built from a model that I did not want to fashion in the controller so wanted to just download the table as shown. This Jquery/Javascript solution allowed me to do just that. Using a button on the page id='export' and using a table on the page id='tblExport' We add an event listener for the button - I have declared everything explicitly but could probably have shortened some references to objects. //For the Csv Export const toCsv = function (table) { // Query all rows var data = "" ; var tableData = []; var rows = $ ( " table tr " ); rows. each ( function (index, row) { var rowData = []; $ (row). find ( " th , td " ). each ( function (index, column) { rowData. push (column. innerText ); }); tableData. push (rowData. join ( "," )); }); data += tableData. join ( " \n " ); return data; }; const download = function (te...
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