Beispiel #1
0
        private static StaffingLog CreateStaffingLog(int caseId)
        {
            var staffingLog = new StaffingLog
            {
                ID = caseId,
                DateWentToRestaff = DateTime.Today
            };

            return(staffingLog);
        }
Beispiel #2
0
    public StaffingLog DeepCopy()
    {
        StaffingLog other = new StaffingLog();

        other.month = this.month;

        other.departmentHeads = this.departmentHeads;
        other.departmentHeadsP = this.departmentHeadsP;
        other.hotelService= this.hotelService;
        other.hotelServiceP= this.hotelServiceP;
        other.foodAndBev= this.foodAndBev;
        other.foodAndBevP= this.foodAndBevP;
        other.frontDesk= this.frontDesk;
        other.frontDeskP= this.frontDeskP;
        other.conferenceAndBanquet= this.conferenceAndBanquet;
        other.conferenceAndBanquetP= this.conferenceAndBanquetP;
        other.others= this.others;
        other.othersP= this.othersP;

        return other;
    }
        public StaffingLogVM CreateStaffingLogVM(int caseId, StaffingLog staffingLog)
        {
            StaffingLogVM model   = null;
            var           patient = Context.Patients.SingleOrDefault(m => m.Cases.Any(c => c.ID == caseId));

            if (patient != null)
            {
                var @case                 = Context.Cases.SingleOrDefault(m => m.ID == caseId);
                var zipInfoRepository     = new ZipInfoRepository();
                var caseService           = new Data.Services.CaseService();
                var guardianRelationships = caseService.GetGuardianRelationships();
                model = new StaffingLogVM
                {
                    PatientID   = patient.ID,
                    CaseID      = caseId,
                    FirstName   = patient.FirstName,
                    LastName    = patient.LastName,
                    DateOfBirth = patient.DateOfBirth,
                    Email       = patient.Email,
                    Phone       = patient.Phone,
                    Address1    = patient.Address1,
                    Address2    = patient.Address2,
                    City        = patient.City,
                    State       = patient.State,
                    Zip         = patient.Zip,
                    County      = zipInfoRepository.GetCounty(patient.Zip),
                    Guardians   = new List <GuardianInfoVM> {
                        new GuardianInfoVM {
                            FirstName    = patient.GuardianFirstName,
                            LastName     = patient.GuardianLastName,
                            Relationship = GetGuardianRelationship(patient.GuardianRelationshipID, guardianRelationships),
                            Email        = patient.GuardianEmail,
                            CellPhone    = patient.GuardianCellPhone,
                            HomePhone    = patient.GuardianHomePhone,
                            WorkPhone    = patient.GuardianWorkPhone,
                            Notes        = patient.GuardianNotes
                        },
                        new GuardianInfoVM            {
                            FirstName    = patient.Guardian2FirstName,
                            LastName     = patient.Guardian2LastName,
                            Relationship = GetGuardianRelationship(patient.Guardian2RelationshipID, guardianRelationships),
                            Email        = patient.Guardian2Email,
                            CellPhone    = patient.Guardian2CellPhone,
                            HomePhone    = patient.Guardian2HomePhone,
                            WorkPhone    = patient.Guardian2WorkPhone,
                            Notes        = patient.Guardian2Notes
                        },
                        new GuardianInfoVM
                        {
                            FirstName    = patient.Guardian3FirstName,
                            LastName     = patient.Guardian3LastName,
                            Relationship = GetGuardianRelationship(patient.Guardian3RelationshipID, guardianRelationships),
                            Email        = patient.Guardian3Email,
                            CellPhone    = patient.Guardian3CellPhone,
                            HomePhone    = patient.Guardian3HomePhone,
                            WorkPhone    = patient.Guardian3WorkPhone,
                            Notes        = patient.Guardian3Notes
                        }
                    },
                    FunctioningLevel = @case.FunctioningLevel?.Name,
                    Notes            = patient.Notes,
                    CaseProviders    = Context.CaseProviders
                                       .Where(m => m.CaseID == caseId)
                                       .ToList()
                                       .Select(m => new CaseProviderVM
                    {
                        ProviderID        = m.Provider.ID,
                        ProviderLastName  = m.Provider.LastName,
                        ProviderFirstName = m.Provider.FirstName,
                        ProviderType      = m.Provider.GetProviderTypeFullCode(),
                        IsBCBA            = m.Provider.IsBCBA,
                        IsActive          = CaseIsActive(DateTime.Now, m.StartDate, m.EndDate)
                    })
                                       .OrderByDescending(m => m.IsActive)
                                       .ThenByDescending(m => m.IsBCBA)
                                       .ThenBy(m => m.ProviderLastName)
                                       .ThenBy(m => m.ProviderFirstName),
                    SystemSpecialAttentionNeeds = Context.SpecialAttentionNeeds
                                                  .Where(n => n.Active)
                                                  .Select(n => new SpecialAttentionNeedVM
                    {
                        ID   = n.ID,
                        Code = n.Code,
                        Name = n.Name
                    })
                                                  .ToList(),
                    SpecialAttentionNeedIDs = staffingLog.SpecialAttentionNeeds != null?staffingLog.SpecialAttentionNeeds.Select(n => n.ID).ToList() : new List <int>(),
                                                  ParentalRestaffRequest   = staffingLog.ParentalRestaffRequest,
                                                  HoursOfABATherapy        = staffingLog.HoursOfABATherapy,
                                                  AidesRespondingNo        = staffingLog.AidesRespondingNo,
                                                  AidesRespondingMaybe     = staffingLog.AidesRespondingMaybe,
                                                  ScheduleRequest          = ScheduleRequestVM.FromInt(staffingLog.ScheduleRequest),
                                                  DateWentToRestaff        = staffingLog.DateWentToRestaff,
                                                  ProviderGenderPreference = string.IsNullOrEmpty(staffingLog.ProviderGenderPreference) ? '0' : staffingLog.ProviderGenderPreference[0]
                };
            }
            return(model);
        }