Click here to Skip to main content
15,901,666 members
Home / Discussions / C#
   

C#

 
AnswerRe: Recordlist in object blocked by error Pin
Dave Kreskowiak18-Apr-21 11:34
mveDave Kreskowiak18-Apr-21 11:34 
AnswerRe: Recordlist in object blocked by error Pin
James Curran20-Apr-21 3:37
James Curran20-Apr-21 3:37 
QuestionWhy BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
razzqc16-Apr-21 5:19
razzqc16-Apr-21 5:19 
AnswerRe: Why BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
Gerry Schmitz16-Apr-21 8:37
mveGerry Schmitz16-Apr-21 8:37 
GeneralRe: Why BeginGetContext of HTTPListener within Window's Service didn't react or trigger? Pin
razzqc16-Apr-21 10:06
razzqc16-Apr-21 10:06 
QuestionWhy GC.Collect() call twice required when use GC.WaitForPendingFinalizers() Pin
Mou_kol10-Apr-21 22:06
Mou_kol10-Apr-21 22:06 
AnswerRe: Why GC.Collect() call twice required when use GC.WaitForPendingFinalizers() Pin
OriginalGriff10-Apr-21 22:48
mveOriginalGriff10-Apr-21 22:48 
QuestionC# Unable to update data table values Pin
Mou_kol10-Apr-21 1:34
Mou_kol10-Apr-21 1:34 
AnswerRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 2:13
mveOriginalGriff10-Apr-21 2:13 
GeneralRe: C# Unable to update data table values Pin
Mou_kol10-Apr-21 3:04
Mou_kol10-Apr-21 3:04 
GeneralRe: C# Unable to update data table values Pin
Dave Kreskowiak10-Apr-21 4:23
mveDave Kreskowiak10-Apr-21 4:23 
GeneralRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 7:57
mveOriginalGriff10-Apr-21 7:57 
GeneralRe: C# Unable to update data table values Pin
OriginalGriff10-Apr-21 8:00
mveOriginalGriff10-Apr-21 8:00 
GeneralRe: C# Unable to update data table values Pin
Richard MacCutchan10-Apr-21 21:07
mveRichard MacCutchan10-Apr-21 21:07 
GeneralRe: C# Unable to update data table values Pin
jschell17-Apr-21 7:09
jschell17-Apr-21 7:09 
AnswerRe: C# Unable to update data table values Pin
Mou_kol10-Apr-21 3:00
Mou_kol10-Apr-21 3:00 
SuggestionRe: C# Unable to update data table values Pin
Richard Deeming11-Apr-21 21:23
mveRichard Deeming11-Apr-21 21:23 
GeneralRe: C# Unable to update data table values Pin
Mou_kol12-Apr-21 7:06
Mou_kol12-Apr-21 7:06 
QuestionHour and minute slider Pin
Valakik8-Apr-21 9:49
Valakik8-Apr-21 9:49 
AnswerRe: Hour and minute slider Pin
OriginalGriff8-Apr-21 22:20
mveOriginalGriff8-Apr-21 22:20 
AnswerRe: Hour and minute slider Pin
BillWoodruff9-Apr-21 4:19
professionalBillWoodruff9-Apr-21 4:19 
QuestionC# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:34
professionalKevin Marois8-Apr-21 9:34 
I have the following query.

There is a one-to-many relationship between Jobs->JobSequenceSheets.

I'm joining to JobSequenceSheets. But what I really want is just the COUNT of the JobSequenceSheets records for each Job record.

I'm not sure how to do this. Can someone help?
var datas = (from j in dc.Jobs
            join p in dc.Projects on j.ProjectId equals p.Id
            join cty in dc.Cities on p.CityId equals cty.Id
            join cl in dc.CompanyLocations on p.LocationId equals cl.Id
            let jsdr = dc.JobStartDateRevisions.Where(q => q.JobId == j.Id)
                                               .OrderByDescending(q => q.Revision)
                                               .Take(1)
                                               .FirstOrDefault()

            join jss in dc.JobSequenceSheets on j.Id equals jss.JobId
            let lots = dc.JobSequenceSheets.Where(q => q.JobId == j.Id).Count()

            where (jsdr != null && jsdr.StartDate >= startDate && jsdr.StartDate <= endDate)

            select new
            {
                JobId = j.Id,
                JobNumber = j.JobNumber,
                Lots = j.Lots,

                StartDate = jsdr.StartDate,

                ProjectId = p.Id,
                ProjectNumber = p.ProjectNumber,
                ProjectName = p.ProjectName,

                CityId = cty.Id,
                City = cty.City1,

                LocationId = cl.Id,
                Location = cl.Location,

            }).OrderBy(x => x.Location)
              .ThenBy(x => x.ProjectName)
              .ThenBy(x => x.StartDate).ToList();
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 9:40
mveOriginalGriff8-Apr-21 9:40 
GeneralRe: C# Linq Get Count of Joined Records Pin
Kevin Marois8-Apr-21 9:50
professionalKevin Marois8-Apr-21 9:50 
GeneralRe: C# Linq Get Count of Joined Records Pin
OriginalGriff8-Apr-21 10:05
mveOriginalGriff8-Apr-21 10:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.