internal static List <ModelSOTPDList> GetConvertedOTListEmpHR(List <ViewDailyOTEntry> list, List <EmpView> emps) { List <ModelSOTPDList> vm = new List <ModelSOTPDList>(); foreach (var emp in emps) { if (list.Where(aa => aa.EmpID == emp.EmployeeID).Count() > 0) { ModelSOTPDList obj = new ModelSOTPDList(); obj.DailyOTRequestCount = list.Where(aa => aa.EmpID == emp.EmployeeID).Count(); obj.Designation = emp.DesignationName; obj.Section = emp.SectionName; obj.EmpID = emp.EmployeeID; obj.EmpName = emp.FullName; obj.ClaimedOTMins = OTHelper.GetEmployeeCOTHour(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.SystemOTMins = OTHelper.GetEmployeeSOTHour(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.ClaimedOTHours = OTHelperManager.ConverMinIntoHours(obj.ClaimedOTMins); obj.SystemOTHours = OTHelperManager.ConverMinIntoHours(obj.SystemOTMins); obj.OTAmount = OTHelper.GetOTAmount(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.PendingAtSupervisor = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "P").ToList().Count(); obj.PendingAtRecommender = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "F" && aa.UFUserType == "R").ToList().Count(); obj.PendingAtApprover = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "F" && aa.UFUserType == "P").ToList().Count(); obj.Approved = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "A").ToList().Count(); vm.Add(obj); } } return(vm.OrderBy(aa => aa.EmpName).ToList()); }
public static List <ModelSOTPDList> GetConvertedOTListEmp(List <ViewDailyOTEntry> list, List <EmpView> emps) { List <ModelSOTPDList> vm = new List <ModelSOTPDList>(); foreach (var emp in emps) { List <ViewDailyOTEntry> TList = new List <ViewDailyOTEntry>(); TList = list.Where(aa => aa.EmpID == emp.EmployeeID).ToList(); if (TList.Count() > 0) { ModelSOTPDList obj = new ModelSOTPDList(); obj.DailyOTRequestCount = TList.Count(); obj.Designation = emp.DesignationName; obj.Section = emp.SectionName; obj.EmpID = emp.EmployeeID; obj.EmpName = emp.FullName; obj.ClaimedOTMins = (int)TList.Sum(aa => aa.ApprovedOTMin); obj.SystemOTMins = (int)TList.Sum(aa => aa.ActualOTMin); obj.ClaimedOTHours = OTHelperManager.ConverMinIntoHours(obj.ClaimedOTMins); obj.SystemOTHours = OTHelperManager.ConverMinIntoHours(obj.SystemOTMins); obj.OTAmount = OTHelper.GetOTAmount(TList.ToList()); obj.Processed = 1; if (TList.First().PeriodID != null) { obj.PeriodID = (int)TList.First().PeriodID; } else { obj.PeriodID = 0; } if (TList.First().OTProcessingPeriodID != null) { obj.OTProcessPeriodID = (int)TList.First().OTProcessingPeriodID; } else { obj.OTProcessPeriodID = 0; } switch (TList.First().StatusID) { case "P": obj.StatusRemarks = "Pending:" + TList.First().USFullName; break; case "F": obj.StatusRemarks = "Recommend By:" + TList.First().UPFFullName; if (TList.First().UFFFullName != null) { obj.StatusForward = "Recommend By:" + TList.First().UFFFullName; } break; case "C": obj.StatusRemarks = "Cancel:" + TList.First().UCFullName; obj.StatusForward = " "; break; case "A": obj.StatusRemarks = "Approved:" + TList.First().UAFullName; break; case "R": obj.StatusRemarks = "Reject:" + TList.First().URFullName; break; } vm.Add(obj); } } vm = vm.OrderBy(aa => aa.EmpName).ToList(); //if (vm.Count > 0) //{ // ModelSOTPDList obj = new ModelSOTPDList(); // obj.DailyOTRequestCount = list.Count(); // obj.Designation = ""; // obj.Section = ""; // obj.EmpID =0; // obj.EmpName = "Total Employees: "+ vm.Count().ToString(); // obj.ClaimOvertime = vm.Sum(aa=>aa.ClaimOvertime); // obj.SystemOvertime = vm.Sum(aa => aa.SystemOvertime); // obj.OTAmount = vm.Sum(aa => aa.OTAmount); // vm.Add(obj); //} return(vm); }