Public Function TotalHoursWorked() As IEnumerable(Of Reporting.EmployeeViewModel) Implements IReportRepository.TotalHoursWorked**
Dim qryEmployee = From emp In db.Employee _
.Select(Function(emp) New With {emp.EmployeeId, emp.EmployeeName}).AsEnumerable
Dim qryHoursWorked = From hw In db.HoursWorked
Select New With {hw.EmployeeId, hw.HoursWorkedStart, hw.HoursWorkedEnd}
Return (From emp In qryEmployee _
Join hw In qryHoursWorked On emp.EmployeeId Equals hw.EmployeeId _
Select New Reporting.EmployeeViewModel With {
.EmployeeName = emp.EmployeeName,
.HoursWorkedStart = RoundClockInTime(hw.HoursWorkedStart),
.HoursWorkedEnd = If(hw.HoursWorkedEnd.HasValue, RoundClockOutTime(hw.HoursWorkedEnd), hw.HoursWorkedEnd),
.HoursWorked = (.HoursWorkedStart - .HoursWorkedEnd),
.TotalHours = Sum(.HoursWorked)
})
End Function
我得到的错误是"Sum is either not declared or not in the current scope"
. 我需要在按employeeId 分组的报表页脚中显示总小时数。
关于这个的任何建议。我可能会出错。提前致谢