public AddParentContactLogVM CreateParentContactLogVM(int caseId) { var caseService = new Data.Services.CaseService(); var relationships = caseService.GetGuardianRelationships(); var model = new AddParentContactLogVM { CaseId = caseId, Relationships = relationships }; return(model); }
public List <ParentContactLogListItemVM> LoadParentContactLogVM(int caseId) { var caseService = new Data.Services.CaseService(); var relationships = caseService.GetGuardianRelationships().ToDictionary(k => k.ID, v => v.Name); var log = Context.StaffingLogParentContactLog .Where(l => l.StaffingLogID == caseId) .OrderByDescending(l => l.ContactDate) .ToList() .Select(l => new ParentContactLogListItemVM { ContactDate = l.ContactDate, Notes = l.Notes, ContactedPerson = relationships[l.GuardianRelationshipID] + (!string.IsNullOrWhiteSpace(l.ContactedPersonName) ? " (" + l.ContactedPersonName + ")" : ""), ContactMethod = l.ContactMethodType.ToString() + " (" + l.ContactMethodValue + ")" }) .ToList(); return(log); }
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); }