//Method for Selecting hours worked between two given DateTimes. //Selects TimeWorked from EmpTime table between 2 DateTimes, sets double Total to figure out hours worked in that time frame. public void selectOvertime(DateTime i, DateTime o) { TimeIO tio = new TimeIO(); for (int x = 0; x < emps.Count(); x++) { //selectHours for all employees tio.selectHours(emps[x].getId(), i, o); //if employee's hours are greater than 40 and not equal to zero, populate lists if (tio.getTotal() > 40 && tio.getTotal() != 0) { //adds employee ids to empIds list getEmpIds().Add(emps[x].getId()); //add total from TimeIO BO to hours list getHours().Add(tio.getTotal()); } } //Display results for (int x = 0; x < empIds.Count(); x++) { tio.selectHours(empIds[x], i, o); Employee e1 = new Employee(); e1.selectEmp(empIds[x]); Console.WriteLine("Hours worked between " + i + " and " + o + " for Employee " + e1.getFName() + " " + e1.getLName()); Console.WriteLine("Overtime Hours Worked: " + ((int)(hours[x]) - 40) + " Hours and " + ((hours[x] - (int)(hours[x])) * 60) + " minutes."); Console.WriteLine(hours[x] - (int)hours[x] + ""); } }
//Method for Selecting hours worked between two given DateTimes. //Selects TimeWorked from EmpTime table between 2 DateTimes, sets double Total to figure out hours worked in that time frame. public void selectOvertime(DateTime i, DateTime o) { TimeIO tio = new TimeIO(); for (int x = 0; x < emps.Count(); x++) { tio.selectHours(emps[x].getId(), i, o); if (tio.getTotal() > 40 && tio.getTotal() != 0) { getEmpIds().Add(emps[x].getId()); getHours().Add(tio.getTotal()); } } }