Ejemplo n.º 1
0
        //
        // GET: /PatientDashboard/

        //public ActionResult GetAllActivitiesByClinicalCase(long id)
        //{
        //    //TODO: DI in costructor or use a Func<IRequestHandler> parameter in the constructor, bind the constructor parameter when set up in DI container
        //    var requestDispatcherFactory = IoC.Container.Resolve<IRequestDispatcherFactory>();

        //    var patientId = id;

        //    //Get the ClinicalCases by the patient key
        //    var requestDispatcher = requestDispatcherFactory.CreateRequestDispatcher();
        //    requestDispatcher.Add(new GetAllClinicalCasesByPatientRequest { PatientKey = patientId });
        //    var getAllClinicalCasesByPatientResponse = requestDispatcher.Get<GetAllClinicalCasesByPatientResponse>();
        //    var clinicalCaseList = getAllClinicalCasesByPatientResponse.ClinicalCases;

        //    var firstClinicalCase = clinicalCaseList.FirstOrDefault();

        //    IEnumerable<ActivityDto> activityDtos = null;

        //    if (firstClinicalCase != null)
        //    {
        //        requestDispatcher = requestDispatcherFactory.CreateRequestDispatcher();
        //        requestDispatcher.Add(new GetAllActivitiesByClinicalCaseRequest() { ClinicalCaseKey = firstClinicalCase.Key });

        //        var getAllActivitiesByClinicalCaseResponse = requestDispatcher.Get<GetAllActivitiesByClinicalCaseResponse>();
        //        activityDtos = getAllActivitiesByClinicalCaseResponse.ActivityDtos;
        //    }

        //    return View(activityDtos);
        //}

        /// <summary>
        /// Edits the social history.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="patientId">The patient id.</param>
        /// <returns>A <see cref="System.Web.Mvc.ActionResult"/></returns>
        public ActionResult EditSocialHistory(long id, long patientId)
        {
            var socialHistoryId = id;

            var requestDispatcher = _requestDispatcherFactory.CreateRequestDispatcher();

            requestDispatcher.Add(new GetDtoRequest <PatientSummaryDto> {
                Key = patientId
            });
            requestDispatcher.Add(new GetDtoRequest <SocialHistoryDto> {
                Key = socialHistoryId
            });

            var getPatientSummaryResponse = requestDispatcher.Get <DtoResponse <PatientSummaryDto> > ();
            var patientSummary            = getPatientSummaryResponse.DataTransferObject;

            var response         = requestDispatcher.Get <DtoResponse <SocialHistoryDto> > ();
            var socialHistoryDto = response.DataTransferObject;

            var model = new EditSocialHistoryModel
            {
                PatientKey = patientSummary.Key, PatientName = patientSummary.DisplayName, SocialHistory = socialHistoryDto
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the user session.
        /// </summary>
        public void InitializeUserSession()
        {
            var dispatcher = _requestDispatcherFactory.CreateRequestDispatcher();

            dispatcher.Add(new GetUserInformationRequest());
            var userInfo = dispatcher.Get <GetUserInformationResponse> ();

            InitializeUserInformation(userInfo.UserInformationDto);
            _initialized = true;
            ChangeContext(CurrentUserContext);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>A <see cref="System.Web.Mvc.ActionResult"/></returns>
        public ActionResult Index()
        {
            var requestDispatcher = _requestDispatcherFactory.CreateRequestDispatcher();

            //IoC.Container.Resolve<IRequestDispatcher>();

            requestDispatcher.Add(new GetClinicianPatientsRequest {
                ClinicianKey = StaffContext.Key
            });

            var response = requestDispatcher.Get <GetClinicianPatientsResponse> ();

            IEnumerable <ClinicianPatientDto> patientList = null;

            if (response.Exception == null)
            {
                patientList = response.PatientList;
            }
            else
            {
                // Notify exception
            }

            //SocialHistoryDto socialHistory = new SocialHistoryDto();
            //socialHistory.VisitKey = 4000;
            //socialHistory.Phq2FeelingDownAnswerNumber = 1;
            //socialHistory.Phq2LittleInterestInDoingThingsAnswerNumber = 2;
            //socialHistory.Phq2Score = 3;

            //var request = new SaveDtoRequest<SocialHistoryDto> ();
            //request.DataTransferObject = socialHistory;

            //requestDispatcher.Add(request);

            //var responseResult = requestDispatcher.Get<DtoResponse<SocialHistoryDto>> ();

            return(View(patientList));
        }
Ejemplo n.º 4
0
 public IAsyncRequestDispatcher CreateAsyncRequestDispatcher()
 {
     return(_requestDispatcherFactory.CreateRequestDispatcher() as IAsyncRequestDispatcher);
 }
Ejemplo n.º 5
0
        /// <summary>
        ///     Creates the async request dispatcher.
        /// </summary>
        /// <returns></returns>
        public IAsyncRequestDispatcher CreateAsyncRequestDispatcher()
        {
            var dispatcher = _requestDispatcherFactory.CreateRequestDispatcher();

            return(dispatcher as IAsyncRequestDispatcher);
        }