public TrackedPatientsResult GetTrackedPatients(int page, int itemsPerPage)
        {
            // *** Gets a tracked patients result from the broker ***

            TrackedPatientsResult result = new TrackedPatientsResult();

            // *** Create the command needed to get tracked patients ***
            DsioGetTrackingCommand command = new DsioGetTrackingCommand(this.broker);

            // *** Add appropriate parameters ***
            command.AddGetTrackedPatientsParameters(page, itemsPerPage);

            // *** Execute command and get response ***
            RpcResponse response = command.Execute();

            // *** Add response to return result ***
            result.Success = (response.Status == RpcResponseStatus.Success);

            // *** Check for success ***
            if (result.Success)
            {
                result.Patients = new List <TrackedPatient>();

                // *** Check if we have result ***
                if (command.TrackedPatients != null)
                {
                    // *** Loop through resulting patients ***
                    foreach (DsioTrackedPatient dsioPatient in command.TrackedPatients)
                    {
                        // *** Get strongly typed patient from dsio Patient ***
                        TrackedPatient trackedPatient = GetTrackedPatient(dsioPatient);

                        // *** Add patient to list ***
                        result.Patients.Add(trackedPatient);
                    }
                }

                result.TotalResults = command.TotalResults;
            }
            else
            {
                result.Message = response.InformationalMessage;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void TestGetTracking_TrackedPatients()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetTrackingCommand command = new DsioGetTrackingCommand(broker);

                command.AddGetTrackedPatientsParameters(1, 100);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(command.TrackedPatients);

                broker.Disconnect();
            }
        }