public HoursEntryResolver(Domain.Cases.Case targetCase, Domain.Cases.CaseAuthorizationHours authHours, Data.Services.ICaseService caseService)
 {
     this.targetCase  = targetCase;
     subjectHours     = authHours;
     ValidationErrors = new List <Dymeng.Framework.Validation.ValidationError>();
     this.caseService = caseService;
     _context2        = new Data.V2.CoreContext();
 }
        private static bool HasBCBAAssessmentHours(Domain.Cases.CaseAuthorizationHours newHours, List <Domain2.Hours.Hours> existingHours)
        {
            if ((newHours.ServiceCode == ASSESSMENT_CODE || newHours.ServiceCode == FOLLOWUP_CODE) &&
                newHours.Provider.Type.ID == BCBA_TYPE)
            {
                return(true);
            }

            if (existingHours.Where(x =>
                                    (x.Service.Code == ASSESSMENT_CODE || x.Service.Code == FOLLOWUP_CODE) &&
                                    x.Provider.ProviderTypeID == BCBA_TYPE).Any())
            {
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Converts an instance of CaseAuthorizationHours to an AppointmentDTO.
        /// </summary>
        /// <param name="hours">CaseAuthorizationHours instance to map.</param>
        /// <returns></returns>
        private static AppointmentDTO MapFromDomainAppointment(Domain.Cases.CaseAuthorizationHours hours)
        {
            var dto = new AppointmentDTO
            {
                UniqueID       = hours.ID.Value,
                StartDate      = new DateTime(hours.Date.Year, hours.Date.Month, hours.Date.Day, hours.TimeIn.Hour, hours.TimeIn.Minute, 0),
                EndDate        = new DateTime(hours.Date.Year, hours.Date.Month, hours.Date.Day, hours.TimeOut.Hour, hours.TimeOut.Minute, 0),
                Subject        = hours.Service?.Name,
                Description    = null,
                Location       = null,
                AllDay         = false,
                Type           = 0,
                RecurrenceInfo = null,
                ReminderInfo   = null,
                Label          = GetDTOLabelFromDomainStatus(hours.Status),
                Status         = 0,
                ResourceID     = 0, // must have resource mapped! (use ResourceDTO.GetDefaultResource())
                CustomField1   = null
            };

            return(dto);
        }
Esempio n. 4
0
        public List <Domain.Cases.CaseAuthorizationHours> GetHoursByPeriod(DateTime period, bool includeNonFinalized)
        {
            DateTime startDate = period;
            DateTime endDate   = period.AddMonths(1).AddMilliseconds(-1);

            var context = new Models.CoreEntityModel();

            int minStatus = includeNonFinalized ? 0 : 2;

            var entities = context.Database.SqlQuery <Models.Sprocs.HoursDetailedByPeriod>(
                "GetDetailedHoursByPeriod @StartDate, @EndDate, @MinStatus",
                new SqlParameter("@StartDate", startDate),
                new SqlParameter("@EndDate", endDate),
                new SqlParameter("@MinStatus", minStatus)
                ).ToList();

            var items = new List <Domain.Cases.CaseAuthorizationHours>();

            foreach (var h in entities)
            {
                var cah = new Domain.Cases.CaseAuthorizationHours();

                cah.Authorization = new Domain.Cases.CaseAuthorization()
                {
                    ID = h.CaseAuthID
                };
                cah.CaseID     = h.CaseID;
                cah.ProviderID = h.CaseProviderID;
                cah.Provider   = new Domain.Cases.CaseProvider()
                {
                    ID = h.CaseProviderID
                };
                cah.DateCreated      = h.DateCreated;
                cah.BillableHours    = (double?)h.HoursBillable;
                cah.BillingRef       = h.HoursBillingRef;
                cah.CorrelationID    = h.HoursCorrelationID;
                cah.Date             = h.HoursDate;
                cah.HasCatalystData  = h.HoursHasCatalystData;
                cah.InternalNotes    = h.HoursInternalNotes;
                cah.Notes            = h.HoursNotes;
                cah.HasExtendedNotes = h.HasExtendedNotes == 1;
                cah.PayableHours     = (double?)h.HoursPayable;
                cah.PayableRef       = h.HoursPayableRef;
                cah.Service          = new Domain.Cases.Service()
                {
                    ID = h.HoursServiceID
                };
                cah.SSGParentID  = h.HoursSSGParentID;
                cah.Status       = (Domain.Cases.AuthorizationHoursStatus)h.HoursStatus;
                cah.TimeIn       = h.HoursDate + h.HoursTimeIn;
                cah.TimeOut      = h.HoursDate + h.HoursTimeOut;
                cah.HoursTotal   = (double)h.HoursTotal;
                cah.WatchEnabled = h.HoursWatchEnabled;
                cah.WatchNote    = h.HoursWatchNote;
                cah.ID           = h.ID;
                cah.IsPayrollOrBillingAdjustment = h.IsPayrollOrBillingAdjustment;
                cah.Case = new Domain.Cases.Case()
                {
                    ID = h.CaseID, Patient = new Domain.Patients.Patient()
                    {
                        FirstName = h.PatientName
                    }
                };
                cah.Provider.FirstName = h.ProviderName;
                cah.ServiceLocationID  = h.ServiceLocationID;
                cah.Service.Code       = h.ServiceCode;
                cah.Authorization      = new Domain.Cases.CaseAuthorization()
                {
                    CaseAuthorizationID = h.CaseAuthID, Code = h.AuthCode
                };

                items.Add(cah);
            }

            return(items);
        }