Example #1
0
        internal bool ValidateProviderNotSelfOverlap(Domain2.Hours.Hours entry)
        {
            if (_resolutionService.Provider.IsBCBA)
            {
                return(true);
            }

            var hoursAtDate = _resolutionService.AllProposedProviderHours.Where(x => x.Date == entry.Date).ToList();
            // remove any of these that are SSG non-parents
            var ssgToRemove = hoursAtDate.Where(x => x.SSGParentID != null && x.SSGParentID != x.ID).ToList();

            foreach (var removal in ssgToRemove)
            {
                hoursAtDate.Remove(removal);
            }

            var tuples = GetHoursRangeTuples(hoursAtDate);

            if (ValidationHelpers.AreAnyOverlapping(tuples))
            {
                if (_resolutionService.EntryMode == HoursEntryMode.ManagementEntry)
                {
                    _resolutionService.Issues.AddIssue("These hours cause an overlap by this provider.", ValidationIssueType.Warning);
                }
                else
                {
                    _resolutionService.Issues.AddIssue("Unable to apply hours, this would cause a time overlap of other entries.");
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        internal bool ValidateAideNotDROverlapOnCase(Domain2.Hours.Hours entry)
        {
            if (_resolutionService.Provider.IsBCBA || (_resolutionService.EntryMode == HoursEntryMode.ManagementEntry && entry.IsTrainingEntry))
            {
                return(true);
            }

            var caseDRHours = _resolutionService.AllProposedCaseHours(entry.CaseID)
                              .Where(x => x.Date == entry.Date && x.ServiceID == _resolutionService.DRServiceID)
                              .ToList();
            var tuples = GetHoursRangeTuples(caseDRHours);

            if (ValidationHelpers.AreAnyOverlapping(tuples))
            {
                if (_resolutionService.EntryMode == HoursEntryMode.ManagementEntry)
                {
                    _resolutionService.Issues.AddIssue("These hours will cause an overlap in Aide DR entries for this case.", ValidationIssueType.Warning);
                }
                else
                {
                    _resolutionService.Issues.AddIssue("Unable to apply hours, this would cause an overlap of DR services for this case.");
                    return(false);
                }
            }
            return(true);
        }