public Record(DateTime eventDate, SwimStyle swimStyle, int time, TimeSpan oldRecord) { this.eventDate = eventDate; this.swimStyle = swimStyle; this.time = time; this.oldRecord = oldRecord; this.timeAsString = time.ToString(); string formattedTime = timeAsString.Remove(timeAsString.Length - 3); String milliseconds = timeAsString.Remove(0, timeAsString.Length - 3); timeAsTimeSpan = TimeSpan.FromSeconds(Convert.ToDouble(formattedTime)); timeAsTimeSpan = timeAsTimeSpan.Add(TimeSpan.FromMilliseconds(Convert.ToDouble(milliseconds))); differenceAsTimeSpan = oldRecord.Add(-timeAsTimeSpan); this.timeAsString = timeAsTimeSpan.ToString(@"hh\:mm\:ss\:ff").Replace("00:0", "0").Replace("00", "0"); this.difference = differenceAsTimeSpan.ToString(@"hh\:mm\:ss\:ff").Replace("00:0", "0").Replace("00", "0"); }
public Result(DateTime eventDate, SwimStyle swimStyle, int time) { this.eventDate = eventDate; this.swimStyle = swimStyle; this.time = time; }