Esempio n. 1
0
        public static Domain.Cases.Case Case(Models.Case entity, bool skipPatientMap = false)
        {
            var c = new Domain.Cases.Case();

            c.DateCreated          = entity.DateCreated;
            c.GeneratingReferralID = entity.CaseGeneratingReferralID;
            c.HasAssessment        = entity.CaseHasAssessment;
            c.HasIntake            = entity.CaseHasIntake;
            c.HasPrescription      = entity.CaseHasPrescription;
            c.ID = entity.ID;
            c.RequiredHoursNotes    = entity.CaseRequiredHoursNotes;
            c.RequiredServicesNotes = entity.CaseRequiredServicesNotes;
            c.StartDate             = entity.CaseStartDate;
            c.Status                   = (Domain.Cases.CaseStatus)entity.CaseStatus;
            c.StatusNotes              = entity.CaseStatusNotes;
            c.StatusReason             = (Domain.Cases.CaseStatusReason)entity.CaseStatusReason;
            c.DefaultServiceLocationID = entity.DefaultServiceLocationID;

            c.NeedsStaffing    = entity.CaseNeedsStaffing;
            c.NeedsRestaffing  = entity.CaseNeedsRestaffing;
            c.RestaffingReason = entity.CaseRestaffingReason;

            if (entity.DefaultServiceLocationID.HasValue)
            {
                c.DefaultServiceLocation = new Services.ServicesService().GetActiveServiceLocations().Where(x => x.ID == c.DefaultServiceLocationID).FirstOrDefault();
            }

            if (!skipPatientMap)
            {
                c.Patient = Mappings.PatientMappings.Patient(entity.Patient);
            }

            return(c);
        }
 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();
 }
Esempio n. 3
0
        /*--------------------
         *  HELPERS
         * ---------------------*/
        public ActionResult AuthValidCheck(int caseID)
        {
            List <Domain.Cases.CaseAuthorization> auths = repository.GetCaseAuthorizations(caseID);

            Domain.Cases.Case c = new Domain.Cases.Case
            {
                Authorizations = auths
            };
            if (c.HasAuthorization)
            {
                return(Content("true"));
            }
            else
            {
                return(Content("false"));
            }
        }
Esempio n. 4
0
        public int RemoveInvalidEntriesFromHoursSet(List <Domain.Cases.CaseAuthorizationHours> items)
        {
            if (items.Count == 0)
            {
                return(0);
            }

            Domain.Cases.Case c = repository.GetCase(items[0].CaseID.Value);
            c.Authorizations = repository.GetCaseAuthorizations(c.ID.Value);


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

            foreach (var item in items)
            {
                bool isValidEntry = true;

                var resolver = new DomainServices.Providers.HoursEntryResolver(c, item);

                resolver.Resolve();

                if (resolver.PassingStatus < DomainServices.Providers.HoursEntryResolver.ValidationResultStatus.ProviderFinalized)
                {
                    isValidEntry = false;
                }

                if (isValidEntry)
                {
                    // TODO: add to auth for next item processing?
                }
                else
                {
                    removals.Add(item);
                }
            }

            items.RemoveAll(x => removals.Contains(x));

            return(removals.Count);
        }