public override bool Equals(object obj)
        {
            WorkerWorkingPeriod other = obj as WorkerWorkingPeriod;

            if (other == null)
            {
                return(false);
            }

            return(this.WorkerID == other.WorkerID);
        }
示例#2
0
        public void WritePeriod(WorkerWorkingPeriod workingPeriod)
        {
            int firstDayRow = currentRow;
            int lastDayRow  = currentRow;

            foreach (WorkedDay workedDay in workingPeriod.getWorkedDays())
            {
                writeWorkDay(workedDay);
                lastDayRow = currentRow;
                MoveToNextRow();
            }
            WriteWorkedTimeSum(firstDayRow, lastDayRow);
            MoveToNextRow();
        }
示例#3
0
        private static ICollection <WorkerWorkingPeriod> GroupTimeEntriesInWorkingPeriodsByWorker(ICollection <WorkerTimeEntry> timeEntries)
        {
            var workingPeriods = new SortedDictionary <int, WorkerWorkingPeriod>();

            foreach (var timeEntry in timeEntries)
            {
                int workerId = timeEntry.getWorkerID();
                if (!workingPeriods.ContainsKey(workerId))
                {
                    //TODO: define what to do if the workerIDs do not match, maybe only timestamps should be added to workingPeriods
                    workingPeriods[workerId] = new WorkerWorkingPeriod(workerId);
                }
                workingPeriods[workerId].addWorkerTimeEntry(timeEntry);
            }
            return(workingPeriods.Values);
        }