I am really loving the data entity in my new projects but have come across a couple of issues already. Tonight I learned about using a field that is not a part of your database and not in the entity but is a consolidation field from a group. Once I found some good samples it worked incredibly well and I had a little summary grid on the page in just a couple of minutes. So here is what I did using (myEntityName context = new myEntityName()) { //First I declared a couple of variables because I was looking at data between specific dates DateTime startdate = DateTime.Parse("2014-02-01"); DateTime enddate = DateTime.Parse("2014-02-01"); var dbRecords = (from c in context.myTableName where (c.MemberStartDate >= startdate && c.MemberStart...
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" : ...
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