public bool IsIntersection(TimeTrackPartDetailsViewModel timeTrackPartDetailsViewModel) { var enterTime = timeTrackPartDetailsViewModel.EnterTime; var exitTime = timeTrackPartDetailsViewModel.ExitTime; var uid = timeTrackPartDetailsViewModel.UID; return DayTimeTrackParts.Any(x => x.UID != uid && (x.EnterTimeSpan <= enterTime && x.ExitTimeSpan > enterTime || x.EnterTimeSpan < exitTime && x.ExitTimeSpan > exitTime)); }
void OnAddCustomPart() { var timeTrackPartDetailsViewModel = new TimeTrackPartDetailsViewModel(DayTimeTrack, ShortEmployee, this); if (DialogService.ShowModalWindow(timeTrackPartDetailsViewModel)) { DayTimeTrackParts.Add(new DayTimeTrackPartViewModel(timeTrackPartDetailsViewModel.UID, timeTrackPartDetailsViewModel.EnterTime, timeTrackPartDetailsViewModel.ExitTime, timeTrackPartDetailsViewModel.SelectedZone.Name)); IsChanged = true; ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Publish(ShortEmployee.UID); } }
void OnEditPart() { var timeTrackPartDetailsViewModel = new TimeTrackPartDetailsViewModel(DayTimeTrack, ShortEmployee, this, SelectedDayTimeTrackPart.UID, SelectedDayTimeTrackPart.EnterTimeSpan, SelectedDayTimeTrackPart.ExitTimeSpan); if (DialogService.ShowModalWindow(timeTrackPartDetailsViewModel)) { SelectedDayTimeTrackPart.Update(timeTrackPartDetailsViewModel.EnterTime, timeTrackPartDetailsViewModel.ExitTime, timeTrackPartDetailsViewModel.SelectedZone.Name); IsChanged = true; ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Publish(ShortEmployee.UID); } }