/// <summary> /// set clock out time at index /// </summary> /// <param name="time">clock out time</param> /// <param name="index">clock out time</param> public void SetClockOutTimes(string time, int index) { if (IsValidIndex(index)) { this.rawClockTimes[index, 1] = time; this.decClockTimes[index, 1] = PRLib.ConvertAndRoundTime(time); } else { Console.WriteLine("Error: index out of bounds"); } }
/// <summary> /// calculates elapsed times for whole clock-in/out array. /// </summary> public void CalculateElapsedTimes() { for (int i = 0; i < rawClockTimes.GetLength(0); i++) { if (!string.IsNullOrEmpty(rawClockTimes[i, 0]) || !string.IsNullOrEmpty(rawClockTimes[i, 1])) { decClockTimes[i, 0] = PRLib.ConvertAndRoundTime(GetClockInTimes(i)); decClockTimes[i, 1] = PRLib.ConvertAndRoundTime(GetClockOutTimes(i)); decElapsedTimes[i] = CalculateElapsedTime(decClockTimes[i, 0], decClockTimes[i, 1]); } } }