Exemplo n.º 1
0
        public GetCasesResponse GetCases(GetCasesRequest request)
        {
            var provider = ProviderProvider.GetProvider(request.UserProviderID);

            if (provider == null)
            {
                throw new InvalidOperationException("Unknown provider");
            }
            var result = new GetCasesResponse
            {
                //Settings = _settings.AllClientAppSettings
            };
            var cutoffDate  = DateTime.Now.Date;
            var activeCases = provider?.GetActiveCasesAtDate(DateTime.Now);

            result.Cases = activeCases.Select(c => new CaseData
            {
                Case = Mapper.MapCase(c),
                ValidatedSessions = c.GetPrecheckedSessions().Where(x => x.Date >= cutoffDate).Select(Mapper.MapSession)
            });
            return(result);
        }
Exemplo n.º 2
0
        public CaseInfo GetCaseInfoForCaseId(string userId, int caseId)
        {
            var provider = ProviderProvider.GetProvider(Convert.ToInt32(userId));

            if (provider == null)
            {
                throw new InvalidOperationException("Unknown provider");
            }
            CaseInfo caseInfo     = null;
            var      caseService  = new CaseService();
            var      selectedCase = caseService.GetActiveCasesByProvider(provider.ID, VisibleAfterEndDateDays).FirstOrDefault(c => c.ID == caseId);

            if (selectedCase != null)
            {
                caseInfo = new CaseInfo
                {
                    CaseId             = selectedCase.ID,
                    PatientFirstName   = selectedCase.Patient.FirstName,
                    PatientLastName    = selectedCase.Patient.LastName,
                    PatientDateOfBirth = selectedCase.Patient.DateOfBirth
                };
            }
            return(caseInfo);
        }