public void AddClockPunch(string Applicator, DateTime ClockPunch) { ClockPunches[] clockList = this.ClockPunches; if (clockList == null) { clockList = new ClockPunches[0]; } Array.Resize <ClockPunches>(ref clockList, clockList.Length + 1); clockList[clockList.Length - 1] = new ClockPunches(); clockList[clockList.Length - 1].Date = ClockPunch; clockList[clockList.Length - 1].Stamp = new RecordStamp(); clockList[clockList.Length - 1].Stamp.DateRecorded = DateTime.Now; clockList[clockList.Length - 1].Stamp.Pilot = Applicator; this.ClockPunches = clockList; }
public void DeleteClockPunch(DateTime ClockPunch) { ClockPunches[] clockList = this.ClockPunches; if (clockList == null) { clockList = new ClockPunches[0]; } int i = 0; for (i = 0; i < clockList.Length; i++) { if (clockList[i].Date == ClockPunch) { clockList = clockList.Where((val, idx) => idx != i).ToArray(); break; } } this.ClockPunches = clockList; }