public List <TimeSheetModel> GetMyTeamTimeSheet(Int64 UserID, DateTime FromDate, DateTime ToDate, bool myDirectEmployees) { List <TimeSheetModel> timeSheetModelList = new List <TimeSheetModel>(); EmployeeDac employeeDac = new EmployeeDac(); string leadRole = employeeDac.GetEmployeeRole(UserID); try { List <EmployeeProfile> employeeProfileListUnderManager = employeeDac.GetReportingEmployeeProfile(UserID, leadRole, myDirectEmployees).OrderBy(m => m.FirstName).ToList(); for (int i = 0; i < employeeProfileListUnderManager.Count; i++) { List <TimeSheetModel> timeSheetModelListTemp = GetMyTimeSheet(employeeProfileListUnderManager[i].UserId, FromDate, ToDate); timeSheetModelList.AddRange(timeSheetModelListTemp); } return(timeSheetModelList); } catch (Exception) { throw; } }
public List <NoOfLateInMonth> GetLateReport(Int64 UserID, DateTime FromDate, DateTime ToDate, bool myDirectEmployees) { List <ReportLateMonth> reportLateMonthlst = new List <ReportLateMonth>(); List <NoOfLateInMonth> noOfLateInMonth = new List <NoOfLateInMonth>(); // To Get all the employee profile under the manager or lead EmployeeDac employeeDac = new EmployeeDac(); string leadRole = employeeDac.GetEmployeeRole(UserID); // To get the employee role, whether he is the Team lead or HR Or admin try { List <EmployeeProfile> employeesUnderManager = employeeDac.GetReportingEmployeeProfile(UserID, leadRole, myDirectEmployees).OrderBy(m => m.FirstName).ToList(); for (int i = 0; i < employeesUnderManager.Count; i++) { string Name = employeesUnderManager[i].FirstName + " " + employeesUnderManager[i].LastName; List <ReportLateMonth> reportLateMonth = GetMyTimeSheet(employeesUnderManager[i].UserId, FromDate, ToDate, employeesUnderManager[i].ReportedToName, Name, employeesUnderManager[i].EmployeeId); reportLateMonthlst.AddRange(reportLateMonth); } noOfLateInMonth = (from p in reportLateMonthlst where p.LateEntry != null group p by new { p.UserID, p.Name, p.ReportingTo, p.EmpId } into g select new NoOfLateInMonth { Name = g.Key.Name, UserID = g.Key.UserID, ReportingTo = g.Key.ReportingTo, EmpId = g.Key.EmpId, NoOfLate = g.Count() }).ToList(); return(noOfLateInMonth); } catch (Exception) { throw; } }