public IEnumerable <ClockInOut> ReadHistoryById(int id) { var clockInOutRepository = new ClockInOutRepository(_repository); var clockInOutHistory = clockInOutRepository.GetClockOutsForAllTimeById(id); return(clockInOutHistory); }
/// <summary> /// Initializes the members /// </summary> /// <param name="appiManageDatabaseContext">Database context</param> public UnitOfWork(AppiManageDatabaseContext appiManageDatabaseContext) { _appiManageDatabaseContext = appiManageDatabaseContext; Clients = new ClientRepository(_appiManageDatabaseContext); Employees = new EmployeeRepository(_appiManageDatabaseContext); ClockInOuts = new ClockInOutRepository(_appiManageDatabaseContext); Items = new ItemRepository(_appiManageDatabaseContext); Notifications = new NotificationRepository(_appiManageDatabaseContext); Schedules = new ScheduleRepository(_appiManageDatabaseContext); }
public BalanceDto BalanceToThisDay(int id) { var clockInOutRepository = new ClockInOutRepository(_repository); var datesIn = clockInOutRepository.GetClockInsForThisMonth(id).ToList(); var datesOut = clockInOutRepository.GetClockOutsForThisMonth(id).ToList(); if (datesIn.Count > datesOut.Count) { datesIn.RemoveAt(datesIn.Count - 1); } return(CountBalance.CountWorkTimeCurrent(datesIn, datesOut)); }
public BalanceDto Balance(int id) { var clockInOutRepository = new ClockInOutRepository(_repository); var datesIn = clockInOutRepository.GetClockInsForThisMonth(id).ToList(); var datesOut = clockInOutRepository.GetClockOutsForThisMonth(id).ToList(); var lastRecord = _repository.ReadLast(id); if (lastRecord?.Type == ClockType.In) { datesIn.RemoveAt(datesIn.Count - 1); } return(CountBalance.CountWorkTime(datesIn, datesOut)); }